electron.d.ts 612 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286
  1. // Type definitions for Electron 11.1.1
  2. // Project: http://electronjs.org/
  3. // Definitions by: The Electron Team <https://github.com/electron/electron>
  4. // Definitions: https://github.com/electron/electron-typescript-definitions
  5. /// <reference types="node" />
  6. type GlobalEvent = Event;
  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` that was used to open the
  438. * application, if it was launched from Notification Center. You can also call
  439. * `app.isReady()` to check if this event has already fired and `app.whenReady()`
  440. * to get a Promise that is fulfilled when Electron is initialized.
  441. */
  442. on(event: 'ready', listener: (event: Event,
  443. launchInfo: Record<string, any>) => void): this;
  444. once(event: 'ready', listener: (event: Event,
  445. launchInfo: Record<string, any>) => void): this;
  446. addListener(event: 'ready', listener: (event: Event,
  447. launchInfo: Record<string, any>) => void): this;
  448. removeListener(event: 'ready', listener: (event: Event,
  449. launchInfo: Record<string, any>) => void): this;
  450. /**
  451. * Emitted when `remote.getBuiltin()` is called in the renderer process of
  452. * `webContents`. Calling `event.preventDefault()` will prevent the module from
  453. * being returned. Custom value can be returned by setting `event.returnValue`.
  454. */
  455. on(event: 'remote-get-builtin', listener: (event: Event,
  456. webContents: WebContents,
  457. moduleName: string) => void): this;
  458. once(event: 'remote-get-builtin', listener: (event: Event,
  459. webContents: WebContents,
  460. moduleName: string) => void): this;
  461. addListener(event: 'remote-get-builtin', listener: (event: Event,
  462. webContents: WebContents,
  463. moduleName: string) => void): this;
  464. removeListener(event: 'remote-get-builtin', listener: (event: Event,
  465. webContents: WebContents,
  466. moduleName: string) => void): this;
  467. /**
  468. * Emitted when `remote.getCurrentWebContents()` is called in the renderer process
  469. * of `webContents`. Calling `event.preventDefault()` will prevent the object from
  470. * being returned. Custom value can be returned by setting `event.returnValue`.
  471. */
  472. on(event: 'remote-get-current-web-contents', listener: (event: Event,
  473. webContents: WebContents) => void): this;
  474. once(event: 'remote-get-current-web-contents', listener: (event: Event,
  475. webContents: WebContents) => void): this;
  476. addListener(event: 'remote-get-current-web-contents', listener: (event: Event,
  477. webContents: WebContents) => void): this;
  478. removeListener(event: 'remote-get-current-web-contents', listener: (event: Event,
  479. webContents: WebContents) => void): this;
  480. /**
  481. * Emitted when `remote.getCurrentWindow()` is called in the renderer process of
  482. * `webContents`. Calling `event.preventDefault()` will prevent the object from
  483. * being returned. Custom value can be returned by setting `event.returnValue`.
  484. */
  485. on(event: 'remote-get-current-window', listener: (event: Event,
  486. webContents: WebContents) => void): this;
  487. once(event: 'remote-get-current-window', listener: (event: Event,
  488. webContents: WebContents) => void): this;
  489. addListener(event: 'remote-get-current-window', listener: (event: Event,
  490. webContents: WebContents) => void): this;
  491. removeListener(event: 'remote-get-current-window', listener: (event: Event,
  492. webContents: WebContents) => void): this;
  493. /**
  494. * Emitted when `remote.getGlobal()` is called in the renderer process of
  495. * `webContents`. Calling `event.preventDefault()` will prevent the global from
  496. * being returned. Custom value can be returned by setting `event.returnValue`.
  497. */
  498. on(event: 'remote-get-global', listener: (event: Event,
  499. webContents: WebContents,
  500. globalName: string) => void): this;
  501. once(event: 'remote-get-global', listener: (event: Event,
  502. webContents: WebContents,
  503. globalName: string) => void): this;
  504. addListener(event: 'remote-get-global', listener: (event: Event,
  505. webContents: WebContents,
  506. globalName: string) => void): this;
  507. removeListener(event: 'remote-get-global', listener: (event: Event,
  508. webContents: WebContents,
  509. globalName: string) => void): this;
  510. /**
  511. * Emitted when `remote.require()` is called in the renderer process of
  512. * `webContents`. Calling `event.preventDefault()` will prevent the module from
  513. * being returned. Custom value can be returned by setting `event.returnValue`.
  514. */
  515. on(event: 'remote-require', listener: (event: Event,
  516. webContents: WebContents,
  517. moduleName: string) => void): this;
  518. once(event: 'remote-require', listener: (event: Event,
  519. webContents: WebContents,
  520. moduleName: string) => void): this;
  521. addListener(event: 'remote-require', listener: (event: Event,
  522. webContents: WebContents,
  523. moduleName: string) => void): this;
  524. removeListener(event: 'remote-require', listener: (event: Event,
  525. webContents: WebContents,
  526. moduleName: string) => void): this;
  527. /**
  528. * Emitted when the renderer process unexpectedly disappears. This is normally
  529. * because it was crashed or killed.
  530. */
  531. on(event: 'render-process-gone', listener: (event: Event,
  532. webContents: WebContents,
  533. details: RenderProcessGoneDetails) => void): this;
  534. once(event: 'render-process-gone', listener: (event: Event,
  535. webContents: WebContents,
  536. details: RenderProcessGoneDetails) => void): this;
  537. addListener(event: 'render-process-gone', listener: (event: Event,
  538. webContents: WebContents,
  539. details: RenderProcessGoneDetails) => void): this;
  540. removeListener(event: 'render-process-gone', listener: (event: Event,
  541. webContents: WebContents,
  542. details: RenderProcessGoneDetails) => void): this;
  543. on(event: 'renderer-process-crashed', listener: (event: Event,
  544. webContents: WebContents,
  545. killed: boolean) => void): this;
  546. once(event: 'renderer-process-crashed', listener: (event: Event,
  547. webContents: WebContents,
  548. killed: boolean) => void): this;
  549. addListener(event: 'renderer-process-crashed', listener: (event: Event,
  550. webContents: WebContents,
  551. killed: boolean) => void): this;
  552. removeListener(event: 'renderer-process-crashed', listener: (event: Event,
  553. webContents: WebContents,
  554. killed: boolean) => void): this;
  555. /**
  556. * This event will be emitted inside the primary instance of your application when
  557. * a second instance has been executed and calls `app.requestSingleInstanceLock()`.
  558. *
  559. * `argv` is an Array of the second instance's command line arguments, and
  560. * `workingDirectory` is its current working directory. Usually applications
  561. * respond to this by making their primary window focused and non-minimized.
  562. *
  563. * **Note:** If the second instance is started by a different user than the first,
  564. * the `argv` array will not include the arguments.
  565. *
  566. * This event is guaranteed to be emitted after the `ready` event of `app` gets
  567. * emitted.
  568. *
  569. * **Note:** Extra command line arguments might be added by Chromium, such as
  570. * `--original-process-start-time`.
  571. */
  572. on(event: 'second-instance', listener: (event: Event,
  573. /**
  574. * An array of the second instance's command line arguments
  575. */
  576. argv: string[],
  577. /**
  578. * The second instance's working directory
  579. */
  580. workingDirectory: string) => void): this;
  581. once(event: 'second-instance', listener: (event: Event,
  582. /**
  583. * An array of the second instance's command line arguments
  584. */
  585. argv: string[],
  586. /**
  587. * The second instance's working directory
  588. */
  589. workingDirectory: string) => void): this;
  590. addListener(event: 'second-instance', listener: (event: Event,
  591. /**
  592. * An array of the second instance's command line arguments
  593. */
  594. argv: string[],
  595. /**
  596. * The second instance's working directory
  597. */
  598. workingDirectory: string) => void): this;
  599. removeListener(event: 'second-instance', listener: (event: Event,
  600. /**
  601. * An array of the second instance's command line arguments
  602. */
  603. argv: string[],
  604. /**
  605. * The second instance's working directory
  606. */
  607. workingDirectory: string) => void): this;
  608. /**
  609. * Emitted when a client certificate is requested.
  610. *
  611. * The `url` corresponds to the navigation entry requesting the client certificate
  612. * and `callback` can be called with an entry filtered from the list. Using
  613. * `event.preventDefault()` prevents the application from using the first
  614. * certificate from the store.
  615. */
  616. on(event: 'select-client-certificate', listener: (event: Event,
  617. webContents: WebContents,
  618. url: string,
  619. certificateList: Certificate[],
  620. callback: (certificate?: Certificate) => void) => void): this;
  621. once(event: 'select-client-certificate', listener: (event: Event,
  622. webContents: WebContents,
  623. url: string,
  624. certificateList: Certificate[],
  625. callback: (certificate?: Certificate) => void) => void): this;
  626. addListener(event: 'select-client-certificate', listener: (event: Event,
  627. webContents: WebContents,
  628. url: string,
  629. certificateList: Certificate[],
  630. callback: (certificate?: Certificate) => void) => void): this;
  631. removeListener(event: 'select-client-certificate', listener: (event: Event,
  632. webContents: WebContents,
  633. url: string,
  634. certificateList: Certificate[],
  635. callback: (certificate?: Certificate) => void) => void): this;
  636. /**
  637. * Emitted when Electron has created a new `session`.
  638. */
  639. on(event: 'session-created', listener: (session: Session) => void): this;
  640. once(event: 'session-created', listener: (session: Session) => void): this;
  641. addListener(event: 'session-created', listener: (session: Session) => void): this;
  642. removeListener(event: 'session-created', listener: (session: Session) => void): this;
  643. /**
  644. * Emitted when Handoff is about to be resumed on another device. If you need to
  645. * update the state to be transferred, you should call `event.preventDefault()`
  646. * immediately, construct a new `userInfo` dictionary and call
  647. * `app.updateCurrentActivity()` in a timely manner. Otherwise, the operation will
  648. * fail and `continue-activity-error` will be called.
  649. *
  650. * @platform darwin
  651. */
  652. on(event: 'update-activity-state', listener: (event: Event,
  653. /**
  654. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  655. */
  656. type: string,
  657. /**
  658. * Contains app-specific state stored by the activity.
  659. */
  660. userInfo: unknown) => void): this;
  661. once(event: 'update-activity-state', listener: (event: Event,
  662. /**
  663. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  664. */
  665. type: string,
  666. /**
  667. * Contains app-specific state stored by the activity.
  668. */
  669. userInfo: unknown) => void): this;
  670. addListener(event: 'update-activity-state', listener: (event: Event,
  671. /**
  672. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  673. */
  674. type: string,
  675. /**
  676. * Contains app-specific state stored by the activity.
  677. */
  678. userInfo: unknown) => void): this;
  679. removeListener(event: 'update-activity-state', listener: (event: Event,
  680. /**
  681. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  682. */
  683. type: string,
  684. /**
  685. * Contains app-specific state stored by the activity.
  686. */
  687. userInfo: unknown) => void): this;
  688. /**
  689. * Emitted when a new webContents is created.
  690. */
  691. on(event: 'web-contents-created', listener: (event: Event,
  692. webContents: WebContents) => void): this;
  693. once(event: 'web-contents-created', listener: (event: Event,
  694. webContents: WebContents) => void): this;
  695. addListener(event: 'web-contents-created', listener: (event: Event,
  696. webContents: WebContents) => void): this;
  697. removeListener(event: 'web-contents-created', listener: (event: Event,
  698. webContents: WebContents) => void): this;
  699. /**
  700. * Emitted during Handoff before an activity from a different device wants to be
  701. * resumed. You should call `event.preventDefault()` if you want to handle this
  702. * event.
  703. *
  704. * @platform darwin
  705. */
  706. on(event: 'will-continue-activity', listener: (event: Event,
  707. /**
  708. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  709. */
  710. type: string) => void): this;
  711. once(event: 'will-continue-activity', listener: (event: Event,
  712. /**
  713. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  714. */
  715. type: string) => void): this;
  716. addListener(event: 'will-continue-activity', listener: (event: Event,
  717. /**
  718. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  719. */
  720. type: string) => void): this;
  721. removeListener(event: 'will-continue-activity', listener: (event: Event,
  722. /**
  723. * A string identifying the activity. Maps to `NSUserActivity.activityType`.
  724. */
  725. type: string) => void): this;
  726. /**
  727. * Emitted when the application has finished basic startup. On Windows and Linux,
  728. * the `will-finish-launching` event is the same as the `ready` event; on macOS,
  729. * this event represents the `applicationWillFinishLaunching` notification of
  730. * `NSApplication`. You would usually set up listeners for the `open-file` and
  731. * `open-url` events here, and start the crash reporter and auto updater.
  732. *
  733. In most cases, you should do everything in the `ready` event handler.
  734. */
  735. on(event: 'will-finish-launching', listener: Function): this;
  736. once(event: 'will-finish-launching', listener: Function): this;
  737. addListener(event: 'will-finish-launching', listener: Function): this;
  738. removeListener(event: 'will-finish-launching', listener: Function): this;
  739. /**
  740. * Emitted when all windows have been closed and the application will quit. Calling
  741. * `event.preventDefault()` will prevent the default behavior, which is terminating
  742. * the application.
  743. *
  744. * See the description of the `window-all-closed` event for the differences between
  745. * the `will-quit` and `window-all-closed` events.
  746. *
  747. * **Note:** On Windows, this event will not be emitted if the app is closed due to
  748. * a shutdown/restart of the system or a user logout.
  749. */
  750. on(event: 'will-quit', listener: (event: Event) => void): this;
  751. once(event: 'will-quit', listener: (event: Event) => void): this;
  752. addListener(event: 'will-quit', listener: (event: Event) => void): this;
  753. removeListener(event: 'will-quit', listener: (event: Event) => void): this;
  754. /**
  755. * Emitted when all windows have been closed.
  756. *
  757. * If you do not subscribe to this event and all windows are closed, the default
  758. * behavior is to quit the app; however, if you subscribe, you control whether the
  759. * app quits or not. If the user pressed `Cmd + Q`, or the developer called
  760. * `app.quit()`, Electron will first try to close all the windows and then emit the
  761. * `will-quit` event, and in this case the `window-all-closed` event would not be
  762. * emitted.
  763. */
  764. on(event: 'window-all-closed', listener: Function): this;
  765. once(event: 'window-all-closed', listener: Function): this;
  766. addListener(event: 'window-all-closed', listener: Function): this;
  767. removeListener(event: 'window-all-closed', listener: Function): this;
  768. /**
  769. * Adds `path` to the recent documents list.
  770. *
  771. * This list is managed by the OS. On Windows, you can visit the list from the task
  772. * bar, and on macOS, you can visit it from dock menu.
  773. *
  774. * @platform darwin,win32
  775. */
  776. addRecentDocument(path: string): void;
  777. /**
  778. * Clears the recent documents list.
  779. *
  780. * @platform darwin,win32
  781. */
  782. clearRecentDocuments(): void;
  783. /**
  784. * By default, Chromium disables 3D APIs (e.g. WebGL) until restart on a per domain
  785. * basis if the GPU processes crashes too frequently. This function disables that
  786. * behavior.
  787. This method can only be called before app is ready.
  788. */
  789. disableDomainBlockingFor3DAPIs(): void;
  790. /**
  791. * Disables hardware acceleration for current app.
  792. *
  793. This method can only be called before app is ready.
  794. */
  795. disableHardwareAcceleration(): void;
  796. /**
  797. * Enables full sandbox mode on the app. This means that all renderers will be
  798. * launched sandboxed, regardless of the value of the `sandbox` flag in
  799. * WebPreferences.
  800. This method can only be called before app is ready.
  801. */
  802. enableSandbox(): void;
  803. /**
  804. * Exits immediately with `exitCode`. `exitCode` defaults to 0.
  805. *
  806. * All windows will be closed immediately without asking the user, and the
  807. * `before-quit` and `will-quit` events will not be emitted.
  808. */
  809. exit(exitCode?: number): void;
  810. /**
  811. * On Linux, focuses on the first visible window. On macOS, makes the application
  812. * the active app. On Windows, focuses on the application's first window.
  813. *
  814. You should seek to use the `steal` option as sparingly as possible.
  815. */
  816. focus(options?: FocusOptions): void;
  817. /**
  818. * Resolve with an object containing the following:
  819. *
  820. * * `icon` NativeImage - the display icon of the app handling the protocol.
  821. * * `path` String - installation path of the app handling the protocol.
  822. * * `name` String - display name of the app handling the protocol.
  823. *
  824. * This method returns a promise that contains the application name, icon and path
  825. * of the default handler for the protocol (aka URI scheme) of a URL.
  826. *
  827. * @platform darwin,win32
  828. */
  829. getApplicationInfoForProtocol(url: string): Promise<Electron.ApplicationInfoForProtocolReturnValue>;
  830. /**
  831. * Name of the application handling the protocol, or an empty string if there is no
  832. * handler. For instance, if Electron is the default handler of the URL, this could
  833. * be `Electron` on Windows and Mac. However, don't rely on the precise format
  834. * which is not guaranteed to remain unchanged. Expect a different format on Linux,
  835. * possibly with a `.desktop` suffix.
  836. *
  837. * This method returns the application name of the default handler for the protocol
  838. * (aka URI scheme) of a URL.
  839. */
  840. getApplicationNameForProtocol(url: string): string;
  841. /**
  842. * Array of `ProcessMetric` objects that correspond to memory and CPU usage
  843. * statistics of all the processes associated with the app.
  844. */
  845. getAppMetrics(): ProcessMetric[];
  846. /**
  847. * The current application directory.
  848. */
  849. getAppPath(): string;
  850. /**
  851. * The current value displayed in the counter badge.
  852. *
  853. * @platform linux,darwin
  854. */
  855. getBadgeCount(): number;
  856. /**
  857. * The type of the currently running activity.
  858. *
  859. * @platform darwin
  860. */
  861. getCurrentActivityType(): string;
  862. /**
  863. * fulfilled with the app's icon, which is a NativeImage.
  864. *
  865. * Fetches a path's associated icon.
  866. *
  867. * On _Windows_, there a 2 kinds of icons:
  868. *
  869. * * Icons associated with certain file extensions, like `.mp3`, `.png`, etc.
  870. * * Icons inside the file itself, like `.exe`, `.dll`, `.ico`.
  871. *
  872. * On _Linux_ and _macOS_, icons depend on the application associated with file
  873. * mime type.
  874. */
  875. getFileIcon(path: string, options?: FileIconOptions): Promise<Electron.NativeImage>;
  876. /**
  877. * The Graphics Feature Status from `chrome://gpu/`.
  878. *
  879. * **Note:** This information is only usable after the `gpu-info-update` event is
  880. * emitted.
  881. */
  882. getGPUFeatureStatus(): GPUFeatureStatus;
  883. /**
  884. * For `infoType` equal to `complete`: Promise is fulfilled with `Object`
  885. * containing all the GPU Information as in chromium's GPUInfo object. This
  886. * includes the version and driver information that's shown on `chrome://gpu` page.
  887. *
  888. * For `infoType` equal to `basic`: Promise is fulfilled with `Object` containing
  889. * fewer attributes than when requested with `complete`. Here's an example of basic
  890. * response:
  891. *
  892. * Using `basic` should be preferred if only basic information like `vendorId` or
  893. * `driverId` is needed.
  894. */
  895. getGPUInfo(infoType: 'basic' | 'complete'): Promise<unknown>;
  896. /**
  897. * * `minItems` Integer - The minimum number of items that will be shown in the
  898. * Jump List (for a more detailed description of this value see the MSDN docs).
  899. * * `removedItems` JumpListItem[] - Array of `JumpListItem` objects that
  900. * correspond to items that the user has explicitly removed from custom categories
  901. * in the Jump List. These items must not be re-added to the Jump List in the
  902. * **next** call to `app.setJumpList()`, Windows will not display any custom
  903. * category that contains any of the removed items.
  904. *
  905. * @platform win32
  906. */
  907. getJumpListSettings(): JumpListSettings;
  908. /**
  909. * The current application locale. Possible return values are documented here.
  910. *
  911. * To set the locale, you'll want to use a command line switch at app startup,
  912. * which may be found here.
  913. *
  914. * **Note:** When distributing your packaged app, you have to also ship the
  915. * `locales` folder.
  916. *
  917. * **Note:** On Windows, you have to call it after the `ready` events gets emitted.
  918. */
  919. getLocale(): string;
  920. /**
  921. * User operating system's locale two-letter ISO 3166 country code. The value is
  922. * taken from native OS APIs.
  923. *
  924. **Note:** When unable to detect locale country code, it returns empty string.
  925. */
  926. getLocaleCountryCode(): string;
  927. /**
  928. * If you provided `path` and `args` options to `app.setLoginItemSettings`, then
  929. * you need to pass the same arguments here for `openAtLogin` to be set correctly.
  930. *
  931. *
  932. * * `openAtLogin` Boolean - `true` if the app is set to open at login.
  933. * * `openAsHidden` Boolean _macOS_ - `true` if the app is set to open as hidden at
  934. * login. This setting is not available on MAS builds.
  935. * * `wasOpenedAtLogin` Boolean _macOS_ - `true` if the app was opened at login
  936. * automatically. This setting is not available on MAS builds.
  937. * * `wasOpenedAsHidden` Boolean _macOS_ - `true` if the app was opened as a hidden
  938. * login item. This indicates that the app should not open any windows at startup.
  939. * This setting is not available on MAS builds.
  940. * * `restoreState` Boolean _macOS_ - `true` if the app was opened as a login item
  941. * that should restore the state from the previous session. This indicates that the
  942. * app should restore the windows that were open the last time the app was closed.
  943. * This setting is not available on MAS builds.
  944. * * `executableWillLaunchAtLogin` Boolean _Windows_ - `true` if app is set to open
  945. * at login and its run key is not deactivated. This differs from `openAtLogin` as
  946. * it ignores the `args` option, this property will be true if the given executable
  947. * would be launched at login with **any** arguments.
  948. * * `launchItems` Object[] _Windows_
  949. * * `name` String _Windows_ - name value of a registry entry.
  950. * * `path` String _Windows_ - The executable to an app that corresponds to a
  951. * registry entry.
  952. * * `args` String[] _Windows_ - the command-line arguments to pass to the
  953. * executable.
  954. * * `scope` String _Windows_ - one of `user` or `machine`. Indicates whether the
  955. * registry entry is under `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
  956. * * `enabled` Boolean _Windows_ - `true` if the app registry key is startup
  957. * approved and therefore shows as `enabled` in Task Manager and Windows settings.
  958. *
  959. * @platform darwin,win32
  960. */
  961. getLoginItemSettings(options?: LoginItemSettingsOptions): LoginItemSettings;
  962. /**
  963. * The current application's name, which is the name in the application's
  964. * `package.json` file.
  965. *
  966. * Usually the `name` field of `package.json` is a short lowercase name, according
  967. * to the npm modules spec. You should usually also specify a `productName` field,
  968. * which is your application's full capitalized name, and which will be preferred
  969. * over `name` by Electron.
  970. */
  971. getName(): string;
  972. /**
  973. * A path to a special directory or file associated with `name`. On failure, an
  974. * `Error` is thrown.
  975. *
  976. * If `app.getPath('logs')` is called without called `app.setAppLogsPath()` being
  977. * called first, a default log directory will be created equivalent to calling
  978. * `app.setAppLogsPath()` without a `path` parameter.
  979. */
  980. getPath(name: 'home' | 'appData' | 'userData' | 'cache' | 'temp' | 'exe' | 'module' | 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | 'recent' | 'logs' | 'pepperFlashSystemPlugin' | 'crashDumps'): string;
  981. /**
  982. * The version of the loaded application. If no version is found in the
  983. * application's `package.json` file, the version of the current bundle or
  984. * executable is returned.
  985. */
  986. getVersion(): string;
  987. /**
  988. * This method returns whether or not this instance of your app is currently
  989. * holding the single instance lock. You can request the lock with
  990. * `app.requestSingleInstanceLock()` and release with
  991. * `app.releaseSingleInstanceLock()`
  992. */
  993. hasSingleInstanceLock(): boolean;
  994. /**
  995. * Hides all application windows without minimizing them.
  996. *
  997. * @platform darwin
  998. */
  999. hide(): void;
  1000. /**
  1001. * Imports the certificate in pkcs12 format into the platform certificate store.
  1002. * `callback` is called with the `result` of import operation, a value of `0`
  1003. * indicates success while any other value indicates failure according to Chromium
  1004. * net_error_list.
  1005. *
  1006. * @platform linux
  1007. */
  1008. importCertificate(options: ImportCertificateOptions, callback: (result: number) => void): void;
  1009. /**
  1010. * Invalidates the current Handoff user activity.
  1011. *
  1012. * @platform darwin
  1013. */
  1014. invalidateCurrentActivity(): void;
  1015. /**
  1016. * `true` if Chrome's accessibility support is enabled, `false` otherwise. This API
  1017. * will return `true` if the use of assistive technologies, such as screen readers,
  1018. * has been detected. See
  1019. * https://www.chromium.org/developers/design-documents/accessibility for more
  1020. * details.
  1021. *
  1022. * @platform darwin,win32
  1023. */
  1024. isAccessibilitySupportEnabled(): boolean;
  1025. /**
  1026. * Whether the current executable is the default handler for a protocol (aka URI
  1027. * scheme).
  1028. *
  1029. * **Note:** On macOS, you can use this method to check if the app has been
  1030. * registered as the default protocol handler for a protocol. You can also verify
  1031. * this by checking `~/Library/Preferences/com.apple.LaunchServices.plist` on the
  1032. * macOS machine. Please refer to Apple's documentation for details.
  1033. *
  1034. * The API uses the Windows Registry and `LSCopyDefaultHandlerForURLScheme`
  1035. * internally.
  1036. */
  1037. isDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
  1038. /**
  1039. * whether or not the current OS version allows for native emoji pickers.
  1040. */
  1041. isEmojiPanelSupported(): boolean;
  1042. /**
  1043. * Whether the application is currently running from the systems Application
  1044. * folder. Use in combination with `app.moveToApplicationsFolder()`
  1045. *
  1046. * @platform darwin
  1047. */
  1048. isInApplicationsFolder(): boolean;
  1049. /**
  1050. * `true` if Electron has finished initializing, `false` otherwise. See also
  1051. * `app.whenReady()`.
  1052. */
  1053. isReady(): boolean;
  1054. /**
  1055. * whether `Secure Keyboard Entry` is enabled.
  1056. *
  1057. By default this API will return `false`.
  1058. *
  1059. * @platform darwin
  1060. */
  1061. isSecureKeyboardEntryEnabled(): boolean;
  1062. /**
  1063. * Whether the current desktop environment is Unity launcher.
  1064. *
  1065. * @platform linux
  1066. */
  1067. isUnityRunning(): boolean;
  1068. /**
  1069. * Whether the move was successful. Please note that if the move is successful,
  1070. * your application will quit and relaunch.
  1071. *
  1072. * No confirmation dialog will be presented by default. If you wish to allow the
  1073. * user to confirm the operation, you may do so using the `dialog` API.
  1074. *
  1075. * **NOTE:** This method throws errors if anything other than the user causes the
  1076. * move to fail. For instance if the user cancels the authorization dialog, this
  1077. * method returns false. If we fail to perform the copy, then this method will
  1078. * throw an error. The message in the error should be informative and tell you
  1079. * exactly what went wrong.
  1080. *
  1081. * By default, if an app of the same name as the one being moved exists in the
  1082. * Applications directory and is _not_ running, the existing app will be trashed
  1083. * and the active app moved into its place. If it _is_ running, the pre-existing
  1084. * running app will assume focus and the previously active app will quit itself.
  1085. * This behavior can be changed by providing the optional conflict handler, where
  1086. * the boolean returned by the handler determines whether or not the move conflict
  1087. * is resolved with default behavior. i.e. returning `false` will ensure no
  1088. * further action is taken, returning `true` will result in the default behavior
  1089. * and the method continuing.
  1090. *
  1091. * For example:
  1092. *
  1093. * Would mean that if an app already exists in the user directory, if the user
  1094. * chooses to 'Continue Move' then the function would continue with its default
  1095. * behavior and the existing app will be trashed and the active app moved into its
  1096. * place.
  1097. *
  1098. * @platform darwin
  1099. */
  1100. moveToApplicationsFolder(options?: MoveToApplicationsFolderOptions): boolean;
  1101. /**
  1102. * Try to close all windows. The `before-quit` event will be emitted first. If all
  1103. * windows are successfully closed, the `will-quit` event will be emitted and by
  1104. * default the application will terminate.
  1105. *
  1106. * This method guarantees that all `beforeunload` and `unload` event handlers are
  1107. * correctly executed. It is possible that a window cancels the quitting by
  1108. * returning `false` in the `beforeunload` event handler.
  1109. */
  1110. quit(): void;
  1111. /**
  1112. * Relaunches the app when current instance exits.
  1113. *
  1114. * By default, the new instance will use the same working directory and command
  1115. * line arguments with current instance. When `args` is specified, the `args` will
  1116. * be passed as command line arguments instead. When `execPath` is specified, the
  1117. * `execPath` will be executed for relaunch instead of current app.
  1118. *
  1119. * Note that this method does not quit the app when executed, you have to call
  1120. * `app.quit` or `app.exit` after calling `app.relaunch` to make the app restart.
  1121. *
  1122. * When `app.relaunch` is called for multiple times, multiple instances will be
  1123. * started after current instance exited.
  1124. *
  1125. * An example of restarting current instance immediately and adding a new command
  1126. * line argument to the new instance:
  1127. */
  1128. relaunch(options?: RelaunchOptions): void;
  1129. /**
  1130. * Releases all locks that were created by `requestSingleInstanceLock`. This will
  1131. * allow multiple instances of the application to once again run side by side.
  1132. */
  1133. releaseSingleInstanceLock(): void;
  1134. /**
  1135. * Whether the call succeeded.
  1136. *
  1137. * This method checks if the current executable as the default handler for a
  1138. * protocol (aka URI scheme). If so, it will remove the app as the default handler.
  1139. *
  1140. * @platform darwin,win32
  1141. */
  1142. removeAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
  1143. /**
  1144. * The return value of this method indicates whether or not this instance of your
  1145. * application successfully obtained the lock. If it failed to obtain the lock,
  1146. * you can assume that another instance of your application is already running with
  1147. * the lock and exit immediately.
  1148. *
  1149. * I.e. This method returns `true` if your process is the primary instance of your
  1150. * application and your app should continue loading. It returns `false` if your
  1151. * process should immediately quit as it has sent its parameters to another
  1152. * instance that has already acquired the lock.
  1153. *
  1154. * On macOS, the system enforces single instance automatically when users try to
  1155. * open a second instance of your app in Finder, and the `open-file` and `open-url`
  1156. * events will be emitted for that. However when users start your app in command
  1157. * line, the system's single instance mechanism will be bypassed, and you have to
  1158. * use this method to ensure single instance.
  1159. *
  1160. * An example of activating the window of primary instance when a second instance
  1161. * starts:
  1162. */
  1163. requestSingleInstanceLock(): boolean;
  1164. /**
  1165. * Marks the current Handoff user activity as inactive without invalidating it.
  1166. *
  1167. * @platform darwin
  1168. */
  1169. resignCurrentActivity(): void;
  1170. /**
  1171. * Set the about panel options. This will override the values defined in the app's
  1172. * `.plist` file on macOS. See the Apple docs for more details. On Linux, values
  1173. * must be set in order to be shown; there are no defaults.
  1174. *
  1175. * If you do not set `credits` but still wish to surface them in your app, AppKit
  1176. * will look for a file named "Credits.html", "Credits.rtf", and "Credits.rtfd", in
  1177. * that order, in the bundle returned by the NSBundle class method main. The first
  1178. * file found is used, and if none is found, the info area is left blank. See Apple
  1179. * documentation for more information.
  1180. */
  1181. setAboutPanelOptions(options: AboutPanelOptionsOptions): void;
  1182. /**
  1183. * Manually enables Chrome's accessibility support, allowing to expose
  1184. * accessibility switch to users in application settings. See Chromium's
  1185. * accessibility docs for more details. Disabled by default.
  1186. *
  1187. * This API must be called after the `ready` event is emitted.
  1188. *
  1189. * **Note:** Rendering accessibility tree can significantly affect the performance
  1190. * of your app. It should not be enabled by default.
  1191. *
  1192. * @platform darwin,win32
  1193. */
  1194. setAccessibilitySupportEnabled(enabled: boolean): void;
  1195. /**
  1196. * Sets the activation policy for a given app.
  1197. *
  1198. * Activation policy types:
  1199. *
  1200. * * 'regular' - The application is an ordinary app that appears in the Dock and
  1201. * may have a user interface.
  1202. * * 'accessory' - The application doesn’t appear in the Dock and doesn’t have a
  1203. * menu bar, but it may be activated programmatically or by clicking on one of its
  1204. * windows.
  1205. * * 'prohibited' - The application doesn’t appear in the Dock and may not create
  1206. * windows or be activated.
  1207. *
  1208. * @platform darwin
  1209. */
  1210. setActivationPolicy(policy: 'regular' | 'accessory' | 'prohibited'): void;
  1211. /**
  1212. * Sets or creates a directory your app's logs which can then be manipulated with
  1213. * `app.getPath()` or `app.setPath(pathName, newPath)`.
  1214. *
  1215. * Calling `app.setAppLogsPath()` without a `path` parameter will result in this
  1216. * directory being set to `~/Library/Logs/YourAppName` on _macOS_, and inside the
  1217. * `userData` directory on _Linux_ and _Windows_.
  1218. */
  1219. setAppLogsPath(path?: string): void;
  1220. /**
  1221. * Changes the Application User Model ID to `id`.
  1222. *
  1223. * @platform win32
  1224. */
  1225. setAppUserModelId(id: string): void;
  1226. /**
  1227. * Whether the call succeeded.
  1228. *
  1229. * Sets the current executable as the default handler for a protocol (aka URI
  1230. * scheme). It allows you to integrate your app deeper into the operating system.
  1231. * Once registered, all links with `your-protocol://` will be opened with the
  1232. * current executable. The whole link, including protocol, will be passed to your
  1233. * application as a parameter.
  1234. *
  1235. * **Note:** On macOS, you can only register protocols that have been added to your
  1236. * app's `info.plist`, which cannot be modified at runtime. However, you can change
  1237. * the file during build time via Electron Forge, Electron Packager, or by editing
  1238. * `info.plist` with a text editor. Please refer to Apple's documentation for
  1239. * details.
  1240. *
  1241. * **Note:** In a Windows Store environment (when packaged as an `appx`) this API
  1242. * will return `true` for all calls but the registry key it sets won't be
  1243. * accessible by other applications. In order to register your Windows Store
  1244. * application as a default protocol handler you must declare the protocol in your
  1245. * manifest.
  1246. *
  1247. * The API uses the Windows Registry and `LSSetDefaultHandlerForURLScheme`
  1248. * internally.
  1249. */
  1250. setAsDefaultProtocolClient(protocol: string, path?: string, args?: string[]): boolean;
  1251. /**
  1252. * Whether the call succeeded.
  1253. *
  1254. * Sets the counter badge for current app. Setting the count to `0` will hide the
  1255. * badge.
  1256. *
  1257. * On macOS, it shows on the dock icon. On Linux, it only works for Unity launcher.
  1258. *
  1259. * **Note:** Unity launcher requires the existence of a `.desktop` file to work,
  1260. * for more information please read Desktop Environment Integration.
  1261. *
  1262. * @platform linux,darwin
  1263. */
  1264. setBadgeCount(count: number): boolean;
  1265. /**
  1266. * Sets or removes a custom Jump List for the application, and returns one of the
  1267. * following strings:
  1268. *
  1269. * * `ok` - Nothing went wrong.
  1270. * * `error` - One or more errors occurred, enable runtime logging to figure out
  1271. * the likely cause.
  1272. * * `invalidSeparatorError` - An attempt was made to add a separator to a custom
  1273. * category in the Jump List. Separators are only allowed in the standard `Tasks`
  1274. * category.
  1275. * * `fileTypeRegistrationError` - An attempt was made to add a file link to the
  1276. * Jump List for a file type the app isn't registered to handle.
  1277. * * `customCategoryAccessDeniedError` - Custom categories can't be added to the
  1278. * Jump List due to user privacy or group policy settings.
  1279. *
  1280. * If `categories` is `null` the previously set custom Jump List (if any) will be
  1281. * replaced by the standard Jump List for the app (managed by Windows).
  1282. *
  1283. * **Note:** If a `JumpListCategory` object has neither the `type` nor the `name`
  1284. * property set then its `type` is assumed to be `tasks`. If the `name` property is
  1285. * set but the `type` property is omitted then the `type` is assumed to be
  1286. * `custom`.
  1287. *
  1288. * **Note:** Users can remove items from custom categories, and Windows will not
  1289. * allow a removed item to be added back into a custom category until **after** the
  1290. * next successful call to `app.setJumpList(categories)`. Any attempt to re-add a
  1291. * removed item to a custom category earlier than that will result in the entire
  1292. * custom category being omitted from the Jump List. The list of removed items can
  1293. * be obtained using `app.getJumpListSettings()`.
  1294. *
  1295. Here's a very simple example of creating a custom Jump List:
  1296. *
  1297. * @platform win32
  1298. */
  1299. setJumpList(categories: (JumpListCategory[]) | (null)): void;
  1300. /**
  1301. * To work with Electron's `autoUpdater` on Windows, which uses Squirrel, you'll
  1302. * want to set the launch path to Update.exe, and pass arguments that specify your
  1303. * application name. For example:
  1304. *
  1305. * @platform darwin,win32
  1306. */
  1307. setLoginItemSettings(settings: Settings): void;
  1308. /**
  1309. * Overrides the current application's name.
  1310. *
  1311. * **Note:** This function overrides the name used internally by Electron; it does
  1312. * not affect the name that the OS uses.
  1313. */
  1314. setName(name: string): void;
  1315. /**
  1316. * Overrides the `path` to a special directory or file associated with `name`. If
  1317. * the path specifies a directory that does not exist, an `Error` is thrown. In
  1318. * that case, the directory should be created with `fs.mkdirSync` or similar.
  1319. *
  1320. * You can only override paths of a `name` defined in `app.getPath`.
  1321. *
  1322. * By default, web pages' cookies and caches will be stored under the `userData`
  1323. * directory. If you want to change this location, you have to override the
  1324. * `userData` path before the `ready` event of the `app` module is emitted.
  1325. */
  1326. setPath(name: string, path: string): void;
  1327. /**
  1328. * Set the `Secure Keyboard Entry` is enabled in your application.
  1329. *
  1330. * By using this API, important information such as password and other sensitive
  1331. * information can be prevented from being intercepted by other processes.
  1332. *
  1333. * See Apple's documentation for more details.
  1334. *
  1335. * **Note:** Enable `Secure Keyboard Entry` only when it is needed and disable it
  1336. * when it is no longer needed.
  1337. *
  1338. * @platform darwin
  1339. */
  1340. setSecureKeyboardEntryEnabled(enabled: boolean): void;
  1341. /**
  1342. * Creates an `NSUserActivity` and sets it as the current activity. The activity is
  1343. * eligible for Handoff to another device afterward.
  1344. *
  1345. * @platform darwin
  1346. */
  1347. setUserActivity(type: string, userInfo: any, webpageURL?: string): void;
  1348. /**
  1349. * Adds `tasks` to the Tasks category of the Jump List on Windows.
  1350. *
  1351. * `tasks` is an array of `Task` objects.
  1352. *
  1353. * Whether the call succeeded.
  1354. *
  1355. * **Note:** If you'd like to customize the Jump List even more use
  1356. * `app.setJumpList(categories)` instead.
  1357. *
  1358. * @platform win32
  1359. */
  1360. setUserTasks(tasks: Task[]): boolean;
  1361. /**
  1362. * Shows application windows after they were hidden. Does not automatically focus
  1363. * them.
  1364. *
  1365. * @platform darwin
  1366. */
  1367. show(): void;
  1368. /**
  1369. * Show the app's about panel options. These options can be overridden with
  1370. * `app.setAboutPanelOptions(options)`.
  1371. */
  1372. showAboutPanel(): void;
  1373. /**
  1374. * Show the platform's native emoji picker.
  1375. *
  1376. * @platform darwin,win32
  1377. */
  1378. showEmojiPanel(): void;
  1379. /**
  1380. * This function **must** be called once you have finished accessing the security
  1381. * scoped file. If you do not remember to stop accessing the bookmark, kernel
  1382. * resources will be leaked and your app will lose its ability to reach outside the
  1383. * sandbox completely, until your app is restarted.
  1384. *
  1385. * Start accessing a security scoped resource. With this method Electron
  1386. * applications that are packaged for the Mac App Store may reach outside their
  1387. * sandbox to access files chosen by the user. See Apple's documentation for a
  1388. * description of how this system works.
  1389. *
  1390. * @platform mas
  1391. */
  1392. startAccessingSecurityScopedResource(bookmarkData: string): Function;
  1393. /**
  1394. * Updates the current activity if its type matches `type`, merging the entries
  1395. * from `userInfo` into its current `userInfo` dictionary.
  1396. *
  1397. * @platform darwin
  1398. */
  1399. updateCurrentActivity(type: string, userInfo: any): void;
  1400. /**
  1401. * fulfilled when Electron is initialized. May be used as a convenient alternative
  1402. * to checking `app.isReady()` and subscribing to the `ready` event if the app is
  1403. * not ready yet.
  1404. */
  1405. whenReady(): Promise<void>;
  1406. /**
  1407. * A `Boolean` property that's `true` if Chrome's accessibility support is enabled,
  1408. * `false` otherwise. This property will be `true` if the use of assistive
  1409. * technologies, such as screen readers, has been detected. Setting this property
  1410. * to `true` manually enables Chrome's accessibility support, allowing developers
  1411. * to expose accessibility switch to users in application settings.
  1412. *
  1413. * See Chromium's accessibility docs for more details. Disabled by default.
  1414. *
  1415. * This API must be called after the `ready` event is emitted.
  1416. *
  1417. * **Note:** Rendering accessibility tree can significantly affect the performance
  1418. * of your app. It should not be enabled by default.
  1419. *
  1420. * @platform darwin,win32
  1421. */
  1422. accessibilitySupportEnabled: boolean;
  1423. /**
  1424. * A `Boolean` which when `true` disables the overrides that Electron has in place
  1425. * to ensure renderer processes are restarted on every navigation. The current
  1426. * default value for this property is `true`.
  1427. *
  1428. * The intention is for these overrides to become disabled by default and then at
  1429. * some point in the future this property will be removed. This property impacts
  1430. * which native modules you can use in the renderer process. For more information
  1431. * on the direction Electron is going with renderer process restarts and usage of
  1432. * native modules in the renderer process please check out this Tracking Issue.
  1433. */
  1434. allowRendererProcessReuse: boolean;
  1435. /**
  1436. * A `Menu | null` property that returns `Menu` if one has been set and `null`
  1437. * otherwise. Users can pass a Menu to set this property.
  1438. */
  1439. applicationMenu: (Menu) | (null);
  1440. /**
  1441. * An `Integer` property that returns the badge count for current app. Setting the
  1442. * count to `0` will hide the badge.
  1443. *
  1444. * On macOS, setting this with any nonzero integer shows on the dock icon. On
  1445. * Linux, this property only works for Unity launcher.
  1446. *
  1447. * **Note:** Unity launcher requires the existence of a `.desktop` file to work,
  1448. * for more information please read Desktop Environment Integration.
  1449. *
  1450. * **Note:** On macOS, you need to ensure that your application has the permission
  1451. * to display notifications for this property to take effect.
  1452. *
  1453. * @platform linux,darwin
  1454. */
  1455. badgeCount: number;
  1456. /**
  1457. * A `CommandLine` object that allows you to read and manipulate the command line
  1458. * arguments that Chromium uses.
  1459. *
  1460. */
  1461. readonly commandLine: CommandLine;
  1462. /**
  1463. * A `Dock` `| undefined` object that allows you to perform actions on your app
  1464. * icon in the user's dock on macOS.
  1465. *
  1466. * @platform darwin
  1467. */
  1468. readonly dock: Dock;
  1469. /**
  1470. * A `Boolean` property that returns `true` if the app is packaged, `false`
  1471. * otherwise. For many apps, this property can be used to distinguish development
  1472. * and production environments.
  1473. *
  1474. */
  1475. readonly isPackaged: boolean;
  1476. /**
  1477. * A `String` property that indicates the current application's name, which is the
  1478. * name in the application's `package.json` file.
  1479. *
  1480. * Usually the `name` field of `package.json` is a short lowercase name, according
  1481. * to the npm modules spec. You should usually also specify a `productName` field,
  1482. * which is your application's full capitalized name, and which will be preferred
  1483. * over `name` by Electron.
  1484. */
  1485. name: string;
  1486. /**
  1487. * A `Boolean` which when `true` indicates that the app is currently running under
  1488. * the Rosetta Translator Environment.
  1489. *
  1490. * You can use this property to prompt users to download the arm64 version of your
  1491. * application when they are running the x64 version under Rosetta incorrectly.
  1492. *
  1493. * @platform darwin
  1494. */
  1495. readonly runningUnderRosettaTranslation: boolean;
  1496. /**
  1497. * A `String` which is the user agent string Electron will use as a global
  1498. * fallback.
  1499. *
  1500. * This is the user agent that will be used when no user agent is set at the
  1501. * `webContents` or `session` level. It is useful for ensuring that your entire
  1502. * app has the same user agent. Set to a custom value as early as possible in your
  1503. * app's initialization to ensure that your overridden value is used.
  1504. */
  1505. userAgentFallback: string;
  1506. }
  1507. interface AutoUpdater extends NodeJS.EventEmitter {
  1508. // Docs: https://electronjs.org/docs/api/auto-updater
  1509. /**
  1510. * This event is emitted after a user calls `quitAndInstall()`.
  1511. *
  1512. * When this API is called, the `before-quit` event is not emitted before all
  1513. * windows are closed. As a result you should listen to this event if you wish to
  1514. * perform actions before the windows are closed while a process is quitting, as
  1515. * well as listening to `before-quit`.
  1516. */
  1517. on(event: 'before-quit-for-update', listener: Function): this;
  1518. once(event: 'before-quit-for-update', listener: Function): this;
  1519. addListener(event: 'before-quit-for-update', listener: Function): this;
  1520. removeListener(event: 'before-quit-for-update', listener: Function): this;
  1521. /**
  1522. * Emitted when checking if an update has started.
  1523. */
  1524. on(event: 'checking-for-update', listener: Function): this;
  1525. once(event: 'checking-for-update', listener: Function): this;
  1526. addListener(event: 'checking-for-update', listener: Function): this;
  1527. removeListener(event: 'checking-for-update', listener: Function): this;
  1528. /**
  1529. * Emitted when there is an error while updating.
  1530. */
  1531. on(event: 'error', listener: (error: Error) => void): this;
  1532. once(event: 'error', listener: (error: Error) => void): this;
  1533. addListener(event: 'error', listener: (error: Error) => void): this;
  1534. removeListener(event: 'error', listener: (error: Error) => void): this;
  1535. /**
  1536. * Emitted when there is an available update. The update is downloaded
  1537. * automatically.
  1538. */
  1539. on(event: 'update-available', listener: Function): this;
  1540. once(event: 'update-available', listener: Function): this;
  1541. addListener(event: 'update-available', listener: Function): this;
  1542. removeListener(event: 'update-available', listener: Function): this;
  1543. /**
  1544. * Emitted when an update has been downloaded.
  1545. *
  1546. * On Windows only `releaseName` is available.
  1547. *
  1548. * **Note:** It is not strictly necessary to handle this event. A successfully
  1549. * downloaded update will still be applied the next time the application starts.
  1550. */
  1551. on(event: 'update-downloaded', listener: (event: Event,
  1552. releaseNotes: string,
  1553. releaseName: string,
  1554. releaseDate: Date,
  1555. updateURL: string) => void): this;
  1556. once(event: 'update-downloaded', listener: (event: Event,
  1557. releaseNotes: string,
  1558. releaseName: string,
  1559. releaseDate: Date,
  1560. updateURL: string) => void): this;
  1561. addListener(event: 'update-downloaded', listener: (event: Event,
  1562. releaseNotes: string,
  1563. releaseName: string,
  1564. releaseDate: Date,
  1565. updateURL: string) => void): this;
  1566. removeListener(event: 'update-downloaded', listener: (event: Event,
  1567. releaseNotes: string,
  1568. releaseName: string,
  1569. releaseDate: Date,
  1570. updateURL: string) => void): this;
  1571. /**
  1572. * Emitted when there is no available update.
  1573. */
  1574. on(event: 'update-not-available', listener: Function): this;
  1575. once(event: 'update-not-available', listener: Function): this;
  1576. addListener(event: 'update-not-available', listener: Function): this;
  1577. removeListener(event: 'update-not-available', listener: Function): this;
  1578. /**
  1579. * Asks the server whether there is an update. You must call `setFeedURL` before
  1580. * using this API.
  1581. */
  1582. checkForUpdates(): void;
  1583. /**
  1584. * The current update feed URL.
  1585. */
  1586. getFeedURL(): string;
  1587. /**
  1588. * Restarts the app and installs the update after it has been downloaded. It should
  1589. * only be called after `update-downloaded` has been emitted.
  1590. *
  1591. * Under the hood calling `autoUpdater.quitAndInstall()` will close all application
  1592. * windows first, and automatically call `app.quit()` after all windows have been
  1593. * closed.
  1594. *
  1595. * **Note:** It is not strictly necessary to call this function to apply an update,
  1596. * as a successfully downloaded update will always be applied the next time the
  1597. * application starts.
  1598. */
  1599. quitAndInstall(): void;
  1600. /**
  1601. * Sets the `url` and initialize the auto updater.
  1602. */
  1603. setFeedURL(options: FeedURLOptions): void;
  1604. }
  1605. interface BluetoothDevice {
  1606. // Docs: https://electronjs.org/docs/api/structures/bluetooth-device
  1607. deviceId: string;
  1608. deviceName: string;
  1609. }
  1610. class BrowserView {
  1611. // Docs: https://electronjs.org/docs/api/browser-view
  1612. /**
  1613. * BrowserView
  1614. */
  1615. constructor(options?: BrowserViewConstructorOptions);
  1616. /**
  1617. * The `bounds` of this BrowserView instance as `Object`.
  1618. *
  1619. * @experimental
  1620. */
  1621. getBounds(): Rectangle;
  1622. setAutoResize(options: AutoResizeOptions): void;
  1623. setBackgroundColor(color: string): void;
  1624. /**
  1625. * Resizes and moves the view to the supplied bounds relative to the window.
  1626. *
  1627. * @experimental
  1628. */
  1629. setBounds(bounds: Rectangle): void;
  1630. webContents: WebContents;
  1631. }
  1632. class BrowserWindow extends NodeEventEmitter {
  1633. // Docs: https://electronjs.org/docs/api/browser-window
  1634. /**
  1635. * Emitted when the window is set or unset to show always on top of other windows.
  1636. */
  1637. on(event: 'always-on-top-changed', listener: (event: Event,
  1638. isAlwaysOnTop: boolean) => void): this;
  1639. once(event: 'always-on-top-changed', listener: (event: Event,
  1640. isAlwaysOnTop: boolean) => void): this;
  1641. addListener(event: 'always-on-top-changed', listener: (event: Event,
  1642. isAlwaysOnTop: boolean) => void): this;
  1643. removeListener(event: 'always-on-top-changed', listener: (event: Event,
  1644. isAlwaysOnTop: boolean) => void): this;
  1645. /**
  1646. * Emitted when an App Command is invoked. These are typically related to keyboard
  1647. * media keys or browser commands, as well as the "Back" button built into some
  1648. * mice on Windows.
  1649. *
  1650. * Commands are lowercased, underscores are replaced with hyphens, and the
  1651. * `APPCOMMAND_` prefix is stripped off. e.g. `APPCOMMAND_BROWSER_BACKWARD` is
  1652. * emitted as `browser-backward`.
  1653. *
  1654. * The following app commands are explicitly supported on Linux:
  1655. *
  1656. * `browser-backward`
  1657. * `browser-forward`
  1658. *
  1659. * @platform win32,linux
  1660. */
  1661. on(event: 'app-command', listener: (event: Event,
  1662. command: string) => void): this;
  1663. once(event: 'app-command', listener: (event: Event,
  1664. command: string) => void): this;
  1665. addListener(event: 'app-command', listener: (event: Event,
  1666. command: string) => void): this;
  1667. removeListener(event: 'app-command', listener: (event: Event,
  1668. command: string) => void): this;
  1669. /**
  1670. * Emitted when the window loses focus.
  1671. */
  1672. on(event: 'blur', listener: Function): this;
  1673. once(event: 'blur', listener: Function): this;
  1674. addListener(event: 'blur', listener: Function): this;
  1675. removeListener(event: 'blur', listener: Function): this;
  1676. /**
  1677. * Emitted when the window is going to be closed. It's emitted before the
  1678. * `beforeunload` and `unload` event of the DOM. Calling `event.preventDefault()`
  1679. * will cancel the close.
  1680. *
  1681. * Usually you would want to use the `beforeunload` handler to decide whether the
  1682. * window should be closed, which will also be called when the window is reloaded.
  1683. * In Electron, returning any value other than `undefined` would cancel the close.
  1684. * For example:
  1685. *
  1686. * _**Note**: There is a subtle difference between the behaviors of
  1687. * `window.onbeforeunload = handler` and `window.addEventListener('beforeunload',
  1688. * handler)`. It is recommended to always set the `event.returnValue` explicitly,
  1689. * instead of only returning a value, as the former works more consistently within
  1690. * Electron._
  1691. */
  1692. on(event: 'close', listener: (event: Event) => void): this;
  1693. once(event: 'close', listener: (event: Event) => void): this;
  1694. addListener(event: 'close', listener: (event: Event) => void): this;
  1695. removeListener(event: 'close', listener: (event: Event) => void): this;
  1696. /**
  1697. * Emitted when the window is closed. After you have received this event you should
  1698. * remove the reference to the window and avoid using it any more.
  1699. */
  1700. on(event: 'closed', listener: Function): this;
  1701. once(event: 'closed', listener: Function): this;
  1702. addListener(event: 'closed', listener: Function): this;
  1703. removeListener(event: 'closed', listener: Function): this;
  1704. /**
  1705. * Emitted when the window enters a full-screen state.
  1706. */
  1707. on(event: 'enter-full-screen', listener: Function): this;
  1708. once(event: 'enter-full-screen', listener: Function): this;
  1709. addListener(event: 'enter-full-screen', listener: Function): this;
  1710. removeListener(event: 'enter-full-screen', listener: Function): this;
  1711. /**
  1712. * Emitted when the window enters a full-screen state triggered by HTML API.
  1713. */
  1714. on(event: 'enter-html-full-screen', listener: Function): this;
  1715. once(event: 'enter-html-full-screen', listener: Function): this;
  1716. addListener(event: 'enter-html-full-screen', listener: Function): this;
  1717. removeListener(event: 'enter-html-full-screen', listener: Function): this;
  1718. /**
  1719. * Emitted when the window gains focus.
  1720. */
  1721. on(event: 'focus', listener: Function): this;
  1722. once(event: 'focus', listener: Function): this;
  1723. addListener(event: 'focus', listener: Function): this;
  1724. removeListener(event: 'focus', listener: Function): this;
  1725. /**
  1726. * Emitted when the window is hidden.
  1727. */
  1728. on(event: 'hide', listener: Function): this;
  1729. once(event: 'hide', listener: Function): this;
  1730. addListener(event: 'hide', listener: Function): this;
  1731. removeListener(event: 'hide', listener: Function): this;
  1732. /**
  1733. * Emitted when the window leaves a full-screen state.
  1734. */
  1735. on(event: 'leave-full-screen', listener: Function): this;
  1736. once(event: 'leave-full-screen', listener: Function): this;
  1737. addListener(event: 'leave-full-screen', listener: Function): this;
  1738. removeListener(event: 'leave-full-screen', listener: Function): this;
  1739. /**
  1740. * Emitted when the window leaves a full-screen state triggered by HTML API.
  1741. */
  1742. on(event: 'leave-html-full-screen', listener: Function): this;
  1743. once(event: 'leave-html-full-screen', listener: Function): this;
  1744. addListener(event: 'leave-html-full-screen', listener: Function): this;
  1745. removeListener(event: 'leave-html-full-screen', listener: Function): this;
  1746. /**
  1747. * Emitted when window is maximized.
  1748. */
  1749. on(event: 'maximize', listener: Function): this;
  1750. once(event: 'maximize', listener: Function): this;
  1751. addListener(event: 'maximize', listener: Function): this;
  1752. removeListener(event: 'maximize', listener: Function): this;
  1753. /**
  1754. * Emitted when the window is minimized.
  1755. */
  1756. on(event: 'minimize', listener: Function): this;
  1757. once(event: 'minimize', listener: Function): this;
  1758. addListener(event: 'minimize', listener: Function): this;
  1759. removeListener(event: 'minimize', listener: Function): this;
  1760. /**
  1761. * Emitted when the window is being moved to a new position.
  1762. */
  1763. on(event: 'move', listener: Function): this;
  1764. once(event: 'move', listener: Function): this;
  1765. addListener(event: 'move', listener: Function): this;
  1766. removeListener(event: 'move', listener: Function): this;
  1767. /**
  1768. * Emitted once when the window is moved to a new position.
  1769. *
  1770. __Note__: On macOS this event is an alias of `move`.
  1771. *
  1772. * @platform darwin,win32
  1773. */
  1774. on(event: 'moved', listener: Function): this;
  1775. once(event: 'moved', listener: Function): this;
  1776. addListener(event: 'moved', listener: Function): this;
  1777. removeListener(event: 'moved', listener: Function): this;
  1778. /**
  1779. * Emitted when the native new tab button is clicked.
  1780. *
  1781. * @platform darwin
  1782. */
  1783. on(event: 'new-window-for-tab', listener: Function): this;
  1784. once(event: 'new-window-for-tab', listener: Function): this;
  1785. addListener(event: 'new-window-for-tab', listener: Function): this;
  1786. removeListener(event: 'new-window-for-tab', listener: Function): this;
  1787. /**
  1788. * Emitted when the document changed its title, calling `event.preventDefault()`
  1789. * will prevent the native window's title from changing. `explicitSet` is false
  1790. * when title is synthesized from file URL.
  1791. */
  1792. on(event: 'page-title-updated', listener: (event: Event,
  1793. title: string,
  1794. explicitSet: boolean) => void): this;
  1795. once(event: 'page-title-updated', listener: (event: Event,
  1796. title: string,
  1797. explicitSet: boolean) => void): this;
  1798. addListener(event: 'page-title-updated', listener: (event: Event,
  1799. title: string,
  1800. explicitSet: boolean) => void): this;
  1801. removeListener(event: 'page-title-updated', listener: (event: Event,
  1802. title: string,
  1803. explicitSet: boolean) => void): this;
  1804. /**
  1805. * Emitted when the web page has been rendered (while not being shown) and window
  1806. * can be displayed without a visual flash.
  1807. *
  1808. * Please note that using this event implies that the renderer will be considered
  1809. * "visible" and paint even though `show` is false. This event will never fire if
  1810. * you use `paintWhenInitiallyHidden: false`
  1811. */
  1812. on(event: 'ready-to-show', listener: Function): this;
  1813. once(event: 'ready-to-show', listener: Function): this;
  1814. addListener(event: 'ready-to-show', listener: Function): this;
  1815. removeListener(event: 'ready-to-show', listener: Function): this;
  1816. /**
  1817. * Emitted after the window has been resized.
  1818. */
  1819. on(event: 'resize', listener: Function): this;
  1820. once(event: 'resize', listener: Function): this;
  1821. addListener(event: 'resize', listener: Function): this;
  1822. removeListener(event: 'resize', listener: Function): this;
  1823. /**
  1824. * Emitted once when the window has finished being resized.
  1825. *
  1826. * This is usually emitted when the window has been resized manually. On macOS,
  1827. * resizing the window with `setBounds`/`setSize` and setting the `animate`
  1828. * parameter to `true` will also emit this event once resizing has finished.
  1829. *
  1830. * @platform darwin,win32
  1831. */
  1832. on(event: 'resized', listener: Function): this;
  1833. once(event: 'resized', listener: Function): this;
  1834. addListener(event: 'resized', listener: Function): this;
  1835. removeListener(event: 'resized', listener: Function): this;
  1836. /**
  1837. * Emitted when the unresponsive web page becomes responsive again.
  1838. */
  1839. on(event: 'responsive', listener: Function): this;
  1840. once(event: 'responsive', listener: Function): this;
  1841. addListener(event: 'responsive', listener: Function): this;
  1842. removeListener(event: 'responsive', listener: Function): this;
  1843. /**
  1844. * Emitted when the window is restored from a minimized state.
  1845. */
  1846. on(event: 'restore', listener: Function): this;
  1847. once(event: 'restore', listener: Function): this;
  1848. addListener(event: 'restore', listener: Function): this;
  1849. removeListener(event: 'restore', listener: Function): this;
  1850. /**
  1851. * Emitted on trackpad rotation gesture. Continually emitted until rotation gesture
  1852. * is ended. The `rotation` value on each emission is the angle in degrees rotated
  1853. * since the last emission. The last emitted event upon a rotation gesture will
  1854. * always be of value `0`. Counter-clockwise rotation values are positive, while
  1855. * clockwise ones are negative.
  1856. *
  1857. * @platform darwin
  1858. */
  1859. on(event: 'rotate-gesture', listener: (event: Event,
  1860. rotation: number) => void): this;
  1861. once(event: 'rotate-gesture', listener: (event: Event,
  1862. rotation: number) => void): this;
  1863. addListener(event: 'rotate-gesture', listener: (event: Event,
  1864. rotation: number) => void): this;
  1865. removeListener(event: 'rotate-gesture', listener: (event: Event,
  1866. rotation: number) => void): this;
  1867. /**
  1868. * Emitted when scroll wheel event phase has begun.
  1869. *
  1870. * @platform darwin
  1871. */
  1872. on(event: 'scroll-touch-begin', listener: Function): this;
  1873. once(event: 'scroll-touch-begin', listener: Function): this;
  1874. addListener(event: 'scroll-touch-begin', listener: Function): this;
  1875. removeListener(event: 'scroll-touch-begin', listener: Function): this;
  1876. /**
  1877. * Emitted when scroll wheel event phase filed upon reaching the edge of element.
  1878. *
  1879. * @platform darwin
  1880. */
  1881. on(event: 'scroll-touch-edge', listener: Function): this;
  1882. once(event: 'scroll-touch-edge', listener: Function): this;
  1883. addListener(event: 'scroll-touch-edge', listener: Function): this;
  1884. removeListener(event: 'scroll-touch-edge', listener: Function): this;
  1885. /**
  1886. * Emitted when scroll wheel event phase has ended.
  1887. *
  1888. * @platform darwin
  1889. */
  1890. on(event: 'scroll-touch-end', listener: Function): this;
  1891. once(event: 'scroll-touch-end', listener: Function): this;
  1892. addListener(event: 'scroll-touch-end', listener: Function): this;
  1893. removeListener(event: 'scroll-touch-end', listener: Function): this;
  1894. /**
  1895. * Emitted when window session is going to end due to force shutdown or machine
  1896. * restart or session log off.
  1897. *
  1898. * @platform win32
  1899. */
  1900. on(event: 'session-end', listener: Function): this;
  1901. once(event: 'session-end', listener: Function): this;
  1902. addListener(event: 'session-end', listener: Function): this;
  1903. removeListener(event: 'session-end', listener: Function): this;
  1904. /**
  1905. * Emitted when the window opens a sheet.
  1906. *
  1907. * @platform darwin
  1908. */
  1909. on(event: 'sheet-begin', listener: Function): this;
  1910. once(event: 'sheet-begin', listener: Function): this;
  1911. addListener(event: 'sheet-begin', listener: Function): this;
  1912. removeListener(event: 'sheet-begin', listener: Function): this;
  1913. /**
  1914. * Emitted when the window has closed a sheet.
  1915. *
  1916. * @platform darwin
  1917. */
  1918. on(event: 'sheet-end', listener: Function): this;
  1919. once(event: 'sheet-end', listener: Function): this;
  1920. addListener(event: 'sheet-end', listener: Function): this;
  1921. removeListener(event: 'sheet-end', listener: Function): this;
  1922. /**
  1923. * Emitted when the window is shown.
  1924. */
  1925. on(event: 'show', listener: Function): this;
  1926. once(event: 'show', listener: Function): this;
  1927. addListener(event: 'show', listener: Function): this;
  1928. removeListener(event: 'show', listener: Function): this;
  1929. /**
  1930. * Emitted on 3-finger swipe. Possible directions are `up`, `right`, `down`,
  1931. * `left`.
  1932. *
  1933. * The method underlying this event is built to handle older macOS-style trackpad
  1934. * swiping, where the content on the screen doesn't move with the swipe. Most macOS
  1935. * trackpads are not configured to allow this kind of swiping anymore, so in order
  1936. * for it to emit properly the 'Swipe between pages' preference in `System
  1937. * Preferences > Trackpad > More Gestures` must be set to 'Swipe with two or three
  1938. * fingers'.
  1939. *
  1940. * @platform darwin
  1941. */
  1942. on(event: 'swipe', listener: (event: Event,
  1943. direction: string) => void): this;
  1944. once(event: 'swipe', listener: (event: Event,
  1945. direction: string) => void): this;
  1946. addListener(event: 'swipe', listener: (event: Event,
  1947. direction: string) => void): this;
  1948. removeListener(event: 'swipe', listener: (event: Event,
  1949. direction: string) => void): this;
  1950. /**
  1951. * Emitted when the system context menu is triggered on the window, this is
  1952. * normally only triggered when the user right clicks on the non-client area of
  1953. * your window. This is the window titlebar or any area you have declared as
  1954. * `-webkit-app-region: drag` in a frameless window.
  1955. *
  1956. Calling `event.preventDefault()` will prevent the menu from being displayed.
  1957. *
  1958. * @platform win32
  1959. */
  1960. on(event: 'system-context-menu', listener: (event: Event,
  1961. /**
  1962. * The screen coordinates the context menu was triggered at
  1963. */
  1964. point: Point) => void): this;
  1965. once(event: 'system-context-menu', listener: (event: Event,
  1966. /**
  1967. * The screen coordinates the context menu was triggered at
  1968. */
  1969. point: Point) => void): this;
  1970. addListener(event: 'system-context-menu', listener: (event: Event,
  1971. /**
  1972. * The screen coordinates the context menu was triggered at
  1973. */
  1974. point: Point) => void): this;
  1975. removeListener(event: 'system-context-menu', listener: (event: Event,
  1976. /**
  1977. * The screen coordinates the context menu was triggered at
  1978. */
  1979. point: Point) => void): this;
  1980. /**
  1981. * Emitted when the window exits from a maximized state.
  1982. */
  1983. on(event: 'unmaximize', listener: Function): this;
  1984. once(event: 'unmaximize', listener: Function): this;
  1985. addListener(event: 'unmaximize', listener: Function): this;
  1986. removeListener(event: 'unmaximize', listener: Function): this;
  1987. /**
  1988. * Emitted when the web page becomes unresponsive.
  1989. */
  1990. on(event: 'unresponsive', listener: Function): this;
  1991. once(event: 'unresponsive', listener: Function): this;
  1992. addListener(event: 'unresponsive', listener: Function): this;
  1993. removeListener(event: 'unresponsive', listener: Function): this;
  1994. /**
  1995. * Emitted before the window is moved. On Windows, calling `event.preventDefault()`
  1996. * will prevent the window from being moved.
  1997. *
  1998. * Note that this is only emitted when the window is being resized manually.
  1999. * Resizing the window with `setBounds`/`setSize` will not emit this event.
  2000. *
  2001. * @platform darwin,win32
  2002. */
  2003. on(event: 'will-move', listener: (event: Event,
  2004. /**
  2005. * Location the window is being moved to.
  2006. */
  2007. newBounds: Rectangle) => void): this;
  2008. once(event: 'will-move', listener: (event: Event,
  2009. /**
  2010. * Location the window is being moved to.
  2011. */
  2012. newBounds: Rectangle) => void): this;
  2013. addListener(event: 'will-move', listener: (event: Event,
  2014. /**
  2015. * Location the window is being moved to.
  2016. */
  2017. newBounds: Rectangle) => void): this;
  2018. removeListener(event: 'will-move', listener: (event: Event,
  2019. /**
  2020. * Location the window is being moved to.
  2021. */
  2022. newBounds: Rectangle) => void): this;
  2023. /**
  2024. * Emitted before the window is resized. Calling `event.preventDefault()` will
  2025. * prevent the window from being resized.
  2026. *
  2027. * Note that this is only emitted when the window is being resized manually.
  2028. * Resizing the window with `setBounds`/`setSize` will not emit this event.
  2029. *
  2030. * @platform darwin,win32
  2031. */
  2032. on(event: 'will-resize', listener: (event: Event,
  2033. /**
  2034. * Size the window is being resized to.
  2035. */
  2036. newBounds: Rectangle) => void): this;
  2037. once(event: 'will-resize', listener: (event: Event,
  2038. /**
  2039. * Size the window is being resized to.
  2040. */
  2041. newBounds: Rectangle) => void): this;
  2042. addListener(event: 'will-resize', listener: (event: Event,
  2043. /**
  2044. * Size the window is being resized to.
  2045. */
  2046. newBounds: Rectangle) => void): this;
  2047. removeListener(event: 'will-resize', listener: (event: Event,
  2048. /**
  2049. * Size the window is being resized to.
  2050. */
  2051. newBounds: Rectangle) => void): this;
  2052. /**
  2053. * BrowserWindow
  2054. */
  2055. constructor(options?: BrowserWindowConstructorOptions);
  2056. /**
  2057. * Adds DevTools extension located at `path`, and returns extension's name.
  2058. *
  2059. * The extension will be remembered so you only need to call this API once, this
  2060. * API is not for programming use. If you try to add an extension that has already
  2061. * been loaded, this method will not return and instead log a warning to the
  2062. * console.
  2063. *
  2064. * The method will also not return if the extension's manifest is missing or
  2065. * incomplete.
  2066. *
  2067. * **Note:** This API cannot be called before the `ready` event of the `app` module
  2068. * is emitted.
  2069. *
  2070. **Note:** This method is deprecated. Instead, use `ses.loadExtension(path)`.
  2071. *
  2072. * @deprecated
  2073. */
  2074. static addDevToolsExtension(path: string): void;
  2075. /**
  2076. * Adds Chrome extension located at `path`, and returns extension's name.
  2077. *
  2078. * The method will also not return if the extension's manifest is missing or
  2079. * incomplete.
  2080. *
  2081. * **Note:** This API cannot be called before the `ready` event of the `app` module
  2082. * is emitted.
  2083. *
  2084. **Note:** This method is deprecated. Instead, use `ses.loadExtension(path)`.
  2085. *
  2086. * @deprecated
  2087. */
  2088. static addExtension(path: string): void;
  2089. /**
  2090. * The window that owns the given `browserView`. If the given view is not attached
  2091. * to any window, returns `null`.
  2092. */
  2093. static fromBrowserView(browserView: BrowserView): (BrowserWindow) | (null);
  2094. /**
  2095. * The window with the given `id`.
  2096. */
  2097. static fromId(id: number): (BrowserWindow) | (null);
  2098. /**
  2099. * The window that owns the given `webContents` or `null` if the contents are not
  2100. * owned by a window.
  2101. */
  2102. static fromWebContents(webContents: WebContents): (BrowserWindow) | (null);
  2103. /**
  2104. * An array of all opened browser windows.
  2105. */
  2106. static getAllWindows(): BrowserWindow[];
  2107. /**
  2108. * The keys are the extension names and each value is an Object containing `name`
  2109. * and `version` properties.
  2110. *
  2111. * To check if a DevTools extension is installed you can run the following:
  2112. *
  2113. * **Note:** This API cannot be called before the `ready` event of the `app` module
  2114. * is emitted.
  2115. *
  2116. **Note:** This method is deprecated. Instead, use `ses.getAllExtensions()`.
  2117. *
  2118. * @deprecated
  2119. */
  2120. static getDevToolsExtensions(): Record<string, ExtensionInfo>;
  2121. /**
  2122. * The keys are the extension names and each value is an Object containing `name`
  2123. * and `version` properties.
  2124. *
  2125. * **Note:** This API cannot be called before the `ready` event of the `app` module
  2126. * is emitted.
  2127. *
  2128. **Note:** This method is deprecated. Instead, use `ses.getAllExtensions()`.
  2129. *
  2130. * @deprecated
  2131. */
  2132. static getExtensions(): Record<string, ExtensionInfo>;
  2133. /**
  2134. * The window that is focused in this application, otherwise returns `null`.
  2135. */
  2136. static getFocusedWindow(): (BrowserWindow) | (null);
  2137. /**
  2138. * Remove a DevTools extension by name.
  2139. *
  2140. * **Note:** This API cannot be called before the `ready` event of the `app` module
  2141. * is emitted.
  2142. *
  2143. * **Note:** This method is deprecated. Instead, use
  2144. * `ses.removeExtension(extension_id)`.
  2145. *
  2146. * @deprecated
  2147. */
  2148. static removeDevToolsExtension(name: string): void;
  2149. /**
  2150. * Remove a Chrome extension by name.
  2151. *
  2152. * **Note:** This API cannot be called before the `ready` event of the `app` module
  2153. * is emitted.
  2154. *
  2155. * **Note:** This method is deprecated. Instead, use
  2156. * `ses.removeExtension(extension_id)`.
  2157. *
  2158. * @deprecated
  2159. */
  2160. static removeExtension(name: string): void;
  2161. /**
  2162. * Replacement API for setBrowserView supporting work with multi browser views.
  2163. *
  2164. * @experimental
  2165. */
  2166. addBrowserView(browserView: BrowserView): void;
  2167. /**
  2168. * Adds a window as a tab on this window, after the tab for the window instance.
  2169. *
  2170. * @platform darwin
  2171. */
  2172. addTabbedWindow(browserWindow: BrowserWindow): void;
  2173. /**
  2174. * Removes focus from the window.
  2175. */
  2176. blur(): void;
  2177. blurWebView(): void;
  2178. /**
  2179. * Resolves with a NativeImage
  2180. *
  2181. * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
  2182. * whole visible page.
  2183. */
  2184. capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
  2185. /**
  2186. * Moves window to the center of the screen.
  2187. */
  2188. center(): void;
  2189. /**
  2190. * Try to close the window. This has the same effect as a user manually clicking
  2191. * the close button of the window. The web page may cancel the close though. See
  2192. * the close event.
  2193. */
  2194. close(): void;
  2195. /**
  2196. * Closes the currently open Quick Look panel.
  2197. *
  2198. * @platform darwin
  2199. */
  2200. closeFilePreview(): void;
  2201. /**
  2202. * Force closing the window, the `unload` and `beforeunload` event won't be emitted
  2203. * for the web page, and `close` event will also not be emitted for this window,
  2204. * but it guarantees the `closed` event will be emitted.
  2205. */
  2206. destroy(): void;
  2207. /**
  2208. * Starts or stops flashing the window to attract user's attention.
  2209. */
  2210. flashFrame(flag: boolean): void;
  2211. /**
  2212. * Focuses on the window.
  2213. */
  2214. focus(): void;
  2215. focusOnWebView(): void;
  2216. /**
  2217. * Gets the background color of the window. See Setting `backgroundColor`.
  2218. */
  2219. getBackgroundColor(): string;
  2220. /**
  2221. * The `bounds` of the window as `Object`.
  2222. */
  2223. getBounds(): Rectangle;
  2224. /**
  2225. * The `BrowserView` attached to `win`. Returns `null` if one is not attached.
  2226. * Throws an error if multiple `BrowserView`s are attached.
  2227. *
  2228. * @experimental
  2229. */
  2230. getBrowserView(): (BrowserView) | (null);
  2231. /**
  2232. * an array of all BrowserViews that have been attached with `addBrowserView` or
  2233. * `setBrowserView`.
  2234. *
  2235. * **Note:** The BrowserView API is currently experimental and may change or be
  2236. * removed in future Electron releases.
  2237. *
  2238. * @experimental
  2239. */
  2240. getBrowserViews(): BrowserView[];
  2241. /**
  2242. * All child windows.
  2243. */
  2244. getChildWindows(): BrowserWindow[];
  2245. /**
  2246. * The `bounds` of the window's client area as `Object`.
  2247. */
  2248. getContentBounds(): Rectangle;
  2249. /**
  2250. * Contains the window's client area's width and height.
  2251. */
  2252. getContentSize(): number[];
  2253. /**
  2254. * Contains the window's maximum width and height.
  2255. */
  2256. getMaximumSize(): number[];
  2257. /**
  2258. * Window id in the format of DesktopCapturerSource's id. For example
  2259. * "window:1234:0".
  2260. *
  2261. * More precisely the format is `window:id:other_id` where `id` is `HWND` on
  2262. * Windows, `CGWindowID` (`uint64_t`) on macOS and `Window` (`unsigned long`) on
  2263. * Linux. `other_id` is used to identify web contents (tabs) so within the same top
  2264. * level window.
  2265. */
  2266. getMediaSourceId(): string;
  2267. /**
  2268. * Contains the window's minimum width and height.
  2269. */
  2270. getMinimumSize(): number[];
  2271. /**
  2272. * The platform-specific handle of the window.
  2273. *
  2274. * The native type of the handle is `HWND` on Windows, `NSView*` on macOS, and
  2275. * `Window` (`unsigned long`) on Linux.
  2276. */
  2277. getNativeWindowHandle(): Buffer;
  2278. /**
  2279. * Contains the window bounds of the normal state
  2280. *
  2281. * **Note:** whatever the current state of the window : maximized, minimized or in
  2282. * fullscreen, this function always returns the position and size of the window in
  2283. * normal state. In normal state, getBounds and getNormalBounds returns the same
  2284. * `Rectangle`.
  2285. */
  2286. getNormalBounds(): Rectangle;
  2287. /**
  2288. * between 0.0 (fully transparent) and 1.0 (fully opaque). On Linux, always returns
  2289. * 1.
  2290. */
  2291. getOpacity(): number;
  2292. /**
  2293. * The parent window.
  2294. */
  2295. getParentWindow(): BrowserWindow;
  2296. /**
  2297. * Contains the window's current position.
  2298. */
  2299. getPosition(): number[];
  2300. /**
  2301. * The pathname of the file the window represents.
  2302. *
  2303. * @platform darwin
  2304. */
  2305. getRepresentedFilename(): string;
  2306. /**
  2307. * Contains the window's width and height.
  2308. */
  2309. getSize(): number[];
  2310. /**
  2311. * The title of the native window.
  2312. *
  2313. * **Note:** The title of the web page can be different from the title of the
  2314. * native window.
  2315. */
  2316. getTitle(): string;
  2317. /**
  2318. * The current position for the traffic light buttons. Can only be used with
  2319. * `titleBarStyle` set to `hidden`.
  2320. *
  2321. * @platform darwin
  2322. */
  2323. getTrafficLightPosition(): Point;
  2324. /**
  2325. * Whether the window has a shadow.
  2326. */
  2327. hasShadow(): boolean;
  2328. /**
  2329. * Hides the window.
  2330. */
  2331. hide(): void;
  2332. /**
  2333. * Hooks a windows message. The `callback` is called when the message is received
  2334. * in the WndProc.
  2335. *
  2336. * @platform win32
  2337. */
  2338. hookWindowMessage(message: number, callback: () => void): void;
  2339. /**
  2340. * Whether the window is always on top of other windows.
  2341. */
  2342. isAlwaysOnTop(): boolean;
  2343. /**
  2344. * Whether the window can be manually closed by user.
  2345. *
  2346. On Linux always returns `true`.
  2347. *
  2348. * @platform darwin,win32
  2349. */
  2350. isClosable(): boolean;
  2351. /**
  2352. * Whether the window is destroyed.
  2353. */
  2354. isDestroyed(): boolean;
  2355. /**
  2356. * Whether the window's document has been edited.
  2357. *
  2358. * @platform darwin
  2359. */
  2360. isDocumentEdited(): boolean;
  2361. /**
  2362. * whether the window is enabled.
  2363. */
  2364. isEnabled(): boolean;
  2365. /**
  2366. * Whether the window is focused.
  2367. */
  2368. isFocused(): boolean;
  2369. /**
  2370. * Whether the window is in fullscreen mode.
  2371. */
  2372. isFullScreen(): boolean;
  2373. /**
  2374. * Whether the maximize/zoom window button toggles fullscreen mode or maximizes the
  2375. * window.
  2376. */
  2377. isFullScreenable(): boolean;
  2378. /**
  2379. * Whether the window is in kiosk mode.
  2380. */
  2381. isKiosk(): boolean;
  2382. /**
  2383. * Whether the window can be manually maximized by user.
  2384. *
  2385. On Linux always returns `true`.
  2386. *
  2387. * @platform darwin,win32
  2388. */
  2389. isMaximizable(): boolean;
  2390. /**
  2391. * Whether the window is maximized.
  2392. */
  2393. isMaximized(): boolean;
  2394. /**
  2395. * Whether menu bar automatically hides itself.
  2396. */
  2397. isMenuBarAutoHide(): boolean;
  2398. /**
  2399. * Whether the menu bar is visible.
  2400. */
  2401. isMenuBarVisible(): boolean;
  2402. /**
  2403. * Whether the window can be manually minimized by the user.
  2404. *
  2405. On Linux always returns `true`.
  2406. *
  2407. * @platform darwin,win32
  2408. */
  2409. isMinimizable(): boolean;
  2410. /**
  2411. * Whether the window is minimized.
  2412. */
  2413. isMinimized(): boolean;
  2414. /**
  2415. * Whether current window is a modal window.
  2416. */
  2417. isModal(): boolean;
  2418. /**
  2419. * Whether the window can be moved by user.
  2420. On Linux always returns `true`.
  2421. *
  2422. * @platform darwin,win32
  2423. */
  2424. isMovable(): boolean;
  2425. /**
  2426. * Whether the window is in normal state (not maximized, not minimized, not in
  2427. * fullscreen mode).
  2428. */
  2429. isNormal(): boolean;
  2430. /**
  2431. * Whether the window can be manually resized by the user.
  2432. */
  2433. isResizable(): boolean;
  2434. /**
  2435. * Whether the window is in simple (pre-Lion) fullscreen mode.
  2436. *
  2437. * @platform darwin
  2438. */
  2439. isSimpleFullScreen(): boolean;
  2440. /**
  2441. * Whether the window is visible to the user.
  2442. */
  2443. isVisible(): boolean;
  2444. /**
  2445. * Whether the window is visible on all workspaces.
  2446. *
  2447. **Note:** This API always returns false on Windows.
  2448. */
  2449. isVisibleOnAllWorkspaces(): boolean;
  2450. /**
  2451. * `true` or `false` depending on whether the message is hooked.
  2452. *
  2453. * @platform win32
  2454. */
  2455. isWindowMessageHooked(message: number): boolean;
  2456. /**
  2457. * the promise will resolve when the page has finished loading (see
  2458. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  2459. *
  2460. * Same as `webContents.loadFile`, `filePath` should be a path to an HTML file
  2461. * relative to the root of your application. See the `webContents` docs for more
  2462. * information.
  2463. */
  2464. loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
  2465. /**
  2466. * the promise will resolve when the page has finished loading (see
  2467. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  2468. *
  2469. * Same as `webContents.loadURL(url[, options])`.
  2470. *
  2471. * The `url` can be a remote address (e.g. `http://`) or a path to a local HTML
  2472. * file using the `file://` protocol.
  2473. *
  2474. * To ensure that file URLs are properly formatted, it is recommended to use Node's
  2475. * `url.format` method:
  2476. *
  2477. * You can load a URL using a `POST` request with URL-encoded data by doing the
  2478. * following:
  2479. */
  2480. loadURL(url: string, options?: LoadURLOptions): Promise<void>;
  2481. /**
  2482. * Maximizes the window. This will also show (but not focus) the window if it isn't
  2483. * being displayed already.
  2484. */
  2485. maximize(): void;
  2486. /**
  2487. * Merges all windows into one window with multiple tabs when native tabs are
  2488. * enabled and there is more than one open window.
  2489. *
  2490. * @platform darwin
  2491. */
  2492. mergeAllWindows(): void;
  2493. /**
  2494. * Minimizes the window. On some platforms the minimized window will be shown in
  2495. * the Dock.
  2496. */
  2497. minimize(): void;
  2498. /**
  2499. * Moves window above the source window in the sense of z-order. If the
  2500. * `mediaSourceId` is not of type window or if the window does not exist then this
  2501. * method throws an error.
  2502. */
  2503. moveAbove(mediaSourceId: string): void;
  2504. /**
  2505. * Moves the current tab into a new window if native tabs are enabled and there is
  2506. * more than one tab in the current window.
  2507. *
  2508. * @platform darwin
  2509. */
  2510. moveTabToNewWindow(): void;
  2511. /**
  2512. * Moves window to top(z-order) regardless of focus
  2513. */
  2514. moveTop(): void;
  2515. /**
  2516. * Uses Quick Look to preview a file at a given path.
  2517. *
  2518. * @platform darwin
  2519. */
  2520. previewFile(path: string, displayName?: string): void;
  2521. /**
  2522. * Same as `webContents.reload`.
  2523. */
  2524. reload(): void;
  2525. removeBrowserView(browserView: BrowserView): void;
  2526. /**
  2527. * Remove the window's menu bar.
  2528. *
  2529. * @platform linux,win32
  2530. */
  2531. removeMenu(): void;
  2532. /**
  2533. * Restores the window from minimized state to its previous state.
  2534. */
  2535. restore(): void;
  2536. /**
  2537. * Selects the next tab when native tabs are enabled and there are other tabs in
  2538. * the window.
  2539. *
  2540. * @platform darwin
  2541. */
  2542. selectNextTab(): void;
  2543. /**
  2544. * Selects the previous tab when native tabs are enabled and there are other tabs
  2545. * in the window.
  2546. *
  2547. * @platform darwin
  2548. */
  2549. selectPreviousTab(): void;
  2550. /**
  2551. * Sets whether the window should show always on top of other windows. After
  2552. * setting this, the window is still a normal window, not a toolbox window which
  2553. * can not be focused on.
  2554. */
  2555. setAlwaysOnTop(flag: boolean, level?: 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver', relativeLevel?: number): void;
  2556. /**
  2557. * Sets the properties for the window's taskbar button.
  2558. *
  2559. * **Note:** `relaunchCommand` and `relaunchDisplayName` must always be set
  2560. * together. If one of those properties is not set, then neither will be used.
  2561. *
  2562. * @platform win32
  2563. */
  2564. setAppDetails(options: AppDetailsOptions): void;
  2565. /**
  2566. * This will make a window maintain an aspect ratio. The extra size allows a
  2567. * developer to have space, specified in pixels, not included within the aspect
  2568. * ratio calculations. This API already takes into account the difference between a
  2569. * window's size and its content size.
  2570. *
  2571. * Consider a normal window with an HD video player and associated controls.
  2572. * Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls
  2573. * on the right edge and 50 pixels of controls below the player. In order to
  2574. * maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within
  2575. * the player itself we would call this function with arguments of 16/9 and {
  2576. * width: 40, height: 50 }. The second argument doesn't care where the extra width
  2577. * and height are within the content view--only that they exist. Sum any extra
  2578. * width and height areas you have within the overall content view.
  2579. *
  2580. * @platform darwin,linux
  2581. */
  2582. setAspectRatio(aspectRatio: number, extraSize?: Size): void;
  2583. /**
  2584. * Controls whether to hide cursor when typing.
  2585. *
  2586. * @platform darwin
  2587. */
  2588. setAutoHideCursor(autoHide: boolean): void;
  2589. /**
  2590. * Sets whether the window menu bar should hide itself automatically. Once set the
  2591. * menu bar will only show when users press the single `Alt` key.
  2592. *
  2593. * If the menu bar is already visible, calling `setAutoHideMenuBar(true)` won't
  2594. * hide it immediately.
  2595. */
  2596. setAutoHideMenuBar(hide: boolean): void;
  2597. /**
  2598. * Sets the background color of the window. See Setting `backgroundColor`.
  2599. */
  2600. setBackgroundColor(backgroundColor: string): void;
  2601. /**
  2602. * Resizes and moves the window to the supplied bounds. Any properties that are not
  2603. * supplied will default to their current values.
  2604. */
  2605. setBounds(bounds: Partial<Rectangle>, animate?: boolean): void;
  2606. setBrowserView(browserView: (BrowserView) | (null)): void;
  2607. /**
  2608. * Sets whether the window can be manually closed by user. On Linux does nothing.
  2609. *
  2610. * @platform darwin,win32
  2611. */
  2612. setClosable(closable: boolean): void;
  2613. /**
  2614. * Resizes and moves the window's client area (e.g. the web page) to the supplied
  2615. * bounds.
  2616. */
  2617. setContentBounds(bounds: Rectangle, animate?: boolean): void;
  2618. /**
  2619. * Prevents the window contents from being captured by other apps.
  2620. *
  2621. * On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows
  2622. * it calls SetWindowDisplayAffinity with `WDA_MONITOR`.
  2623. *
  2624. * @platform darwin,win32
  2625. */
  2626. setContentProtection(enable: boolean): void;
  2627. /**
  2628. * Resizes the window's client area (e.g. the web page) to `width` and `height`.
  2629. */
  2630. setContentSize(width: number, height: number, animate?: boolean): void;
  2631. /**
  2632. * Specifies whether the window’s document has been edited, and the icon in title
  2633. * bar will become gray when set to `true`.
  2634. *
  2635. * @platform darwin
  2636. */
  2637. setDocumentEdited(edited: boolean): void;
  2638. /**
  2639. * Disable or enable the window.
  2640. */
  2641. setEnabled(enable: boolean): void;
  2642. /**
  2643. * Changes whether the window can be focused.
  2644. *
  2645. On macOS it does not remove the focus from the window.
  2646. *
  2647. * @platform darwin,win32
  2648. */
  2649. setFocusable(focusable: boolean): void;
  2650. /**
  2651. * Sets whether the window should be in fullscreen mode.
  2652. */
  2653. setFullScreen(flag: boolean): void;
  2654. /**
  2655. * Sets whether the maximize/zoom window button toggles fullscreen mode or
  2656. * maximizes the window.
  2657. */
  2658. setFullScreenable(fullscreenable: boolean): void;
  2659. /**
  2660. * Sets whether the window should have a shadow.
  2661. */
  2662. setHasShadow(hasShadow: boolean): void;
  2663. /**
  2664. * Changes window icon.
  2665. *
  2666. * @platform win32,linux
  2667. */
  2668. setIcon(icon: (NativeImage) | (string)): void;
  2669. /**
  2670. * Makes the window ignore all mouse events.
  2671. *
  2672. * All mouse events happened in this window will be passed to the window below this
  2673. * window, but if this window has focus, it will still receive keyboard events.
  2674. */
  2675. setIgnoreMouseEvents(ignore: boolean, options?: IgnoreMouseEventsOptions): void;
  2676. /**
  2677. * Enters or leaves kiosk mode.
  2678. */
  2679. setKiosk(flag: boolean): void;
  2680. /**
  2681. * Sets whether the window can be manually maximized by user. On Linux does
  2682. * nothing.
  2683. *
  2684. * @platform darwin,win32
  2685. */
  2686. setMaximizable(maximizable: boolean): void;
  2687. /**
  2688. * Sets the maximum size of window to `width` and `height`.
  2689. */
  2690. setMaximumSize(width: number, height: number): void;
  2691. /**
  2692. * Sets the `menu` as the window's menu bar.
  2693. *
  2694. * @platform linux,win32
  2695. */
  2696. setMenu(menu: (Menu) | (null)): void;
  2697. /**
  2698. * Sets whether the menu bar should be visible. If the menu bar is auto-hide, users
  2699. * can still bring up the menu bar by pressing the single `Alt` key.
  2700. *
  2701. * @platform win32,linux
  2702. */
  2703. setMenuBarVisibility(visible: boolean): void;
  2704. /**
  2705. * Sets whether the window can be manually minimized by user. On Linux does
  2706. * nothing.
  2707. *
  2708. * @platform darwin,win32
  2709. */
  2710. setMinimizable(minimizable: boolean): void;
  2711. /**
  2712. * Sets the minimum size of window to `width` and `height`.
  2713. */
  2714. setMinimumSize(width: number, height: number): void;
  2715. /**
  2716. * Sets whether the window can be moved by user. On Linux does nothing.
  2717. *
  2718. * @platform darwin,win32
  2719. */
  2720. setMovable(movable: boolean): void;
  2721. /**
  2722. * Sets the opacity of the window. On Linux, does nothing. Out of bound number
  2723. * values are clamped to the [0, 1] range.
  2724. *
  2725. * @platform win32,darwin
  2726. */
  2727. setOpacity(opacity: number): void;
  2728. /**
  2729. * Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to
  2730. * convey some sort of application status or to passively notify the user.
  2731. *
  2732. * @platform win32
  2733. */
  2734. setOverlayIcon(overlay: (NativeImage) | (null), description: string): void;
  2735. /**
  2736. * Sets `parent` as current window's parent window, passing `null` will turn
  2737. * current window into a top-level window.
  2738. */
  2739. setParentWindow(parent: (BrowserWindow) | (null)): void;
  2740. /**
  2741. * Moves window to `x` and `y`.
  2742. */
  2743. setPosition(x: number, y: number, animate?: boolean): void;
  2744. /**
  2745. * Sets progress value in progress bar. Valid range is [0, 1.0].
  2746. *
  2747. * Remove progress bar when progress < 0; Change to indeterminate mode when
  2748. * progress > 1.
  2749. *
  2750. * On Linux platform, only supports Unity desktop environment, you need to specify
  2751. * the `*.desktop` file name to `desktopName` field in `package.json`. By default,
  2752. * it will assume `{app.name}.desktop`.
  2753. *
  2754. * On Windows, a mode can be passed. Accepted values are `none`, `normal`,
  2755. * `indeterminate`, `error`, and `paused`. If you call `setProgressBar` without a
  2756. * mode set (but with a value within the valid range), `normal` will be assumed.
  2757. */
  2758. setProgressBar(progress: number, options?: ProgressBarOptions): void;
  2759. /**
  2760. * Sets the pathname of the file the window represents, and the icon of the file
  2761. * will show in window's title bar.
  2762. *
  2763. * @platform darwin
  2764. */
  2765. setRepresentedFilename(filename: string): void;
  2766. /**
  2767. * Sets whether the window can be manually resized by the user.
  2768. */
  2769. setResizable(resizable: boolean): void;
  2770. /**
  2771. * Setting a window shape determines the area within the window where the system
  2772. * permits drawing and user interaction. Outside of the given region, no pixels
  2773. * will be drawn and no mouse events will be registered. Mouse events outside of
  2774. * the region will not be received by that window, but will fall through to
  2775. * whatever is behind the window.
  2776. *
  2777. * @experimental
  2778. * @platform win32,linux
  2779. */
  2780. setShape(rects: Rectangle[]): void;
  2781. /**
  2782. * Changes the attachment point for sheets on macOS. By default, sheets are
  2783. * attached just below the window frame, but you may want to display them beneath a
  2784. * HTML-rendered toolbar. For example:
  2785. *
  2786. * @platform darwin
  2787. */
  2788. setSheetOffset(offsetY: number, offsetX?: number): void;
  2789. /**
  2790. * Enters or leaves simple fullscreen mode.
  2791. *
  2792. * Simple fullscreen mode emulates the native fullscreen behavior found in versions
  2793. * of macOS prior to Lion (10.7).
  2794. *
  2795. * @platform darwin
  2796. */
  2797. setSimpleFullScreen(flag: boolean): void;
  2798. /**
  2799. * Resizes the window to `width` and `height`. If `width` or `height` are below any
  2800. * set minimum size constraints the window will snap to its minimum size.
  2801. */
  2802. setSize(width: number, height: number, animate?: boolean): void;
  2803. /**
  2804. * Makes the window not show in the taskbar.
  2805. */
  2806. setSkipTaskbar(skip: boolean): void;
  2807. /**
  2808. * Whether the buttons were added successfully
  2809. *
  2810. * Add a thumbnail toolbar with a specified set of buttons to the thumbnail image
  2811. * of a window in a taskbar button layout. Returns a `Boolean` object indicates
  2812. * whether the thumbnail has been added successfully.
  2813. *
  2814. * The number of buttons in thumbnail toolbar should be no greater than 7 due to
  2815. * the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be
  2816. * removed due to the platform's limitation. But you can call the API with an empty
  2817. * array to clean the buttons.
  2818. *
  2819. * The `buttons` is an array of `Button` objects:
  2820. *
  2821. * * `Button` Object
  2822. * * `icon` NativeImage - The icon showing in thumbnail toolbar.
  2823. * * `click` Function
  2824. * * `tooltip` String (optional) - The text of the button's tooltip.
  2825. * * `flags` String[] (optional) - Control specific states and behaviors of the
  2826. * button. By default, it is `['enabled']`.
  2827. *
  2828. * The `flags` is an array that can include following `String`s:
  2829. *
  2830. * * `enabled` - The button is active and available to the user.
  2831. * * `disabled` - The button is disabled. It is present, but has a visual state
  2832. * indicating it will not respond to user action.
  2833. * * `dismissonclick` - When the button is clicked, the thumbnail window closes
  2834. * immediately.
  2835. * * `nobackground` - Do not draw a button border, use only the image.
  2836. * * `hidden` - The button is not shown to the user.
  2837. * * `noninteractive` - The button is enabled but not interactive; no pressed
  2838. * button state is drawn. This value is intended for instances where the button is
  2839. * used in a notification.
  2840. *
  2841. * @platform win32
  2842. */
  2843. setThumbarButtons(buttons: ThumbarButton[]): boolean;
  2844. /**
  2845. * Sets the region of the window to show as the thumbnail image displayed when
  2846. * hovering over the window in the taskbar. You can reset the thumbnail to be the
  2847. * entire window by specifying an empty region: `{ x: 0, y: 0, width: 0, height: 0
  2848. * }`.
  2849. *
  2850. * @platform win32
  2851. */
  2852. setThumbnailClip(region: Rectangle): void;
  2853. /**
  2854. * Sets the toolTip that is displayed when hovering over the window thumbnail in
  2855. * the taskbar.
  2856. *
  2857. * @platform win32
  2858. */
  2859. setThumbnailToolTip(toolTip: string): void;
  2860. /**
  2861. * Changes the title of native window to `title`.
  2862. */
  2863. setTitle(title: string): void;
  2864. /**
  2865. * Sets the touchBar layout for the current window. Specifying `null` or
  2866. * `undefined` clears the touch bar. This method only has an effect if the machine
  2867. * has a touch bar and is running on macOS 10.12.1+.
  2868. *
  2869. * **Note:** The TouchBar API is currently experimental and may change or be
  2870. * removed in future Electron releases.
  2871. *
  2872. * @platform darwin
  2873. */
  2874. setTouchBar(touchBar: (TouchBar) | (null)): void;
  2875. /**
  2876. * Set a custom position for the traffic light buttons. Can only be used with
  2877. * `titleBarStyle` set to `hidden`.
  2878. *
  2879. * @platform darwin
  2880. */
  2881. setTrafficLightPosition(position: Point): void;
  2882. /**
  2883. * Adds a vibrancy effect to the browser window. Passing `null` or an empty string
  2884. * will remove the vibrancy effect on the window.
  2885. *
  2886. * Note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark`
  2887. * have been deprecated and will be removed in an upcoming version of macOS.
  2888. *
  2889. * @platform darwin
  2890. */
  2891. 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;
  2892. /**
  2893. * Sets whether the window should be visible on all workspaces.
  2894. *
  2895. **Note:** This API does nothing on Windows.
  2896. */
  2897. setVisibleOnAllWorkspaces(visible: boolean, options?: VisibleOnAllWorkspacesOptions): void;
  2898. /**
  2899. * Sets whether the window traffic light buttons should be visible.
  2900. *
  2901. This cannot be called when `titleBarStyle` is set to `customButtonsOnHover`.
  2902. *
  2903. * @platform darwin
  2904. */
  2905. setWindowButtonVisibility(visible: boolean): void;
  2906. /**
  2907. * Shows and gives focus to the window.
  2908. */
  2909. show(): void;
  2910. /**
  2911. * Same as `webContents.showDefinitionForSelection()`.
  2912. *
  2913. * @platform darwin
  2914. */
  2915. showDefinitionForSelection(): void;
  2916. /**
  2917. * Shows the window but doesn't focus on it.
  2918. */
  2919. showInactive(): void;
  2920. /**
  2921. * Toggles the visibility of the tab bar if native tabs are enabled and there is
  2922. * only one tab in the current window.
  2923. *
  2924. * @platform darwin
  2925. */
  2926. toggleTabBar(): void;
  2927. /**
  2928. * Unhooks all of the window messages.
  2929. *
  2930. * @platform win32
  2931. */
  2932. unhookAllWindowMessages(): void;
  2933. /**
  2934. * Unhook the window message.
  2935. *
  2936. * @platform win32
  2937. */
  2938. unhookWindowMessage(message: number): void;
  2939. /**
  2940. * Unmaximizes the window.
  2941. */
  2942. unmaximize(): void;
  2943. accessibleTitle: string;
  2944. autoHideMenuBar: boolean;
  2945. closable: boolean;
  2946. documentEdited: boolean;
  2947. excludedFromShownWindowsMenu: boolean;
  2948. fullScreen: boolean;
  2949. fullScreenable: boolean;
  2950. readonly id: number;
  2951. kiosk: boolean;
  2952. maximizable: boolean;
  2953. menuBarVisible: boolean;
  2954. minimizable: boolean;
  2955. movable: boolean;
  2956. representedFilename: string;
  2957. resizable: boolean;
  2958. shadow: boolean;
  2959. simpleFullScreen: boolean;
  2960. title: string;
  2961. visibleOnAllWorkspaces: boolean;
  2962. readonly webContents: WebContents;
  2963. }
  2964. class BrowserWindowProxy {
  2965. // Docs: https://electronjs.org/docs/api/browser-window-proxy
  2966. /**
  2967. * Removes focus from the child window.
  2968. */
  2969. blur(): void;
  2970. /**
  2971. * Forcefully closes the child window without calling its unload event.
  2972. */
  2973. close(): void;
  2974. /**
  2975. * Evaluates the code in the child window.
  2976. */
  2977. eval(code: string): void;
  2978. /**
  2979. * Focuses the child window (brings the window to front).
  2980. */
  2981. focus(): void;
  2982. /**
  2983. * Sends a message to the child window with the specified origin or `*` for no
  2984. * origin preference.
  2985. *
  2986. * In addition to these methods, the child window implements `window.opener` object
  2987. * with no properties and a single method.
  2988. */
  2989. postMessage(message: any, targetOrigin: string): void;
  2990. /**
  2991. * Invokes the print dialog on the child window.
  2992. */
  2993. print(): void;
  2994. closed: boolean;
  2995. }
  2996. interface Certificate {
  2997. // Docs: https://electronjs.org/docs/api/structures/certificate
  2998. /**
  2999. * PEM encoded data
  3000. */
  3001. data: string;
  3002. /**
  3003. * Fingerprint of the certificate
  3004. */
  3005. fingerprint: string;
  3006. /**
  3007. * Issuer principal
  3008. */
  3009. issuer: CertificatePrincipal;
  3010. /**
  3011. * Issuer certificate (if not self-signed)
  3012. */
  3013. issuerCert: Certificate;
  3014. /**
  3015. * Issuer's Common Name
  3016. */
  3017. issuerName: string;
  3018. /**
  3019. * Hex value represented string
  3020. */
  3021. serialNumber: string;
  3022. /**
  3023. * Subject principal
  3024. */
  3025. subject: CertificatePrincipal;
  3026. /**
  3027. * Subject's Common Name
  3028. */
  3029. subjectName: string;
  3030. /**
  3031. * End date of the certificate being valid in seconds
  3032. */
  3033. validExpiry: number;
  3034. /**
  3035. * Start date of the certificate being valid in seconds
  3036. */
  3037. validStart: number;
  3038. }
  3039. interface CertificatePrincipal {
  3040. // Docs: https://electronjs.org/docs/api/structures/certificate-principal
  3041. /**
  3042. * Common Name.
  3043. */
  3044. commonName: string;
  3045. /**
  3046. * Country or region.
  3047. */
  3048. country: string;
  3049. /**
  3050. * Locality.
  3051. */
  3052. locality: string;
  3053. /**
  3054. * Organization names.
  3055. */
  3056. organizations: string[];
  3057. /**
  3058. * Organization Unit names.
  3059. */
  3060. organizationUnits: string[];
  3061. /**
  3062. * State or province.
  3063. */
  3064. state: string;
  3065. }
  3066. class ClientRequest extends NodeEventEmitter {
  3067. // Docs: https://electronjs.org/docs/api/client-request
  3068. /**
  3069. * Emitted when the `request` is aborted. The `abort` event will not be fired if
  3070. * the `request` is already closed.
  3071. */
  3072. on(event: 'abort', listener: Function): this;
  3073. once(event: 'abort', listener: Function): this;
  3074. addListener(event: 'abort', listener: Function): this;
  3075. removeListener(event: 'abort', listener: Function): this;
  3076. /**
  3077. * Emitted as the last event in the HTTP request-response transaction. The `close`
  3078. * event indicates that no more events will be emitted on either the `request` or
  3079. * `response` objects.
  3080. */
  3081. on(event: 'close', listener: Function): this;
  3082. once(event: 'close', listener: Function): this;
  3083. addListener(event: 'close', listener: Function): this;
  3084. removeListener(event: 'close', listener: Function): this;
  3085. /**
  3086. * Emitted when the `net` module fails to issue a network request. Typically when
  3087. * the `request` object emits an `error` event, a `close` event will subsequently
  3088. * follow and no response object will be provided.
  3089. */
  3090. on(event: 'error', listener: (
  3091. /**
  3092. * an error object providing some information about the failure.
  3093. */
  3094. error: Error) => void): this;
  3095. once(event: 'error', listener: (
  3096. /**
  3097. * an error object providing some information about the failure.
  3098. */
  3099. error: Error) => void): this;
  3100. addListener(event: 'error', listener: (
  3101. /**
  3102. * an error object providing some information about the failure.
  3103. */
  3104. error: Error) => void): this;
  3105. removeListener(event: 'error', listener: (
  3106. /**
  3107. * an error object providing some information about the failure.
  3108. */
  3109. error: Error) => void): this;
  3110. /**
  3111. * Emitted just after the last chunk of the `request`'s data has been written into
  3112. * the `request` object.
  3113. */
  3114. on(event: 'finish', listener: Function): this;
  3115. once(event: 'finish', listener: Function): this;
  3116. addListener(event: 'finish', listener: Function): this;
  3117. removeListener(event: 'finish', listener: Function): this;
  3118. /**
  3119. * Emitted when an authenticating proxy is asking for user credentials.
  3120. *
  3121. * The `callback` function is expected to be called back with user credentials:
  3122. *
  3123. * * `username` String
  3124. * * `password` String
  3125. *
  3126. * Providing empty credentials will cancel the request and report an authentication
  3127. * error on the response object:
  3128. */
  3129. on(event: 'login', listener: (authInfo: AuthInfo,
  3130. callback: (username?: string, password?: string) => void) => void): this;
  3131. once(event: 'login', listener: (authInfo: AuthInfo,
  3132. callback: (username?: string, password?: string) => void) => void): this;
  3133. addListener(event: 'login', listener: (authInfo: AuthInfo,
  3134. callback: (username?: string, password?: string) => void) => void): this;
  3135. removeListener(event: 'login', listener: (authInfo: AuthInfo,
  3136. callback: (username?: string, password?: string) => void) => void): this;
  3137. /**
  3138. * Emitted when the server returns a redirect response (e.g. 301 Moved
  3139. * Permanently). Calling `request.followRedirect` will continue with the
  3140. * redirection. If this event is handled, `request.followRedirect` must be called
  3141. * **synchronously**, otherwise the request will be cancelled.
  3142. */
  3143. on(event: 'redirect', listener: (statusCode: number,
  3144. method: string,
  3145. redirectUrl: string,
  3146. responseHeaders: Record<string, string[]>) => void): this;
  3147. once(event: 'redirect', listener: (statusCode: number,
  3148. method: string,
  3149. redirectUrl: string,
  3150. responseHeaders: Record<string, string[]>) => void): this;
  3151. addListener(event: 'redirect', listener: (statusCode: number,
  3152. method: string,
  3153. redirectUrl: string,
  3154. responseHeaders: Record<string, string[]>) => void): this;
  3155. removeListener(event: 'redirect', listener: (statusCode: number,
  3156. method: string,
  3157. redirectUrl: string,
  3158. responseHeaders: Record<string, string[]>) => void): this;
  3159. on(event: 'response', listener: (
  3160. /**
  3161. * An object representing the HTTP response message.
  3162. */
  3163. response: IncomingMessage) => void): this;
  3164. once(event: 'response', listener: (
  3165. /**
  3166. * An object representing the HTTP response message.
  3167. */
  3168. response: IncomingMessage) => void): this;
  3169. addListener(event: 'response', listener: (
  3170. /**
  3171. * An object representing the HTTP response message.
  3172. */
  3173. response: IncomingMessage) => void): this;
  3174. removeListener(event: 'response', listener: (
  3175. /**
  3176. * An object representing the HTTP response message.
  3177. */
  3178. response: IncomingMessage) => void): this;
  3179. /**
  3180. * ClientRequest
  3181. */
  3182. constructor(options: (ClientRequestConstructorOptions) | (string));
  3183. /**
  3184. * Cancels an ongoing HTTP transaction. If the request has already emitted the
  3185. * `close` event, the abort operation will have no effect. Otherwise an ongoing
  3186. * event will emit `abort` and `close` events. Additionally, if there is an ongoing
  3187. * response object,it will emit the `aborted` event.
  3188. */
  3189. abort(): void;
  3190. /**
  3191. * Sends the last chunk of the request data. Subsequent write or end operations
  3192. * will not be allowed. The `finish` event is emitted just after the end operation.
  3193. */
  3194. end(chunk?: (string) | (Buffer), encoding?: string, callback?: () => void): void;
  3195. /**
  3196. * Continues any pending redirection. Can only be called during a `'redirect'`
  3197. * event.
  3198. */
  3199. followRedirect(): void;
  3200. /**
  3201. * The value of a previously set extra header name.
  3202. */
  3203. getHeader(name: string): string;
  3204. /**
  3205. * * `active` Boolean - Whether the request is currently active. If this is false
  3206. * no other properties will be set
  3207. * * `started` Boolean - Whether the upload has started. If this is false both
  3208. * `current` and `total` will be set to 0.
  3209. * * `current` Integer - The number of bytes that have been uploaded so far
  3210. * * `total` Integer - The number of bytes that will be uploaded this request
  3211. *
  3212. * You can use this method in conjunction with `POST` requests to get the progress
  3213. * of a file upload or other data transfer.
  3214. */
  3215. getUploadProgress(): UploadProgress;
  3216. /**
  3217. * Removes a previously set extra header name. This method can be called only
  3218. * before first write. Trying to call it after the first write will throw an error.
  3219. */
  3220. removeHeader(name: string): void;
  3221. /**
  3222. * Adds an extra HTTP header. The header name will be issued as-is without
  3223. * lowercasing. It can be called only before first write. Calling this method after
  3224. * the first write will throw an error. If the passed value is not a `String`, its
  3225. * `toString()` method will be called to obtain the final value.
  3226. *
  3227. * Certain headers are restricted from being set by apps. These headers are listed
  3228. * below. More information on restricted headers can be found in Chromium's header
  3229. * utils.
  3230. *
  3231. * * `Content-Length`
  3232. * * `Host`
  3233. * * `Trailer` or `Te`
  3234. * * `Upgrade`
  3235. * * `Cookie2`
  3236. * * `Keep-Alive`
  3237. * * `Transfer-Encoding`
  3238. *
  3239. * Additionally, setting the `Connection` header to the value `upgrade` is also
  3240. * disallowed.
  3241. */
  3242. setHeader(name: string, value: string): void;
  3243. /**
  3244. * `callback` is essentially a dummy function introduced in the purpose of keeping
  3245. * similarity with the Node.js API. It is called asynchronously in the next tick
  3246. * after `chunk` content have been delivered to the Chromium networking layer.
  3247. * Contrary to the Node.js implementation, it is not guaranteed that `chunk`
  3248. * content have been flushed on the wire before `callback` is called.
  3249. *
  3250. * Adds a chunk of data to the request body. The first write operation may cause
  3251. * the request headers to be issued on the wire. After the first write operation,
  3252. * it is not allowed to add or remove a custom header.
  3253. */
  3254. write(chunk: (string) | (Buffer), encoding?: string, callback?: () => void): void;
  3255. chunkedEncoding: boolean;
  3256. }
  3257. interface Clipboard {
  3258. // Docs: https://electronjs.org/docs/api/clipboard
  3259. /**
  3260. * An array of supported formats for the clipboard `type`.
  3261. */
  3262. availableFormats(type?: 'selection' | 'clipboard'): string[];
  3263. /**
  3264. * Clears the clipboard content.
  3265. */
  3266. clear(type?: 'selection' | 'clipboard'): void;
  3267. /**
  3268. * Whether the clipboard supports the specified `format`.
  3269. *
  3270. * @experimental
  3271. */
  3272. has(format: string, type?: 'selection' | 'clipboard'): boolean;
  3273. /**
  3274. * Reads `format` type from the clipboard.
  3275. *
  3276. * @experimental
  3277. */
  3278. read(format: string): string;
  3279. /**
  3280. * * `title` String
  3281. * * `url` String
  3282. *
  3283. * Returns an Object containing `title` and `url` keys representing the bookmark in
  3284. * the clipboard. The `title` and `url` values will be empty strings when the
  3285. * bookmark is unavailable.
  3286. *
  3287. * @platform darwin,win32
  3288. */
  3289. readBookmark(): ReadBookmark;
  3290. /**
  3291. * Reads `format` type from the clipboard.
  3292. *
  3293. * @experimental
  3294. */
  3295. readBuffer(format: string): Buffer;
  3296. /**
  3297. * The text on the find pasteboard, which is the pasteboard that holds information
  3298. * about the current state of the active application’s find panel.
  3299. *
  3300. * This method uses synchronous IPC when called from the renderer process. The
  3301. * cached value is reread from the find pasteboard whenever the application is
  3302. * activated.
  3303. *
  3304. * @platform darwin
  3305. */
  3306. readFindText(): string;
  3307. /**
  3308. * The content in the clipboard as markup.
  3309. */
  3310. readHTML(type?: 'selection' | 'clipboard'): string;
  3311. /**
  3312. * The image content in the clipboard.
  3313. */
  3314. readImage(type?: 'selection' | 'clipboard'): NativeImage;
  3315. /**
  3316. * The content in the clipboard as RTF.
  3317. */
  3318. readRTF(type?: 'selection' | 'clipboard'): string;
  3319. /**
  3320. * The content in the clipboard as plain text.
  3321. */
  3322. readText(type?: 'selection' | 'clipboard'): string;
  3323. /**
  3324. * Writes `data` to the clipboard.
  3325. */
  3326. write(data: Data, type?: 'selection' | 'clipboard'): void;
  3327. /**
  3328. * Writes the `title` and `url` into the clipboard as a bookmark.
  3329. *
  3330. * **Note:** Most apps on Windows don't support pasting bookmarks into them so you
  3331. * can use `clipboard.write` to write both a bookmark and fallback text to the
  3332. * clipboard.
  3333. *
  3334. * @platform darwin,win32
  3335. */
  3336. writeBookmark(title: string, url: string, type?: 'selection' | 'clipboard'): void;
  3337. /**
  3338. * Writes the `buffer` into the clipboard as `format`.
  3339. *
  3340. * @experimental
  3341. */
  3342. writeBuffer(format: string, buffer: Buffer, type?: 'selection' | 'clipboard'): void;
  3343. /**
  3344. * Writes the `text` into the find pasteboard (the pasteboard that holds
  3345. * information about the current state of the active application’s find panel) as
  3346. * plain text. This method uses synchronous IPC when called from the renderer
  3347. * process.
  3348. *
  3349. * @platform darwin
  3350. */
  3351. writeFindText(text: string): void;
  3352. /**
  3353. * Writes `markup` to the clipboard.
  3354. */
  3355. writeHTML(markup: string, type?: 'selection' | 'clipboard'): void;
  3356. /**
  3357. * Writes `image` to the clipboard.
  3358. */
  3359. writeImage(image: NativeImage, type?: 'selection' | 'clipboard'): void;
  3360. /**
  3361. * Writes the `text` into the clipboard in RTF.
  3362. */
  3363. writeRTF(text: string, type?: 'selection' | 'clipboard'): void;
  3364. /**
  3365. * Writes the `text` into the clipboard as plain text.
  3366. */
  3367. writeText(text: string, type?: 'selection' | 'clipboard'): void;
  3368. }
  3369. class CommandLine {
  3370. // Docs: https://electronjs.org/docs/api/command-line
  3371. /**
  3372. * Append an argument to Chromium's command line. The argument will be quoted
  3373. * correctly. Switches will precede arguments regardless of appending order.
  3374. *
  3375. * If you're appending an argument like `--switch=value`, consider using
  3376. * `appendSwitch('switch', 'value')` instead.
  3377. *
  3378. * **Note:** This will not affect `process.argv`. The intended usage of this
  3379. * function is to control Chromium's behavior.
  3380. */
  3381. appendArgument(value: string): void;
  3382. /**
  3383. * Append a switch (with optional `value`) to Chromium's command line.
  3384. *
  3385. * **Note:** This will not affect `process.argv`. The intended usage of this
  3386. * function is to control Chromium's behavior.
  3387. */
  3388. appendSwitch(the_switch: string, value?: string): void;
  3389. /**
  3390. * The command-line switch value.
  3391. *
  3392. * **Note:** When the switch is not present or has no value, it returns empty
  3393. * string.
  3394. */
  3395. getSwitchValue(the_switch: string): string;
  3396. /**
  3397. * Whether the command-line switch is present.
  3398. */
  3399. hasSwitch(the_switch: string): boolean;
  3400. }
  3401. interface ContentTracing {
  3402. // Docs: https://electronjs.org/docs/api/content-tracing
  3403. /**
  3404. * resolves with an array of category groups once all child processes have
  3405. * acknowledged the `getCategories` request
  3406. *
  3407. * Get a set of category groups. The category groups can change as new code paths
  3408. * are reached. See also the list of built-in tracing categories.
  3409. *
  3410. * > **NOTE:** Electron adds a non-default tracing category called `"electron"`.
  3411. * This category can be used to capture Electron-specific tracing events.
  3412. */
  3413. getCategories(): Promise<string[]>;
  3414. /**
  3415. * Resolves with an object containing the `value` and `percentage` of trace buffer
  3416. * maximum usage
  3417. *
  3418. * * `value` Number
  3419. * * `percentage` Number
  3420. *
  3421. * Get the maximum usage across processes of trace buffer as a percentage of the
  3422. * full state.
  3423. */
  3424. getTraceBufferUsage(): Promise<Electron.TraceBufferUsageReturnValue>;
  3425. /**
  3426. * resolved once all child processes have acknowledged the `startRecording`
  3427. * request.
  3428. *
  3429. * Start recording on all processes.
  3430. *
  3431. * Recording begins immediately locally and asynchronously on child processes as
  3432. * soon as they receive the EnableRecording request.
  3433. *
  3434. * If a recording is already running, the promise will be immediately resolved, as
  3435. * only one trace operation can be in progress at a time.
  3436. */
  3437. startRecording(options: (TraceConfig) | (TraceCategoriesAndOptions)): Promise<void>;
  3438. /**
  3439. * resolves with a path to a file that contains the traced data once all child
  3440. * processes have acknowledged the `stopRecording` request
  3441. *
  3442. * Stop recording on all processes.
  3443. *
  3444. * Child processes typically cache trace data and only rarely flush and send trace
  3445. * data back to the main process. This helps to minimize the runtime overhead of
  3446. * tracing since sending trace data over IPC can be an expensive operation. So, to
  3447. * end tracing, Chromium asynchronously asks all child processes to flush any
  3448. * pending trace data.
  3449. *
  3450. * Trace data will be written into `resultFilePath`. If `resultFilePath` is empty
  3451. * or not provided, trace data will be written to a temporary file, and the path
  3452. * will be returned in the promise.
  3453. */
  3454. stopRecording(resultFilePath?: string): Promise<string>;
  3455. }
  3456. interface ContextBridge {
  3457. // Docs: https://electronjs.org/docs/api/context-bridge
  3458. exposeInMainWorld(apiKey: string, api: Record<string, any>): void;
  3459. }
  3460. interface Cookie {
  3461. // Docs: https://electronjs.org/docs/api/structures/cookie
  3462. /**
  3463. * The domain of the cookie; this will be normalized with a preceding dot so that
  3464. * it's also valid for subdomains.
  3465. */
  3466. domain?: string;
  3467. /**
  3468. * The expiration date of the cookie as the number of seconds since the UNIX epoch.
  3469. * Not provided for session cookies.
  3470. */
  3471. expirationDate?: number;
  3472. /**
  3473. * Whether the cookie is a host-only cookie; this will only be `true` if no domain
  3474. * was passed.
  3475. */
  3476. hostOnly?: boolean;
  3477. /**
  3478. * Whether the cookie is marked as HTTP only.
  3479. */
  3480. httpOnly?: boolean;
  3481. /**
  3482. * The name of the cookie.
  3483. */
  3484. name: string;
  3485. /**
  3486. * The path of the cookie.
  3487. */
  3488. path?: string;
  3489. /**
  3490. * The Same Site policy applied to this cookie. Can be `unspecified`,
  3491. * `no_restriction`, `lax` or `strict`.
  3492. */
  3493. sameSite: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
  3494. /**
  3495. * Whether the cookie is marked as secure.
  3496. */
  3497. secure?: boolean;
  3498. /**
  3499. * Whether the cookie is a session cookie or a persistent cookie with an expiration
  3500. * date.
  3501. */
  3502. session?: boolean;
  3503. /**
  3504. * The value of the cookie.
  3505. */
  3506. value: string;
  3507. }
  3508. class Cookies extends NodeEventEmitter {
  3509. // Docs: https://electronjs.org/docs/api/cookies
  3510. /**
  3511. * Emitted when a cookie is changed because it was added, edited, removed, or
  3512. * expired.
  3513. */
  3514. on(event: 'changed', listener: Function): this;
  3515. once(event: 'changed', listener: Function): this;
  3516. addListener(event: 'changed', listener: Function): this;
  3517. removeListener(event: 'changed', listener: Function): this;
  3518. /**
  3519. * A promise which resolves when the cookie store has been flushed
  3520. *
  3521. Writes any unwritten cookies data to disk.
  3522. */
  3523. flushStore(): Promise<void>;
  3524. /**
  3525. * A promise which resolves an array of cookie objects.
  3526. *
  3527. * Sends a request to get all cookies matching `filter`, and resolves a promise
  3528. * with the response.
  3529. */
  3530. get(filter: CookiesGetFilter): Promise<Electron.Cookie[]>;
  3531. /**
  3532. * A promise which resolves when the cookie has been removed
  3533. *
  3534. Removes the cookies matching `url` and `name`
  3535. */
  3536. remove(url: string, name: string): Promise<void>;
  3537. /**
  3538. * A promise which resolves when the cookie has been set
  3539. *
  3540. Sets a cookie with `details`.
  3541. */
  3542. set(details: CookiesSetDetails): Promise<void>;
  3543. }
  3544. interface CPUUsage {
  3545. // Docs: https://electronjs.org/docs/api/structures/cpu-usage
  3546. /**
  3547. * The number of average idle CPU wakeups per second since the last call to
  3548. * getCPUUsage. First call returns 0. Will always return 0 on Windows.
  3549. */
  3550. idleWakeupsPerSecond: number;
  3551. /**
  3552. * Percentage of CPU used since the last call to getCPUUsage. First call returns 0.
  3553. */
  3554. percentCPUUsage: number;
  3555. }
  3556. interface CrashReport {
  3557. // Docs: https://electronjs.org/docs/api/structures/crash-report
  3558. date: Date;
  3559. id: string;
  3560. }
  3561. interface CrashReporter {
  3562. // Docs: https://electronjs.org/docs/api/crash-reporter
  3563. /**
  3564. * Set an extra parameter to be sent with the crash report. The values specified
  3565. * here will be sent in addition to any values set via the `extra` option when
  3566. * `start` was called.
  3567. *
  3568. * Parameters added in this fashion (or via the `extra` parameter to
  3569. * `crashReporter.start`) are specific to the calling process. Adding extra
  3570. * parameters in the main process will not cause those parameters to be sent along
  3571. * with crashes from renderer or other child processes. Similarly, adding extra
  3572. * parameters in a renderer process will not result in those parameters being sent
  3573. * with crashes that occur in other renderer processes or in the main process.
  3574. *
  3575. * **Note:** Parameters have limits on the length of the keys and values. Key names
  3576. * must be no longer than 39 bytes, and values must be no longer than 20320 bytes.
  3577. * Keys with names longer than the maximum will be silently ignored. Key values
  3578. * longer than the maximum length will be truncated.
  3579. *
  3580. * **Note:** On linux values that are longer than 127 bytes will be chunked into
  3581. * multiple keys, each 127 bytes in length. E.g. `addExtraParameter('foo',
  3582. * 'a'.repeat(130))` will result in two chunked keys `foo__1` and `foo__2`, the
  3583. * first will contain the first 127 bytes and the second will contain the remaining
  3584. * 3 bytes. On your crash reporting backend you should stitch together keys in
  3585. * this format.
  3586. */
  3587. addExtraParameter(key: string, value: string): void;
  3588. /**
  3589. * The directory where crashes are temporarily stored before being uploaded.
  3590. *
  3591. **Note:** This method is deprecated, use `app.getPath('crashDumps')` instead.
  3592. *
  3593. * @deprecated
  3594. */
  3595. getCrashesDirectory(): string;
  3596. /**
  3597. * The date and ID of the last crash report. Only crash reports that have been
  3598. * uploaded will be returned; even if a crash report is present on disk it will not
  3599. * be returned until it is uploaded. In the case that there are no uploaded
  3600. * reports, `null` is returned.
  3601. *
  3602. **Note:** Calling this method from the renderer process is deprecated.
  3603. */
  3604. getLastCrashReport(): CrashReport;
  3605. /**
  3606. * The current 'extra' parameters of the crash reporter.
  3607. */
  3608. getParameters(): Record<string, string>;
  3609. /**
  3610. * Returns all uploaded crash reports. Each report contains the date and uploaded
  3611. * ID.
  3612. **Note:** Calling this method from the renderer process is deprecated.
  3613. */
  3614. getUploadedReports(): CrashReport[];
  3615. /**
  3616. * Whether reports should be submitted to the server. Set through the `start`
  3617. * method or `setUploadToServer`.
  3618. *
  3619. **Note:** Calling this method from the renderer process is deprecated.
  3620. */
  3621. getUploadToServer(): boolean;
  3622. /**
  3623. * Remove an extra parameter from the current set of parameters. Future crashes
  3624. * will not include this parameter.
  3625. */
  3626. removeExtraParameter(key: string): void;
  3627. /**
  3628. * This would normally be controlled by user preferences. This has no effect if
  3629. * called before `start` is called.
  3630. *
  3631. **Note:** Calling this method from the renderer process is deprecated.
  3632. */
  3633. setUploadToServer(uploadToServer: boolean): void;
  3634. /**
  3635. * This method must be called before using any other `crashReporter` APIs. Once
  3636. * initialized this way, the crashpad handler collects crashes from all
  3637. * subsequently created processes. The crash reporter cannot be disabled once
  3638. * started.
  3639. *
  3640. * This method should be called as early as possible in app startup, preferably
  3641. * before `app.on('ready')`. If the crash reporter is not initialized at the time a
  3642. * renderer process is created, then that renderer process will not be monitored by
  3643. * the crash reporter.
  3644. *
  3645. * **Note:** You can test out the crash reporter by generating a crash using
  3646. * `process.crash()`.
  3647. *
  3648. * **Note:** If you need to send additional/updated `extra` parameters after your
  3649. * first call `start` you can call `addExtraParameter`.
  3650. *
  3651. * **Note:** Parameters passed in `extra`, `globalExtra` or set with
  3652. * `addExtraParameter` have limits on the length of the keys and values. Key names
  3653. * must be at most 39 bytes long, and values must be no longer than 127 bytes. Keys
  3654. * with names longer than the maximum will be silently ignored. Key values longer
  3655. * than the maximum length will be truncated.
  3656. *
  3657. **Note:** Calling this method from the renderer process is deprecated.
  3658. */
  3659. start(options: CrashReporterStartOptions): void;
  3660. }
  3661. interface CustomScheme {
  3662. // Docs: https://electronjs.org/docs/api/structures/custom-scheme
  3663. privileges?: Privileges;
  3664. /**
  3665. * Custom schemes to be registered with options.
  3666. */
  3667. scheme: string;
  3668. }
  3669. class Debugger extends NodeEventEmitter {
  3670. // Docs: https://electronjs.org/docs/api/debugger
  3671. /**
  3672. * Emitted when the debugging session is terminated. This happens either when
  3673. * `webContents` is closed or devtools is invoked for the attached `webContents`.
  3674. */
  3675. on(event: 'detach', listener: (event: Event,
  3676. /**
  3677. * Reason for detaching debugger.
  3678. */
  3679. reason: string) => void): this;
  3680. once(event: 'detach', listener: (event: Event,
  3681. /**
  3682. * Reason for detaching debugger.
  3683. */
  3684. reason: string) => void): this;
  3685. addListener(event: 'detach', listener: (event: Event,
  3686. /**
  3687. * Reason for detaching debugger.
  3688. */
  3689. reason: string) => void): this;
  3690. removeListener(event: 'detach', listener: (event: Event,
  3691. /**
  3692. * Reason for detaching debugger.
  3693. */
  3694. reason: string) => void): this;
  3695. /**
  3696. * Emitted whenever the debugging target issues an instrumentation event.
  3697. */
  3698. on(event: 'message', listener: (event: Event,
  3699. /**
  3700. * Method name.
  3701. */
  3702. method: string,
  3703. /**
  3704. * Event parameters defined by the 'parameters' attribute in the remote debugging
  3705. * protocol.
  3706. */
  3707. params: any,
  3708. /**
  3709. * Unique identifier of attached debugging session, will match the value sent from
  3710. * `debugger.sendCommand`.
  3711. */
  3712. sessionId: string) => void): this;
  3713. once(event: 'message', listener: (event: Event,
  3714. /**
  3715. * Method name.
  3716. */
  3717. method: string,
  3718. /**
  3719. * Event parameters defined by the 'parameters' attribute in the remote debugging
  3720. * protocol.
  3721. */
  3722. params: any,
  3723. /**
  3724. * Unique identifier of attached debugging session, will match the value sent from
  3725. * `debugger.sendCommand`.
  3726. */
  3727. sessionId: string) => void): this;
  3728. addListener(event: 'message', listener: (event: Event,
  3729. /**
  3730. * Method name.
  3731. */
  3732. method: string,
  3733. /**
  3734. * Event parameters defined by the 'parameters' attribute in the remote debugging
  3735. * protocol.
  3736. */
  3737. params: any,
  3738. /**
  3739. * Unique identifier of attached debugging session, will match the value sent from
  3740. * `debugger.sendCommand`.
  3741. */
  3742. sessionId: string) => void): this;
  3743. removeListener(event: 'message', listener: (event: Event,
  3744. /**
  3745. * Method name.
  3746. */
  3747. method: string,
  3748. /**
  3749. * Event parameters defined by the 'parameters' attribute in the remote debugging
  3750. * protocol.
  3751. */
  3752. params: any,
  3753. /**
  3754. * Unique identifier of attached debugging session, will match the value sent from
  3755. * `debugger.sendCommand`.
  3756. */
  3757. sessionId: string) => void): this;
  3758. /**
  3759. * Attaches the debugger to the `webContents`.
  3760. */
  3761. attach(protocolVersion?: string): void;
  3762. /**
  3763. * Detaches the debugger from the `webContents`.
  3764. */
  3765. detach(): void;
  3766. /**
  3767. * Whether a debugger is attached to the `webContents`.
  3768. */
  3769. isAttached(): boolean;
  3770. /**
  3771. * A promise that resolves with the response defined by the 'returns' attribute of
  3772. * the command description in the remote debugging protocol or is rejected
  3773. * indicating the failure of the command.
  3774. *
  3775. Send given command to the debugging target.
  3776. */
  3777. sendCommand(method: string, commandParams?: any, sessionId?: string): Promise<any>;
  3778. }
  3779. interface DesktopCapturer {
  3780. // Docs: https://electronjs.org/docs/api/desktop-capturer
  3781. /**
  3782. * Resolves with an array of `DesktopCapturerSource` objects, each
  3783. * `DesktopCapturerSource` represents a screen or an individual window that can be
  3784. * captured.
  3785. *
  3786. * **Note** Capturing the screen contents requires user consent on macOS 10.15
  3787. * Catalina or higher, which can detected by
  3788. * `systemPreferences.getMediaAccessStatus`.
  3789. */
  3790. getSources(options: SourcesOptions): Promise<Electron.DesktopCapturerSource[]>;
  3791. }
  3792. interface DesktopCapturerSource {
  3793. // Docs: https://electronjs.org/docs/api/structures/desktop-capturer-source
  3794. /**
  3795. * An icon image of the application that owns the window or null if the source has
  3796. * a type screen. The size of the icon is not known in advance and depends on what
  3797. * the application provides.
  3798. */
  3799. appIcon: NativeImage;
  3800. /**
  3801. * A unique identifier that will correspond to the `id` of the matching Display
  3802. * returned by the Screen API. On some platforms, this is equivalent to the `XX`
  3803. * portion of the `id` field above and on others it will differ. It will be an
  3804. * empty string if not available.
  3805. */
  3806. display_id: string;
  3807. /**
  3808. * The identifier of a window or screen that can be used as a `chromeMediaSourceId`
  3809. * constraint when calling [`navigator.webkitGetUserMedia`]. The format of the
  3810. * identifier will be `window:XX` or `screen:XX`, where `XX` is a random generated
  3811. * number.
  3812. */
  3813. id: string;
  3814. /**
  3815. * A screen source will be named either `Entire Screen` or `Screen <index>`, while
  3816. * the name of a window source will match the window title.
  3817. */
  3818. name: string;
  3819. /**
  3820. * A thumbnail image. **Note:** There is no guarantee that the size of the
  3821. * thumbnail is the same as the `thumbnailSize` specified in the `options` passed
  3822. * to `desktopCapturer.getSources`. The actual size depends on the scale of the
  3823. * screen or window.
  3824. */
  3825. thumbnail: NativeImage;
  3826. }
  3827. interface Dialog {
  3828. // Docs: https://electronjs.org/docs/api/dialog
  3829. /**
  3830. * resolves when the certificate trust dialog is shown.
  3831. *
  3832. * On macOS, this displays a modal dialog that shows a message and certificate
  3833. * information, and gives the user the option of trusting/importing the
  3834. * certificate. If you provide a `browserWindow` argument the dialog will be
  3835. * attached to the parent window, making it modal.
  3836. *
  3837. * On Windows the options are more limited, due to the Win32 APIs used:
  3838. *
  3839. * * The `message` argument is not used, as the OS provides its own confirmation
  3840. * dialog.
  3841. * * The `browserWindow` argument is ignored since it is not possible to make this
  3842. * confirmation dialog modal.
  3843. *
  3844. * @platform darwin,win32
  3845. */
  3846. showCertificateTrustDialog(browserWindow: BrowserWindow, options: CertificateTrustDialogOptions): Promise<void>;
  3847. /**
  3848. * resolves when the certificate trust dialog is shown.
  3849. *
  3850. * On macOS, this displays a modal dialog that shows a message and certificate
  3851. * information, and gives the user the option of trusting/importing the
  3852. * certificate. If you provide a `browserWindow` argument the dialog will be
  3853. * attached to the parent window, making it modal.
  3854. *
  3855. * On Windows the options are more limited, due to the Win32 APIs used:
  3856. *
  3857. * * The `message` argument is not used, as the OS provides its own confirmation
  3858. * dialog.
  3859. * * The `browserWindow` argument is ignored since it is not possible to make this
  3860. * confirmation dialog modal.
  3861. *
  3862. * @platform darwin,win32
  3863. */
  3864. showCertificateTrustDialog(options: CertificateTrustDialogOptions): Promise<void>;
  3865. /**
  3866. * Displays a modal dialog that shows an error message.
  3867. *
  3868. * This API can be called safely before the `ready` event the `app` module emits,
  3869. * it is usually used to report errors in early stage of startup. If called before
  3870. * the app `ready`event on Linux, the message will be emitted to stderr, and no GUI
  3871. * dialog will appear.
  3872. */
  3873. showErrorBox(title: string, content: string): void;
  3874. /**
  3875. * resolves with a promise containing the following properties:
  3876. *
  3877. * * `response` Number - The index of the clicked button.
  3878. * * `checkboxChecked` Boolean - The checked state of the checkbox if
  3879. * `checkboxLabel` was set. Otherwise `false`.
  3880. *
  3881. * Shows a message box, it will block the process until the message box is closed.
  3882. *
  3883. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3884. * window, making it modal.
  3885. */
  3886. showMessageBox(browserWindow: BrowserWindow, options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
  3887. /**
  3888. * resolves with a promise containing the following properties:
  3889. *
  3890. * * `response` Number - The index of the clicked button.
  3891. * * `checkboxChecked` Boolean - The checked state of the checkbox if
  3892. * `checkboxLabel` was set. Otherwise `false`.
  3893. *
  3894. * Shows a message box, it will block the process until the message box is closed.
  3895. *
  3896. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3897. * window, making it modal.
  3898. */
  3899. showMessageBox(options: MessageBoxOptions): Promise<Electron.MessageBoxReturnValue>;
  3900. /**
  3901. * the index of the clicked button.
  3902. *
  3903. * Shows a message box, it will block the process until the message box is closed.
  3904. * It returns the index of the clicked button.
  3905. *
  3906. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3907. * window, making it modal. If `browserWindow` is not shown dialog will not be
  3908. * attached to it. In such case it will be displayed as an independent window.
  3909. */
  3910. showMessageBoxSync(browserWindow: BrowserWindow, options: MessageBoxSyncOptions): number;
  3911. /**
  3912. * the index of the clicked button.
  3913. *
  3914. * Shows a message box, it will block the process until the message box is closed.
  3915. * It returns the index of the clicked button.
  3916. *
  3917. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3918. * window, making it modal. If `browserWindow` is not shown dialog will not be
  3919. * attached to it. In such case it will be displayed as an independent window.
  3920. */
  3921. showMessageBoxSync(options: MessageBoxSyncOptions): number;
  3922. /**
  3923. * Resolve with an object containing the following:
  3924. *
  3925. * * `canceled` Boolean - whether or not the dialog was canceled.
  3926. * * `filePaths` String[] - An array of file paths chosen by the user. If the
  3927. * dialog is cancelled this will be an empty array.
  3928. * * `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the
  3929. * `filePaths` array of base64 encoded strings which contains security scoped
  3930. * bookmark data. `securityScopedBookmarks` must be enabled for this to be
  3931. * populated. (For return values, see table here.)
  3932. *
  3933. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3934. * window, making it modal.
  3935. *
  3936. * The `filters` specifies an array of file types that can be displayed or selected
  3937. * when you want to limit the user to a specific type. For example:
  3938. *
  3939. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  3940. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  3941. * `'*'` wildcard (no other wildcard is supported).
  3942. *
  3943. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  3944. * and a directory selector, so if you set `properties` to `['openFile',
  3945. * 'openDirectory']` on these platforms, a directory selector will be shown.
  3946. */
  3947. showOpenDialog(browserWindow: BrowserWindow, options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
  3948. /**
  3949. * Resolve with an object containing the following:
  3950. *
  3951. * * `canceled` Boolean - whether or not the dialog was canceled.
  3952. * * `filePaths` String[] - An array of file paths chosen by the user. If the
  3953. * dialog is cancelled this will be an empty array.
  3954. * * `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the
  3955. * `filePaths` array of base64 encoded strings which contains security scoped
  3956. * bookmark data. `securityScopedBookmarks` must be enabled for this to be
  3957. * populated. (For return values, see table here.)
  3958. *
  3959. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3960. * window, making it modal.
  3961. *
  3962. * The `filters` specifies an array of file types that can be displayed or selected
  3963. * when you want to limit the user to a specific type. For example:
  3964. *
  3965. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  3966. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  3967. * `'*'` wildcard (no other wildcard is supported).
  3968. *
  3969. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  3970. * and a directory selector, so if you set `properties` to `['openFile',
  3971. * 'openDirectory']` on these platforms, a directory selector will be shown.
  3972. */
  3973. showOpenDialog(options: OpenDialogOptions): Promise<Electron.OpenDialogReturnValue>;
  3974. /**
  3975. * the file paths chosen by the user; if the dialog is cancelled it returns
  3976. * `undefined`.
  3977. *
  3978. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3979. * window, making it modal.
  3980. *
  3981. * The `filters` specifies an array of file types that can be displayed or selected
  3982. * when you want to limit the user to a specific type. For example:
  3983. *
  3984. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  3985. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  3986. * `'*'` wildcard (no other wildcard is supported).
  3987. *
  3988. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  3989. * and a directory selector, so if you set `properties` to `['openFile',
  3990. * 'openDirectory']` on these platforms, a directory selector will be shown.
  3991. */
  3992. showOpenDialogSync(browserWindow: BrowserWindow, options: OpenDialogSyncOptions): (string[]) | (undefined);
  3993. /**
  3994. * the file paths chosen by the user; if the dialog is cancelled it returns
  3995. * `undefined`.
  3996. *
  3997. * The `browserWindow` argument allows the dialog to attach itself to a parent
  3998. * window, making it modal.
  3999. *
  4000. * The `filters` specifies an array of file types that can be displayed or selected
  4001. * when you want to limit the user to a specific type. For example:
  4002. *
  4003. * The `extensions` array should contain extensions without wildcards or dots (e.g.
  4004. * `'png'` is good but `'.png'` and `'*.png'` are bad). To show all files, use the
  4005. * `'*'` wildcard (no other wildcard is supported).
  4006. *
  4007. * **Note:** On Windows and Linux an open dialog can not be both a file selector
  4008. * and a directory selector, so if you set `properties` to `['openFile',
  4009. * 'openDirectory']` on these platforms, a directory selector will be shown.
  4010. */
  4011. showOpenDialogSync(options: OpenDialogSyncOptions): (string[]) | (undefined);
  4012. /**
  4013. * Resolve with an object containing the following:
  4014. *
  4015. * * `canceled` Boolean - whether or not the dialog was canceled.
  4016. * * `filePath` String (optional) - If the dialog is canceled, this will be
  4017. * `undefined`.
  4018. * * `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which
  4019. * contains the security scoped bookmark data for the saved file.
  4020. * `securityScopedBookmarks` must be enabled for this to be present. (For return
  4021. * values, see table here.)
  4022. *
  4023. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4024. * window, making it modal.
  4025. *
  4026. * The `filters` specifies an array of file types that can be displayed, see
  4027. * `dialog.showOpenDialog` for an example.
  4028. *
  4029. * **Note:** On macOS, using the asynchronous version is recommended to avoid
  4030. * issues when expanding and collapsing the dialog.
  4031. */
  4032. showSaveDialog(browserWindow: BrowserWindow, options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
  4033. /**
  4034. * Resolve with an object containing the following:
  4035. *
  4036. * * `canceled` Boolean - whether or not the dialog was canceled.
  4037. * * `filePath` String (optional) - If the dialog is canceled, this will be
  4038. * `undefined`.
  4039. * * `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which
  4040. * contains the security scoped bookmark data for the saved file.
  4041. * `securityScopedBookmarks` must be enabled for this to be present. (For return
  4042. * values, see table here.)
  4043. *
  4044. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4045. * window, making it modal.
  4046. *
  4047. * The `filters` specifies an array of file types that can be displayed, see
  4048. * `dialog.showOpenDialog` for an example.
  4049. *
  4050. * **Note:** On macOS, using the asynchronous version is recommended to avoid
  4051. * issues when expanding and collapsing the dialog.
  4052. */
  4053. showSaveDialog(options: SaveDialogOptions): Promise<Electron.SaveDialogReturnValue>;
  4054. /**
  4055. * the path of the file chosen by the user; if the dialog is cancelled it returns
  4056. * `undefined`.
  4057. *
  4058. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4059. * window, making it modal.
  4060. *
  4061. * The `filters` specifies an array of file types that can be displayed, see
  4062. * `dialog.showOpenDialog` for an example.
  4063. */
  4064. showSaveDialogSync(browserWindow: BrowserWindow, options: SaveDialogSyncOptions): (string) | (undefined);
  4065. /**
  4066. * the path of the file chosen by the user; if the dialog is cancelled it returns
  4067. * `undefined`.
  4068. *
  4069. * The `browserWindow` argument allows the dialog to attach itself to a parent
  4070. * window, making it modal.
  4071. *
  4072. * The `filters` specifies an array of file types that can be displayed, see
  4073. * `dialog.showOpenDialog` for an example.
  4074. */
  4075. showSaveDialogSync(options: SaveDialogSyncOptions): (string) | (undefined);
  4076. }
  4077. interface Display {
  4078. // Docs: https://electronjs.org/docs/api/structures/display
  4079. /**
  4080. * Can be `available`, `unavailable`, `unknown`.
  4081. */
  4082. accelerometerSupport: ('available' | 'unavailable' | 'unknown');
  4083. bounds: Rectangle;
  4084. /**
  4085. * The number of bits per pixel.
  4086. */
  4087. colorDepth: number;
  4088. /**
  4089. * represent a color space (three-dimensional object which contains all realizable
  4090. * color combinations) for the purpose of color conversions
  4091. */
  4092. colorSpace: string;
  4093. /**
  4094. * The number of bits per color component.
  4095. */
  4096. depthPerComponent: number;
  4097. /**
  4098. * Unique identifier associated with the display.
  4099. */
  4100. id: number;
  4101. /**
  4102. * `true` for an internal display and `false` for an external display
  4103. */
  4104. internal: boolean;
  4105. /**
  4106. * Whether or not the display is a monochrome display.
  4107. */
  4108. monochrome: boolean;
  4109. /**
  4110. * Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
  4111. */
  4112. rotation: number;
  4113. /**
  4114. * Output device's pixel scale factor.
  4115. */
  4116. scaleFactor: number;
  4117. size: Size;
  4118. /**
  4119. * Can be `available`, `unavailable`, `unknown`.
  4120. */
  4121. touchSupport: ('available' | 'unavailable' | 'unknown');
  4122. workArea: Rectangle;
  4123. workAreaSize: Size;
  4124. }
  4125. class Dock {
  4126. // Docs: https://electronjs.org/docs/api/dock
  4127. /**
  4128. * an ID representing the request.
  4129. *
  4130. * When `critical` is passed, the dock icon will bounce until either the
  4131. * application becomes active or the request is canceled.
  4132. *
  4133. * When `informational` is passed, the dock icon will bounce for one second.
  4134. * However, the request remains active until either the application becomes active
  4135. * or the request is canceled.
  4136. *
  4137. * **Nota Bene:** This method can only be used while the app is not focused; when
  4138. * the app is focused it will return -1.
  4139. *
  4140. * @platform darwin
  4141. */
  4142. bounce(type?: 'critical' | 'informational'): number;
  4143. /**
  4144. * Cancel the bounce of `id`.
  4145. *
  4146. * @platform darwin
  4147. */
  4148. cancelBounce(id: number): void;
  4149. /**
  4150. * Bounces the Downloads stack if the filePath is inside the Downloads folder.
  4151. *
  4152. * @platform darwin
  4153. */
  4154. downloadFinished(filePath: string): void;
  4155. /**
  4156. * The badge string of the dock.
  4157. *
  4158. * @platform darwin
  4159. */
  4160. getBadge(): string;
  4161. /**
  4162. * The application's [dock menu][dock-menu].
  4163. *
  4164. * @platform darwin
  4165. */
  4166. getMenu(): (Menu) | (null);
  4167. /**
  4168. * Hides the dock icon.
  4169. *
  4170. * @platform darwin
  4171. */
  4172. hide(): void;
  4173. /**
  4174. * Whether the dock icon is visible.
  4175. *
  4176. * @platform darwin
  4177. */
  4178. isVisible(): boolean;
  4179. /**
  4180. * Sets the string to be displayed in the dock’s badging area.
  4181. *
  4182. * @platform darwin
  4183. */
  4184. setBadge(text: string): void;
  4185. /**
  4186. * Sets the `image` associated with this dock icon.
  4187. *
  4188. * @platform darwin
  4189. */
  4190. setIcon(image: (NativeImage) | (string)): void;
  4191. /**
  4192. * Sets the application's [dock menu][dock-menu].
  4193. *
  4194. * @platform darwin
  4195. */
  4196. setMenu(menu: Menu): void;
  4197. /**
  4198. * Resolves when the dock icon is shown.
  4199. *
  4200. * @platform darwin
  4201. */
  4202. show(): Promise<void>;
  4203. }
  4204. class DownloadItem extends NodeEventEmitter {
  4205. // Docs: https://electronjs.org/docs/api/download-item
  4206. /**
  4207. * Emitted when the download is in a terminal state. This includes a completed
  4208. * download, a cancelled download (via `downloadItem.cancel()`), and interrupted
  4209. * download that can't be resumed.
  4210. *
  4211. * The `state` can be one of following:
  4212. *
  4213. * * `completed` - The download completed successfully.
  4214. * * `cancelled` - The download has been cancelled.
  4215. * * `interrupted` - The download has interrupted and can not resume.
  4216. */
  4217. on(event: 'done', listener: (event: Event,
  4218. /**
  4219. * Can be `completed`, `cancelled` or `interrupted`.
  4220. */
  4221. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  4222. once(event: 'done', listener: (event: Event,
  4223. /**
  4224. * Can be `completed`, `cancelled` or `interrupted`.
  4225. */
  4226. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  4227. addListener(event: 'done', listener: (event: Event,
  4228. /**
  4229. * Can be `completed`, `cancelled` or `interrupted`.
  4230. */
  4231. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  4232. removeListener(event: 'done', listener: (event: Event,
  4233. /**
  4234. * Can be `completed`, `cancelled` or `interrupted`.
  4235. */
  4236. state: ('completed' | 'cancelled' | 'interrupted')) => void): this;
  4237. /**
  4238. * Emitted when the download has been updated and is not done.
  4239. *
  4240. * The `state` can be one of following:
  4241. *
  4242. * * `progressing` - The download is in-progress.
  4243. * * `interrupted` - The download has interrupted and can be resumed.
  4244. */
  4245. on(event: 'updated', listener: (event: Event,
  4246. /**
  4247. * Can be `progressing` or `interrupted`.
  4248. */
  4249. state: ('progressing' | 'interrupted')) => void): this;
  4250. once(event: 'updated', listener: (event: Event,
  4251. /**
  4252. * Can be `progressing` or `interrupted`.
  4253. */
  4254. state: ('progressing' | 'interrupted')) => void): this;
  4255. addListener(event: 'updated', listener: (event: Event,
  4256. /**
  4257. * Can be `progressing` or `interrupted`.
  4258. */
  4259. state: ('progressing' | 'interrupted')) => void): this;
  4260. removeListener(event: 'updated', listener: (event: Event,
  4261. /**
  4262. * Can be `progressing` or `interrupted`.
  4263. */
  4264. state: ('progressing' | 'interrupted')) => void): this;
  4265. /**
  4266. * Cancels the download operation.
  4267. */
  4268. cancel(): void;
  4269. /**
  4270. * Whether the download can resume.
  4271. */
  4272. canResume(): boolean;
  4273. /**
  4274. * The Content-Disposition field from the response header.
  4275. */
  4276. getContentDisposition(): string;
  4277. /**
  4278. * ETag header value.
  4279. */
  4280. getETag(): string;
  4281. /**
  4282. * The file name of the download item.
  4283. *
  4284. * **Note:** The file name is not always the same as the actual one saved in local
  4285. * disk. If user changes the file name in a prompted download saving dialog, the
  4286. * actual name of saved file will be different.
  4287. */
  4288. getFilename(): string;
  4289. /**
  4290. * Last-Modified header value.
  4291. */
  4292. getLastModifiedTime(): string;
  4293. /**
  4294. * The files mime type.
  4295. */
  4296. getMimeType(): string;
  4297. /**
  4298. * The received bytes of the download item.
  4299. */
  4300. getReceivedBytes(): number;
  4301. /**
  4302. * Returns the object previously set by
  4303. * `downloadItem.setSaveDialogOptions(options)`.
  4304. */
  4305. getSaveDialogOptions(): SaveDialogOptions;
  4306. /**
  4307. * The save path of the download item. This will be either the path set via
  4308. * `downloadItem.setSavePath(path)` or the path selected from the shown save
  4309. * dialog.
  4310. */
  4311. getSavePath(): string;
  4312. /**
  4313. * Number of seconds since the UNIX epoch when the download was started.
  4314. */
  4315. getStartTime(): number;
  4316. /**
  4317. * The current state. Can be `progressing`, `completed`, `cancelled` or
  4318. * `interrupted`.
  4319. *
  4320. * **Note:** The following methods are useful specifically to resume a `cancelled`
  4321. * item when session is restarted.
  4322. */
  4323. getState(): ('progressing' | 'completed' | 'cancelled' | 'interrupted');
  4324. /**
  4325. * The total size in bytes of the download item.
  4326. *
  4327. If the size is unknown, it returns 0.
  4328. */
  4329. getTotalBytes(): number;
  4330. /**
  4331. * The origin URL where the item is downloaded from.
  4332. */
  4333. getURL(): string;
  4334. /**
  4335. * The complete URL chain of the item including any redirects.
  4336. */
  4337. getURLChain(): string[];
  4338. /**
  4339. * Whether the download has user gesture.
  4340. */
  4341. hasUserGesture(): boolean;
  4342. /**
  4343. * Whether the download is paused.
  4344. */
  4345. isPaused(): boolean;
  4346. /**
  4347. * Pauses the download.
  4348. */
  4349. pause(): void;
  4350. /**
  4351. * Resumes the download that has been paused.
  4352. *
  4353. * **Note:** To enable resumable downloads the server you are downloading from must
  4354. * support range requests and provide both `Last-Modified` and `ETag` header
  4355. * values. Otherwise `resume()` will dismiss previously received bytes and restart
  4356. * the download from the beginning.
  4357. */
  4358. resume(): void;
  4359. /**
  4360. * This API allows the user to set custom options for the save dialog that opens
  4361. * for the download item by default. The API is only available in session's
  4362. * `will-download` callback function.
  4363. */
  4364. setSaveDialogOptions(options: SaveDialogOptions): void;
  4365. /**
  4366. * The API is only available in session's `will-download` callback function. If
  4367. * user doesn't set the save path via the API, Electron will use the original
  4368. * routine to determine the save path; this usually prompts a save dialog.
  4369. */
  4370. setSavePath(path: string): void;
  4371. savePath: string;
  4372. }
  4373. interface Event extends GlobalEvent {
  4374. // Docs: https://electronjs.org/docs/api/structures/event
  4375. preventDefault: (() => void);
  4376. }
  4377. interface Extension {
  4378. // Docs: https://electronjs.org/docs/api/structures/extension
  4379. id: string;
  4380. /**
  4381. * Copy of the extension's manifest data.
  4382. */
  4383. manifest: any;
  4384. name: string;
  4385. /**
  4386. * The extension's file path.
  4387. */
  4388. path: string;
  4389. /**
  4390. * The extension's `chrome-extension://` URL.
  4391. */
  4392. url: string;
  4393. version: string;
  4394. }
  4395. interface ExtensionInfo {
  4396. // Docs: https://electronjs.org/docs/api/structures/extension-info
  4397. name: string;
  4398. version: string;
  4399. }
  4400. interface FileFilter {
  4401. // Docs: https://electronjs.org/docs/api/structures/file-filter
  4402. extensions: string[];
  4403. name: string;
  4404. }
  4405. interface FilePathWithHeaders {
  4406. // Docs: https://electronjs.org/docs/api/structures/file-path-with-headers
  4407. /**
  4408. * Additional headers to be sent.
  4409. */
  4410. headers?: Record<string, string>;
  4411. /**
  4412. * The path to the file to send.
  4413. */
  4414. path: string;
  4415. }
  4416. interface GlobalShortcut {
  4417. // Docs: https://electronjs.org/docs/api/global-shortcut
  4418. /**
  4419. * Whether this application has registered `accelerator`.
  4420. *
  4421. * When the accelerator is already taken by other applications, this call will
  4422. * still return `false`. This behavior is intended by operating systems, since they
  4423. * don't want applications to fight for global shortcuts.
  4424. */
  4425. isRegistered(accelerator: Accelerator): boolean;
  4426. /**
  4427. * Whether or not the shortcut was registered successfully.
  4428. *
  4429. * Registers a global shortcut of `accelerator`. The `callback` is called when the
  4430. * registered shortcut is pressed by the user.
  4431. *
  4432. * When the accelerator is already taken by other applications, this call will
  4433. * silently fail. This behavior is intended by operating systems, since they don't
  4434. * want applications to fight for global shortcuts.
  4435. *
  4436. * The following accelerators will not be registered successfully on macOS 10.14
  4437. * Mojave unless the app has been authorized as a trusted accessibility client:
  4438. *
  4439. * * "Media Play/Pause"
  4440. * * "Media Next Track"
  4441. * "Media Previous Track"
  4442. * "Media Stop"
  4443. */
  4444. register(accelerator: Accelerator, callback: () => void): boolean;
  4445. /**
  4446. * Registers a global shortcut of all `accelerator` items in `accelerators`. The
  4447. * `callback` is called when any of the registered shortcuts are pressed by the
  4448. * user.
  4449. *
  4450. * When a given accelerator is already taken by other applications, this call will
  4451. * silently fail. This behavior is intended by operating systems, since they don't
  4452. * want applications to fight for global shortcuts.
  4453. *
  4454. * The following accelerators will not be registered successfully on macOS 10.14
  4455. * Mojave unless the app has been authorized as a trusted accessibility client:
  4456. *
  4457. * * "Media Play/Pause"
  4458. * * "Media Next Track"
  4459. * "Media Previous Track"
  4460. * "Media Stop"
  4461. */
  4462. registerAll(accelerators: string[], callback: () => void): void;
  4463. /**
  4464. * Unregisters the global shortcut of `accelerator`.
  4465. */
  4466. unregister(accelerator: Accelerator): void;
  4467. /**
  4468. * Unregisters all of the global shortcuts.
  4469. */
  4470. unregisterAll(): void;
  4471. }
  4472. interface GPUFeatureStatus {
  4473. // Docs: https://electronjs.org/docs/api/structures/gpu-feature-status
  4474. /**
  4475. * Canvas.
  4476. */
  4477. '2d_canvas': string;
  4478. /**
  4479. * Flash.
  4480. */
  4481. flash_3d: string;
  4482. /**
  4483. * Flash Stage3D.
  4484. */
  4485. flash_stage3d: string;
  4486. /**
  4487. * Flash Stage3D Baseline profile.
  4488. */
  4489. flash_stage3d_baseline: string;
  4490. /**
  4491. * Compositing.
  4492. */
  4493. gpu_compositing: string;
  4494. /**
  4495. * Multiple Raster Threads.
  4496. */
  4497. multiple_raster_threads: string;
  4498. /**
  4499. * Native GpuMemoryBuffers.
  4500. */
  4501. native_gpu_memory_buffers: string;
  4502. /**
  4503. * Rasterization.
  4504. */
  4505. rasterization: string;
  4506. /**
  4507. * Video Decode.
  4508. */
  4509. video_decode: string;
  4510. /**
  4511. * Video Encode.
  4512. */
  4513. video_encode: string;
  4514. /**
  4515. * VPx Video Decode.
  4516. */
  4517. vpx_decode: string;
  4518. /**
  4519. * WebGL.
  4520. */
  4521. webgl: string;
  4522. /**
  4523. * WebGL2.
  4524. */
  4525. webgl2: string;
  4526. }
  4527. interface InAppPurchase extends NodeJS.EventEmitter {
  4528. // Docs: https://electronjs.org/docs/api/in-app-purchase
  4529. on(event: 'transactions-updated', listener: Function): this;
  4530. once(event: 'transactions-updated', listener: Function): this;
  4531. addListener(event: 'transactions-updated', listener: Function): this;
  4532. removeListener(event: 'transactions-updated', listener: Function): this;
  4533. /**
  4534. * whether a user can make a payment.
  4535. */
  4536. canMakePayments(): boolean;
  4537. /**
  4538. * Completes all pending transactions.
  4539. */
  4540. finishAllTransactions(): void;
  4541. /**
  4542. * Completes the pending transactions corresponding to the date.
  4543. */
  4544. finishTransactionByDate(date: string): void;
  4545. /**
  4546. * Resolves with an array of `Product` objects.
  4547. *
  4548. Retrieves the product descriptions.
  4549. */
  4550. getProducts(productIDs: string[]): Promise<Electron.Product[]>;
  4551. /**
  4552. * the path to the receipt.
  4553. */
  4554. getReceiptURL(): string;
  4555. /**
  4556. * Returns `true` if the product is valid and added to the payment queue.
  4557. *
  4558. * You should listen for the `transactions-updated` event as soon as possible and
  4559. * certainly before you call `purchaseProduct`.
  4560. */
  4561. purchaseProduct(productID: string, quantity?: number): Promise<boolean>;
  4562. /**
  4563. * Restores finished transactions. This method can be called either to install
  4564. * purchases on additional devices, or to restore purchases for an application that
  4565. * the user deleted and reinstalled.
  4566. *
  4567. * The payment queue delivers a new transaction for each previously completed
  4568. * transaction that can be restored. Each transaction includes a copy of the
  4569. * original transaction.
  4570. */
  4571. restoreCompletedTransactions(): void;
  4572. }
  4573. class IncomingMessage extends NodeEventEmitter {
  4574. // Docs: https://electronjs.org/docs/api/incoming-message
  4575. /**
  4576. * Emitted when a request has been canceled during an ongoing HTTP transaction.
  4577. */
  4578. on(event: 'aborted', listener: Function): this;
  4579. once(event: 'aborted', listener: Function): this;
  4580. addListener(event: 'aborted', listener: Function): this;
  4581. removeListener(event: 'aborted', listener: Function): this;
  4582. /**
  4583. * The `data` event is the usual method of transferring response data into
  4584. * applicative code.
  4585. */
  4586. on(event: 'data', listener: (
  4587. /**
  4588. * A chunk of response body's data.
  4589. */
  4590. chunk: Buffer) => void): this;
  4591. once(event: 'data', listener: (
  4592. /**
  4593. * A chunk of response body's data.
  4594. */
  4595. chunk: Buffer) => void): this;
  4596. addListener(event: 'data', listener: (
  4597. /**
  4598. * A chunk of response body's data.
  4599. */
  4600. chunk: Buffer) => void): this;
  4601. removeListener(event: 'data', listener: (
  4602. /**
  4603. * A chunk of response body's data.
  4604. */
  4605. chunk: Buffer) => void): this;
  4606. /**
  4607. * Indicates that response body has ended.
  4608. */
  4609. on(event: 'end', listener: Function): this;
  4610. once(event: 'end', listener: Function): this;
  4611. addListener(event: 'end', listener: Function): this;
  4612. removeListener(event: 'end', listener: Function): this;
  4613. /**
  4614. * Returns:
  4615. *
  4616. * `error` Error - Typically holds an error string identifying failure root cause.
  4617. *
  4618. * Emitted when an error was encountered while streaming response data events. For
  4619. * instance, if the server closes the underlying while the response is still
  4620. * streaming, an `error` event will be emitted on the response object and a `close`
  4621. * event will subsequently follow on the request object.
  4622. */
  4623. on(event: 'error', listener: Function): this;
  4624. once(event: 'error', listener: Function): this;
  4625. addListener(event: 'error', listener: Function): this;
  4626. removeListener(event: 'error', listener: Function): this;
  4627. headers: Record<string, (string) | (string[])>;
  4628. httpVersion: string;
  4629. httpVersionMajor: number;
  4630. httpVersionMinor: number;
  4631. statusCode: number;
  4632. statusMessage: string;
  4633. }
  4634. interface InputEvent {
  4635. // Docs: https://electronjs.org/docs/api/structures/input-event
  4636. /**
  4637. * An array of modifiers of the event, can be `shift`, `control`, `ctrl`, `alt`,
  4638. * `meta`, `command`, `cmd`, `isKeypad`, `isAutoRepeat`, `leftButtonDown`,
  4639. * `middleButtonDown`, `rightButtonDown`, `capsLock`, `numLock`, `left`, `right`.
  4640. */
  4641. modifiers?: Array<'shift' | 'control' | 'ctrl' | 'alt' | 'meta' | 'command' | 'cmd' | 'isKeypad' | 'isAutoRepeat' | 'leftButtonDown' | 'middleButtonDown' | 'rightButtonDown' | 'capsLock' | 'numLock' | 'left' | 'right'>;
  4642. }
  4643. interface IOCounters {
  4644. // Docs: https://electronjs.org/docs/api/structures/io-counters
  4645. /**
  4646. * Then number of I/O other operations.
  4647. */
  4648. otherOperationCount: number;
  4649. /**
  4650. * Then number of I/O other transfers.
  4651. */
  4652. otherTransferCount: number;
  4653. /**
  4654. * The number of I/O read operations.
  4655. */
  4656. readOperationCount: number;
  4657. /**
  4658. * The number of I/O read transfers.
  4659. */
  4660. readTransferCount: number;
  4661. /**
  4662. * The number of I/O write operations.
  4663. */
  4664. writeOperationCount: number;
  4665. /**
  4666. * The number of I/O write transfers.
  4667. */
  4668. writeTransferCount: number;
  4669. }
  4670. interface IpcMain extends NodeJS.EventEmitter {
  4671. // Docs: https://electronjs.org/docs/api/ipc-main
  4672. /**
  4673. * Adds a handler for an `invoke`able IPC. This handler will be called whenever a
  4674. * renderer calls `ipcRenderer.invoke(channel, ...args)`.
  4675. *
  4676. * If `listener` returns a Promise, the eventual result of the promise will be
  4677. * returned as a reply to the remote caller. Otherwise, the return value of the
  4678. * listener will be used as the value of the reply.
  4679. *
  4680. * The `event` that is passed as the first argument to the handler is the same as
  4681. * that passed to a regular event listener. It includes information about which
  4682. * WebContents is the source of the invoke request.
  4683. */
  4684. handle(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<void>) | (any)): void;
  4685. /**
  4686. * Handles a single `invoke`able IPC message, then removes the listener. See
  4687. * `ipcMain.handle(channel, listener)`.
  4688. */
  4689. handleOnce(channel: string, listener: (event: IpcMainInvokeEvent, ...args: any[]) => (Promise<void>) | (any)): void;
  4690. /**
  4691. * Listens to `channel`, when a new message arrives `listener` would be called with
  4692. * `listener(event, args...)`.
  4693. */
  4694. on(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
  4695. /**
  4696. * Adds a one time `listener` function for the event. This `listener` is invoked
  4697. * only the next time a message is sent to `channel`, after which it is removed.
  4698. */
  4699. once(channel: string, listener: (event: IpcMainEvent, ...args: any[]) => void): this;
  4700. /**
  4701. * Removes listeners of the specified `channel`.
  4702. */
  4703. removeAllListeners(channel?: string): this;
  4704. /**
  4705. * Removes any handler for `channel`, if present.
  4706. */
  4707. removeHandler(channel: string): void;
  4708. /**
  4709. * Removes the specified `listener` from the listener array for the specified
  4710. * `channel`.
  4711. */
  4712. removeListener(channel: string, listener: (...args: any[]) => void): this;
  4713. }
  4714. interface IpcMainEvent extends Event {
  4715. // Docs: https://electronjs.org/docs/api/structures/ipc-main-event
  4716. /**
  4717. * The ID of the renderer frame that sent this message
  4718. */
  4719. frameId: number;
  4720. /**
  4721. * A list of MessagePorts that were transferred with this message
  4722. */
  4723. ports: MessagePortMain[];
  4724. /**
  4725. * The internal ID of the renderer process that sent this message
  4726. */
  4727. processId: number;
  4728. /**
  4729. * A function that will send an IPC message to the renderer frame that sent the
  4730. * original message that you are currently handling. You should use this method to
  4731. * "reply" to the sent message in order to guarantee the reply will go to the
  4732. * correct process and frame.
  4733. */
  4734. reply: Function;
  4735. /**
  4736. * Set this to the value to be returned in a synchronous message
  4737. */
  4738. returnValue: any;
  4739. /**
  4740. * Returns the `webContents` that sent the message
  4741. */
  4742. sender: WebContents;
  4743. }
  4744. interface IpcMainInvokeEvent extends Event {
  4745. // Docs: https://electronjs.org/docs/api/structures/ipc-main-invoke-event
  4746. /**
  4747. * The ID of the renderer frame that sent this message
  4748. */
  4749. frameId: number;
  4750. /**
  4751. * The internal ID of the renderer process that sent this message
  4752. */
  4753. processId: number;
  4754. /**
  4755. * Returns the `webContents` that sent the message
  4756. */
  4757. sender: WebContents;
  4758. }
  4759. interface IpcRenderer extends NodeJS.EventEmitter {
  4760. // Docs: https://electronjs.org/docs/api/ipc-renderer
  4761. /**
  4762. * Resolves with the response from the main process.
  4763. *
  4764. * Send a message to the main process via `channel` and expect a result
  4765. * asynchronously. Arguments will be serialized with the Structured Clone
  4766. * Algorithm, just like `window.postMessage`, so prototype chains will not be
  4767. * included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw
  4768. * an exception.
  4769. *
  4770. * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
  4771. * Electron objects is deprecated, and will begin throwing an exception starting
  4772. * with Electron 9.
  4773. *
  4774. * The main process should listen for `channel` with `ipcMain.handle()`.
  4775. *
  4776. * For example:
  4777. *
  4778. * If you need to transfer a `MessagePort` to the main process, use
  4779. * `ipcRenderer.postMessage`.
  4780. *
  4781. * If you do not need a response to the message, consider using `ipcRenderer.send`.
  4782. */
  4783. invoke(channel: string, ...args: any[]): Promise<any>;
  4784. /**
  4785. * Listens to `channel`, when a new message arrives `listener` would be called with
  4786. * `listener(event, args...)`.
  4787. */
  4788. on(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
  4789. /**
  4790. * Adds a one time `listener` function for the event. This `listener` is invoked
  4791. * only the next time a message is sent to `channel`, after which it is removed.
  4792. */
  4793. once(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): this;
  4794. /**
  4795. * Send a message to the main process, optionally transferring ownership of zero or
  4796. * more `MessagePort` objects.
  4797. *
  4798. * The transferred `MessagePort` objects will be available in the main process as
  4799. * `MessagePortMain` objects by accessing the `ports` property of the emitted
  4800. * event.
  4801. *
  4802. * For example:
  4803. *
  4804. * For more information on using `MessagePort` and `MessageChannel`, see the MDN
  4805. * documentation.
  4806. */
  4807. postMessage(channel: string, message: any, transfer?: MessagePort[]): void;
  4808. /**
  4809. * Removes all listeners, or those of the specified `channel`.
  4810. */
  4811. removeAllListeners(channel: string): this;
  4812. /**
  4813. * Removes the specified `listener` from the listener array for the specified
  4814. * `channel`.
  4815. */
  4816. removeListener(channel: string, listener: (...args: any[]) => void): this;
  4817. /**
  4818. * Send an asynchronous message to the main process via `channel`, along with
  4819. * arguments. Arguments will be serialized with the Structured Clone Algorithm,
  4820. * just like `window.postMessage`, so prototype chains will not be included.
  4821. * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
  4822. * exception.
  4823. *
  4824. * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
  4825. * Electron objects is deprecated, and will begin throwing an exception starting
  4826. * with Electron 9.
  4827. *
  4828. * The main process handles it by listening for `channel` with the `ipcMain`
  4829. * module.
  4830. *
  4831. * If you need to transfer a `MessagePort` to the main process, use
  4832. * `ipcRenderer.postMessage`.
  4833. *
  4834. * If you want to receive a single response from the main process, like the result
  4835. * of a method call, consider using `ipcRenderer.invoke`.
  4836. */
  4837. send(channel: string, ...args: any[]): void;
  4838. /**
  4839. * The value sent back by the `ipcMain` handler.
  4840. *
  4841. * Send a message to the main process via `channel` and expect a result
  4842. * synchronously. Arguments will be serialized with the Structured Clone Algorithm,
  4843. * just like `window.postMessage`, so prototype chains will not be included.
  4844. * Sending Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an
  4845. * exception.
  4846. *
  4847. * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
  4848. * Electron objects is deprecated, and will begin throwing an exception starting
  4849. * with Electron 9.
  4850. *
  4851. * The main process handles it by listening for `channel` with `ipcMain` module,
  4852. * and replies by setting `event.returnValue`.
  4853. *
  4854. * > :warning: **WARNING**: Sending a synchronous message will block the whole
  4855. * renderer process until the reply is received, so use this method only as a last
  4856. * resort. It's much better to use the asynchronous version, `invoke()`.
  4857. */
  4858. sendSync(channel: string, ...args: any[]): any;
  4859. /**
  4860. * Sends a message to a window with `webContentsId` via `channel`.
  4861. */
  4862. sendTo(webContentsId: number, channel: string, ...args: any[]): void;
  4863. /**
  4864. * Like `ipcRenderer.send` but the event will be sent to the `<webview>` element in
  4865. * the host page instead of the main process.
  4866. */
  4867. sendToHost(channel: string, ...args: any[]): void;
  4868. }
  4869. interface IpcRendererEvent extends Event {
  4870. // Docs: https://electronjs.org/docs/api/structures/ipc-renderer-event
  4871. /**
  4872. * A list of MessagePorts that were transferred with this message
  4873. */
  4874. ports: MessagePort[];
  4875. /**
  4876. * The `IpcRenderer` instance that emitted the event originally
  4877. */
  4878. sender: IpcRenderer;
  4879. /**
  4880. * The `webContents.id` that sent the message, you can call
  4881. * `event.sender.sendTo(event.senderId, ...)` to reply to the message, see
  4882. * ipcRenderer.sendTo for more information. This only applies to messages sent from
  4883. * a different renderer. Messages sent directly from the main process set
  4884. * `event.senderId` to `0`.
  4885. */
  4886. senderId: number;
  4887. }
  4888. interface JumpListCategory {
  4889. // Docs: https://electronjs.org/docs/api/structures/jump-list-category
  4890. /**
  4891. * Array of `JumpListItem` objects if `type` is `tasks` or `custom`, otherwise it
  4892. * should be omitted.
  4893. */
  4894. items?: JumpListItem[];
  4895. /**
  4896. * Must be set if `type` is `custom`, otherwise it should be omitted.
  4897. */
  4898. name?: string;
  4899. /**
  4900. * One of the following:
  4901. */
  4902. type?: ('tasks' | 'frequent' | 'recent' | 'custom');
  4903. }
  4904. interface JumpListItem {
  4905. // Docs: https://electronjs.org/docs/api/structures/jump-list-item
  4906. /**
  4907. * The command line arguments when `program` is executed. Should only be set if
  4908. * `type` is `task`.
  4909. */
  4910. args?: string;
  4911. /**
  4912. * Description of the task (displayed in a tooltip). Should only be set if `type`
  4913. * is `task`.
  4914. */
  4915. description?: string;
  4916. /**
  4917. * The index of the icon in the resource file. If a resource file contains multiple
  4918. * icons this value can be used to specify the zero-based index of the icon that
  4919. * should be displayed for this task. If a resource file contains only one icon,
  4920. * this property should be set to zero.
  4921. */
  4922. iconIndex?: number;
  4923. /**
  4924. * The absolute path to an icon to be displayed in a Jump List, which can be an
  4925. * arbitrary resource file that contains an icon (e.g. `.ico`, `.exe`, `.dll`). You
  4926. * can usually specify `process.execPath` to show the program icon.
  4927. */
  4928. iconPath?: string;
  4929. /**
  4930. * Path of the file to open, should only be set if `type` is `file`.
  4931. */
  4932. path?: string;
  4933. /**
  4934. * Path of the program to execute, usually you should specify `process.execPath`
  4935. * which opens the current program. Should only be set if `type` is `task`.
  4936. */
  4937. program?: string;
  4938. /**
  4939. * The text to be displayed for the item in the Jump List. Should only be set if
  4940. * `type` is `task`.
  4941. */
  4942. title?: string;
  4943. /**
  4944. * One of the following:
  4945. */
  4946. type?: ('task' | 'separator' | 'file');
  4947. /**
  4948. * The working directory. Default is empty.
  4949. */
  4950. workingDirectory?: string;
  4951. }
  4952. interface KeyboardEvent {
  4953. // Docs: https://electronjs.org/docs/api/structures/keyboard-event
  4954. /**
  4955. * whether an Alt key was used in an accelerator to trigger the Event
  4956. */
  4957. altKey?: boolean;
  4958. /**
  4959. * whether the Control key was used in an accelerator to trigger the Event
  4960. */
  4961. ctrlKey?: boolean;
  4962. /**
  4963. * whether a meta key was used in an accelerator to trigger the Event
  4964. */
  4965. metaKey?: boolean;
  4966. /**
  4967. * whether a Shift key was used in an accelerator to trigger the Event
  4968. */
  4969. shiftKey?: boolean;
  4970. /**
  4971. * whether an accelerator was used to trigger the event as opposed to another user
  4972. * gesture like mouse click
  4973. */
  4974. triggeredByAccelerator?: boolean;
  4975. }
  4976. interface KeyboardInputEvent extends InputEvent {
  4977. // Docs: https://electronjs.org/docs/api/structures/keyboard-input-event
  4978. /**
  4979. * The character that will be sent as the keyboard event. Should only use the valid
  4980. * key codes in Accelerator.
  4981. */
  4982. keyCode: string;
  4983. /**
  4984. * The type of the event, can be `keyDown`, `keyUp` or `char`.
  4985. */
  4986. type: ('keyDown' | 'keyUp' | 'char');
  4987. }
  4988. interface MemoryInfo {
  4989. // Docs: https://electronjs.org/docs/api/structures/memory-info
  4990. /**
  4991. * The maximum amount of memory that has ever been pinned to actual physical RAM.
  4992. */
  4993. peakWorkingSetSize: number;
  4994. /**
  4995. * The amount of memory not shared by other processes, such as JS heap or HTML
  4996. * content.
  4997. *
  4998. * @platform win32
  4999. */
  5000. privateBytes?: number;
  5001. /**
  5002. * The amount of memory currently pinned to actual physical RAM.
  5003. */
  5004. workingSetSize: number;
  5005. }
  5006. interface MemoryUsageDetails {
  5007. // Docs: https://electronjs.org/docs/api/structures/memory-usage-details
  5008. count: number;
  5009. liveSize: number;
  5010. size: number;
  5011. }
  5012. class Menu {
  5013. // Docs: https://electronjs.org/docs/api/menu
  5014. /**
  5015. * Emitted when a popup is closed either manually or with `menu.closePopup()`.
  5016. */
  5017. on(event: 'menu-will-close', listener: (event: Event) => void): this;
  5018. once(event: 'menu-will-close', listener: (event: Event) => void): this;
  5019. addListener(event: 'menu-will-close', listener: (event: Event) => void): this;
  5020. removeListener(event: 'menu-will-close', listener: (event: Event) => void): this;
  5021. /**
  5022. * Emitted when `menu.popup()` is called.
  5023. */
  5024. on(event: 'menu-will-show', listener: (event: Event) => void): this;
  5025. once(event: 'menu-will-show', listener: (event: Event) => void): this;
  5026. addListener(event: 'menu-will-show', listener: (event: Event) => void): this;
  5027. removeListener(event: 'menu-will-show', listener: (event: Event) => void): this;
  5028. /**
  5029. * Menu
  5030. */
  5031. constructor();
  5032. /**
  5033. * Generally, the `template` is an array of `options` for constructing a MenuItem.
  5034. * The usage can be referenced above.
  5035. *
  5036. * You can also attach other fields to the element of the `template` and they will
  5037. * become properties of the constructed menu items.
  5038. */
  5039. static buildFromTemplate(template: Array<(MenuItemConstructorOptions) | (MenuItem)>): Menu;
  5040. /**
  5041. * The application menu, if set, or `null`, if not set.
  5042. *
  5043. * **Note:** The returned `Menu` instance doesn't support dynamic addition or
  5044. * removal of menu items. Instance properties can still be dynamically modified.
  5045. */
  5046. static getApplicationMenu(): (Menu) | (null);
  5047. /**
  5048. * Sends the `action` to the first responder of application. This is used for
  5049. * emulating default macOS menu behaviors. Usually you would use the `role`
  5050. * property of a `MenuItem`.
  5051. *
  5052. * See the macOS Cocoa Event Handling Guide for more information on macOS' native
  5053. * actions.
  5054. *
  5055. * @platform darwin
  5056. */
  5057. static sendActionToFirstResponder(action: string): void;
  5058. /**
  5059. * Sets `menu` as the application menu on macOS. On Windows and Linux, the `menu`
  5060. * will be set as each window's top menu.
  5061. *
  5062. * Also on Windows and Linux, you can use a `&` in the top-level item name to
  5063. * indicate which letter should get a generated accelerator. For example, using
  5064. * `&File` for the file menu would result in a generated `Alt-F` accelerator that
  5065. * opens the associated menu. The indicated character in the button label gets an
  5066. * underline. The `&` character is not displayed on the button label.
  5067. *
  5068. * Passing `null` will suppress the default menu. On Windows and Linux, this has
  5069. * the additional effect of removing the menu bar from the window.
  5070. *
  5071. * **Note:** The default menu will be created automatically if the app does not set
  5072. * one. It contains standard items such as `File`, `Edit`, `View`, `Window` and
  5073. * `Help`.
  5074. */
  5075. static setApplicationMenu(menu: (Menu) | (null)): void;
  5076. /**
  5077. * Appends the `menuItem` to the menu.
  5078. */
  5079. append(menuItem: MenuItem): void;
  5080. /**
  5081. * Closes the context menu in the `browserWindow`.
  5082. */
  5083. closePopup(browserWindow?: BrowserWindow): void;
  5084. /**
  5085. * the item with the specified `id`
  5086. */
  5087. getMenuItemById(id: string): (MenuItem) | (null);
  5088. /**
  5089. * Inserts the `menuItem` to the `pos` position of the menu.
  5090. */
  5091. insert(pos: number, menuItem: MenuItem): void;
  5092. /**
  5093. * Pops up this menu as a context menu in the `BrowserWindow`.
  5094. */
  5095. popup(options?: PopupOptions): void;
  5096. items: MenuItem[];
  5097. }
  5098. class MenuItem {
  5099. // Docs: https://electronjs.org/docs/api/menu-item
  5100. /**
  5101. * MenuItem
  5102. */
  5103. constructor(options: MenuItemConstructorOptions);
  5104. accelerator?: Accelerator;
  5105. checked: boolean;
  5106. click: Function;
  5107. commandId: number;
  5108. enabled: boolean;
  5109. icon?: (NativeImage) | (string);
  5110. id: string;
  5111. label: string;
  5112. menu: Menu;
  5113. registerAccelerator: boolean;
  5114. 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');
  5115. sublabel: string;
  5116. submenu?: Menu;
  5117. toolTip: string;
  5118. type: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
  5119. visible: boolean;
  5120. }
  5121. class MessageChannelMain extends NodeEventEmitter {
  5122. // Docs: https://electronjs.org/docs/api/message-channel-main
  5123. port1: MessagePortMain;
  5124. port2: MessagePortMain;
  5125. }
  5126. class MessagePortMain extends NodeEventEmitter {
  5127. // Docs: https://electronjs.org/docs/api/message-port-main
  5128. /**
  5129. * Emitted when the remote end of a MessagePortMain object becomes disconnected.
  5130. */
  5131. on(event: 'close', listener: Function): this;
  5132. once(event: 'close', listener: Function): this;
  5133. addListener(event: 'close', listener: Function): this;
  5134. removeListener(event: 'close', listener: Function): this;
  5135. /**
  5136. * Emitted when a MessagePortMain object receives a message.
  5137. */
  5138. on(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  5139. once(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  5140. addListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  5141. removeListener(event: 'message', listener: (messageEvent: MessageEvent) => void): this;
  5142. /**
  5143. * Disconnects the port, so it is no longer active.
  5144. */
  5145. close(): void;
  5146. /**
  5147. * Sends a message from the port, and optionally, transfers ownership of objects to
  5148. * other browsing contexts.
  5149. */
  5150. postMessage(message: any, transfer?: MessagePortMain[]): void;
  5151. /**
  5152. * Starts the sending of messages queued on the port. Messages will be queued until
  5153. * this method is called.
  5154. */
  5155. start(): void;
  5156. }
  5157. interface MimeTypedBuffer {
  5158. // Docs: https://electronjs.org/docs/api/structures/mime-typed-buffer
  5159. /**
  5160. * Charset of the buffer.
  5161. */
  5162. charset?: string;
  5163. /**
  5164. * The actual Buffer content.
  5165. */
  5166. data: Buffer;
  5167. /**
  5168. * MIME type of the buffer.
  5169. */
  5170. mimeType?: string;
  5171. }
  5172. interface MouseInputEvent extends InputEvent {
  5173. // Docs: https://electronjs.org/docs/api/structures/mouse-input-event
  5174. /**
  5175. * The button pressed, can be `left`, `middle`, `right`.
  5176. */
  5177. button?: ('left' | 'middle' | 'right');
  5178. clickCount?: number;
  5179. globalX?: number;
  5180. globalY?: number;
  5181. movementX?: number;
  5182. movementY?: number;
  5183. /**
  5184. * The type of the event, can be `mouseDown`, `mouseUp`, `mouseEnter`,
  5185. * `mouseLeave`, `contextMenu`, `mouseWheel` or `mouseMove`.
  5186. */
  5187. type: ('mouseDown' | 'mouseUp' | 'mouseEnter' | 'mouseLeave' | 'contextMenu' | 'mouseWheel' | 'mouseMove');
  5188. x: number;
  5189. y: number;
  5190. }
  5191. interface MouseWheelInputEvent extends MouseInputEvent {
  5192. // Docs: https://electronjs.org/docs/api/structures/mouse-wheel-input-event
  5193. accelerationRatioX?: number;
  5194. accelerationRatioY?: number;
  5195. canScroll?: boolean;
  5196. deltaX?: number;
  5197. deltaY?: number;
  5198. hasPreciseScrollingDeltas?: boolean;
  5199. /**
  5200. * The type of the event, can be `mouseWheel`.
  5201. */
  5202. type: ('mouseWheel');
  5203. wheelTicksX?: number;
  5204. wheelTicksY?: number;
  5205. }
  5206. class NativeImage {
  5207. // Docs: https://electronjs.org/docs/api/native-image
  5208. /**
  5209. * Creates an empty `NativeImage` instance.
  5210. */
  5211. static createEmpty(): NativeImage;
  5212. /**
  5213. * Creates a new `NativeImage` instance from `buffer` that contains the raw bitmap
  5214. * pixel data returned by `toBitmap()`. The specific format is platform-dependent.
  5215. */
  5216. static createFromBitmap(buffer: Buffer, options: CreateFromBitmapOptions): NativeImage;
  5217. /**
  5218. * Creates a new `NativeImage` instance from `buffer`. Tries to decode as PNG or
  5219. * JPEG first.
  5220. */
  5221. static createFromBuffer(buffer: Buffer, options?: CreateFromBufferOptions): NativeImage;
  5222. /**
  5223. * Creates a new `NativeImage` instance from `dataURL`.
  5224. */
  5225. static createFromDataURL(dataURL: string): NativeImage;
  5226. /**
  5227. * Creates a new `NativeImage` instance from the NSImage that maps to the given
  5228. * image name. See `System Icons` for a list of possible values.
  5229. *
  5230. * The `hslShift` is applied to the image with the following rules:
  5231. *
  5232. * * `hsl_shift[0]` (hue): The absolute hue value for the image - 0 and 1 map to 0
  5233. * and 360 on the hue color wheel (red).
  5234. * * `hsl_shift[1]` (saturation): A saturation shift for the image, with the
  5235. * following key values: 0 = remove all color. 0.5 = leave unchanged. 1 = fully
  5236. * saturate the image.
  5237. * * `hsl_shift[2]` (lightness): A lightness shift for the image, with the
  5238. * following key values: 0 = remove all lightness (make all pixels black). 0.5 =
  5239. * leave unchanged. 1 = full lightness (make all pixels white).
  5240. *
  5241. * This means that `[-1, 0, 1]` will make the image completely white and `[-1, 1,
  5242. * 0]` will make the image completely black.
  5243. *
  5244. * In some cases, the `NSImageName` doesn't match its string representation; one
  5245. * example of this is `NSFolderImageName`, whose string representation would
  5246. * actually be `NSFolder`. Therefore, you'll need to determine the correct string
  5247. * representation for your image before passing it in. This can be done with the
  5248. * following:
  5249. *
  5250. * `echo -e '#import <Cocoa/Cocoa.h>\nint main() { NSLog(@"%@", SYSTEM_IMAGE_NAME);
  5251. * }' | clang -otest -x objective-c -framework Cocoa - && ./test`
  5252. *
  5253. where `SYSTEM_IMAGE_NAME` should be replaced with any value from this list.
  5254. *
  5255. * @platform darwin
  5256. */
  5257. static createFromNamedImage(imageName: string, hslShift?: number[]): NativeImage;
  5258. /**
  5259. * Creates a new `NativeImage` instance from a file located at `path`. This method
  5260. * returns an empty image if the `path` does not exist, cannot be read, or is not a
  5261. * valid image.
  5262. */
  5263. static createFromPath(path: string): NativeImage;
  5264. /**
  5265. * fulfilled with the file's thumbnail preview image, which is a NativeImage.
  5266. *
  5267. * @platform darwin,win32
  5268. */
  5269. static createThumbnailFromPath(path: string, maxSize: Size): Promise<Electron.NativeImage>;
  5270. /**
  5271. * Add an image representation for a specific scale factor. This can be used to
  5272. * explicitly add different scale factor representations to an image. This can be
  5273. * called on empty images.
  5274. */
  5275. addRepresentation(options: AddRepresentationOptions): void;
  5276. /**
  5277. * The cropped image.
  5278. */
  5279. crop(rect: Rectangle): NativeImage;
  5280. /**
  5281. * The image's aspect ratio.
  5282. *
  5283. * If `scaleFactor` is passed, this will return the aspect ratio corresponding to
  5284. * the image representation most closely matching the passed value.
  5285. */
  5286. getAspectRatio(scaleFactor?: number): number;
  5287. /**
  5288. * A Buffer that contains the image's raw bitmap pixel data.
  5289. *
  5290. * The difference between `getBitmap()` and `toBitmap()` is that `getBitmap()` does
  5291. * not copy the bitmap data, so you have to use the returned Buffer immediately in
  5292. * current event loop tick; otherwise the data might be changed or destroyed.
  5293. */
  5294. getBitmap(options?: BitmapOptions): Buffer;
  5295. /**
  5296. * A Buffer that stores C pointer to underlying native handle of the image. On
  5297. * macOS, a pointer to `NSImage` instance would be returned.
  5298. *
  5299. * Notice that the returned pointer is a weak pointer to the underlying native
  5300. * image instead of a copy, so you _must_ ensure that the associated `nativeImage`
  5301. * instance is kept around.
  5302. *
  5303. * @platform darwin
  5304. */
  5305. getNativeHandle(): Buffer;
  5306. /**
  5307. * An array of all scale factors corresponding to representations for a given
  5308. * nativeImage.
  5309. */
  5310. getScaleFactors(): number[];
  5311. /**
  5312. * If `scaleFactor` is passed, this will return the size corresponding to the image
  5313. * representation most closely matching the passed value.
  5314. */
  5315. getSize(scaleFactor?: number): Size;
  5316. /**
  5317. * Whether the image is empty.
  5318. */
  5319. isEmpty(): boolean;
  5320. /**
  5321. * Whether the image is a template image.
  5322. */
  5323. isTemplateImage(): boolean;
  5324. /**
  5325. * The resized image.
  5326. *
  5327. * If only the `height` or the `width` are specified then the current aspect ratio
  5328. * will be preserved in the resized image.
  5329. */
  5330. resize(options: ResizeOptions): NativeImage;
  5331. /**
  5332. * Marks the image as a template image.
  5333. */
  5334. setTemplateImage(option: boolean): void;
  5335. /**
  5336. * A Buffer that contains a copy of the image's raw bitmap pixel data.
  5337. */
  5338. toBitmap(options?: ToBitmapOptions): Buffer;
  5339. /**
  5340. * The data URL of the image.
  5341. */
  5342. toDataURL(options?: ToDataURLOptions): string;
  5343. /**
  5344. * A Buffer that contains the image's `JPEG` encoded data.
  5345. */
  5346. toJPEG(quality: number): Buffer;
  5347. /**
  5348. * A Buffer that contains the image's `PNG` encoded data.
  5349. */
  5350. toPNG(options?: ToPNGOptions): Buffer;
  5351. isMacTemplateImage: boolean;
  5352. }
  5353. interface NativeTheme extends NodeJS.EventEmitter {
  5354. // Docs: https://electronjs.org/docs/api/native-theme
  5355. /**
  5356. * Emitted when something in the underlying NativeTheme has changed. This normally
  5357. * means that either the value of `shouldUseDarkColors`,
  5358. * `shouldUseHighContrastColors` or `shouldUseInvertedColorScheme` has changed. You
  5359. * will have to check them to determine which one has changed.
  5360. */
  5361. on(event: 'updated', listener: Function): this;
  5362. once(event: 'updated', listener: Function): this;
  5363. addListener(event: 'updated', listener: Function): this;
  5364. removeListener(event: 'updated', listener: Function): this;
  5365. /**
  5366. * A `Boolean` for if the OS / Chromium currently has a dark mode enabled or is
  5367. * being instructed to show a dark-style UI. If you want to modify this value you
  5368. * should use `themeSource` below.
  5369. *
  5370. */
  5371. readonly shouldUseDarkColors: boolean;
  5372. /**
  5373. * A `Boolean` for if the OS / Chromium currently has high-contrast mode enabled or
  5374. * is being instructed to show a high-contrast UI.
  5375. *
  5376. * @platform darwin,win32
  5377. */
  5378. readonly shouldUseHighContrastColors: boolean;
  5379. /**
  5380. * A `Boolean` for if the OS / Chromium currently has an inverted color scheme or
  5381. * is being instructed to use an inverted color scheme.
  5382. *
  5383. * @platform darwin,win32
  5384. */
  5385. readonly shouldUseInvertedColorScheme: boolean;
  5386. /**
  5387. * A `String` property that can be `system`, `light` or `dark`. It is used to
  5388. * override and supersede the value that Chromium has chosen to use internally.
  5389. *
  5390. * Setting this property to `system` will remove the override and everything will
  5391. * be reset to the OS default. By default `themeSource` is `system`.
  5392. *
  5393. * Settings this property to `dark` will have the following effects:
  5394. *
  5395. * * `nativeTheme.shouldUseDarkColors` will be `true` when accessed
  5396. * * Any UI Electron renders on Linux and Windows including context menus,
  5397. * devtools, etc. will use the dark UI.
  5398. * * Any UI the OS renders on macOS including menus, window frames, etc. will use
  5399. * the dark UI.
  5400. * * The `prefers-color-scheme` CSS query will match `dark` mode.
  5401. * * The `updated` event will be emitted
  5402. *
  5403. * Settings this property to `light` will have the following effects:
  5404. *
  5405. * * `nativeTheme.shouldUseDarkColors` will be `false` when accessed
  5406. * * Any UI Electron renders on Linux and Windows including context menus,
  5407. * devtools, etc. will use the light UI.
  5408. * * Any UI the OS renders on macOS including menus, window frames, etc. will use
  5409. * the light UI.
  5410. * * The `prefers-color-scheme` CSS query will match `light` mode.
  5411. * * The `updated` event will be emitted
  5412. *
  5413. * The usage of this property should align with a classic "dark mode" state machine
  5414. * in your application where the user has three options.
  5415. *
  5416. * * `Follow OS` --> `themeSource = 'system'`
  5417. * * `Dark Mode` --> `themeSource = 'dark'`
  5418. * * `Light Mode` --> `themeSource = 'light'`
  5419. *
  5420. * Your application should then always use `shouldUseDarkColors` to determine what
  5421. * CSS to apply.
  5422. */
  5423. themeSource: ('system' | 'light' | 'dark');
  5424. }
  5425. interface Net {
  5426. // Docs: https://electronjs.org/docs/api/net
  5427. /**
  5428. * Creates a `ClientRequest` instance using the provided `options` which are
  5429. * directly forwarded to the `ClientRequest` constructor. The `net.request` method
  5430. * would be used to issue both secure and insecure HTTP requests according to the
  5431. * specified protocol scheme in the `options` object.
  5432. */
  5433. request(options: (ClientRequestConstructorOptions) | (string)): ClientRequest;
  5434. }
  5435. interface NetLog {
  5436. // Docs: https://electronjs.org/docs/api/net-log
  5437. /**
  5438. * resolves when the net log has begun recording.
  5439. *
  5440. Starts recording network events to `path`.
  5441. */
  5442. startLogging(path: string, options?: StartLoggingOptions): Promise<void>;
  5443. /**
  5444. * resolves when the net log has been flushed to disk.
  5445. *
  5446. * Stops recording network events. If not called, net logging will automatically
  5447. * end when app quits.
  5448. */
  5449. stopLogging(): Promise<void>;
  5450. /**
  5451. * A `Boolean` property that indicates whether network logs are currently being
  5452. * recorded.
  5453. *
  5454. */
  5455. readonly currentlyLogging: boolean;
  5456. }
  5457. interface NewWindowWebContentsEvent extends Event {
  5458. // Docs: https://electronjs.org/docs/api/structures/new-window-web-contents-event
  5459. newGuest?: BrowserWindow;
  5460. }
  5461. class Notification extends NodeEventEmitter {
  5462. // Docs: https://electronjs.org/docs/api/notification
  5463. on(event: 'action', listener: (event: Event,
  5464. /**
  5465. * The index of the action that was activated.
  5466. */
  5467. index: number) => void): this;
  5468. once(event: 'action', listener: (event: Event,
  5469. /**
  5470. * The index of the action that was activated.
  5471. */
  5472. index: number) => void): this;
  5473. addListener(event: 'action', listener: (event: Event,
  5474. /**
  5475. * The index of the action that was activated.
  5476. */
  5477. index: number) => void): this;
  5478. removeListener(event: 'action', listener: (event: Event,
  5479. /**
  5480. * The index of the action that was activated.
  5481. */
  5482. index: number) => void): this;
  5483. /**
  5484. * Emitted when the notification is clicked by the user.
  5485. */
  5486. on(event: 'click', listener: (event: Event) => void): this;
  5487. once(event: 'click', listener: (event: Event) => void): this;
  5488. addListener(event: 'click', listener: (event: Event) => void): this;
  5489. removeListener(event: 'click', listener: (event: Event) => void): this;
  5490. /**
  5491. * Emitted when the notification is closed by manual intervention from the user.
  5492. *
  5493. * This event is not guaranteed to be emitted in all cases where the notification
  5494. * is closed.
  5495. */
  5496. on(event: 'close', listener: (event: Event) => void): this;
  5497. once(event: 'close', listener: (event: Event) => void): this;
  5498. addListener(event: 'close', listener: (event: Event) => void): this;
  5499. removeListener(event: 'close', listener: (event: Event) => void): this;
  5500. /**
  5501. * Emitted when the user clicks the "Reply" button on a notification with
  5502. * `hasReply: true`.
  5503. *
  5504. * @platform darwin
  5505. */
  5506. on(event: 'reply', listener: (event: Event,
  5507. /**
  5508. * The string the user entered into the inline reply field.
  5509. */
  5510. reply: string) => void): this;
  5511. once(event: 'reply', listener: (event: Event,
  5512. /**
  5513. * The string the user entered into the inline reply field.
  5514. */
  5515. reply: string) => void): this;
  5516. addListener(event: 'reply', listener: (event: Event,
  5517. /**
  5518. * The string the user entered into the inline reply field.
  5519. */
  5520. reply: string) => void): this;
  5521. removeListener(event: 'reply', listener: (event: Event,
  5522. /**
  5523. * The string the user entered into the inline reply field.
  5524. */
  5525. reply: string) => void): this;
  5526. /**
  5527. * Emitted when the notification is shown to the user, note this could be fired
  5528. * multiple times as a notification can be shown multiple times through the
  5529. * `show()` method.
  5530. */
  5531. on(event: 'show', listener: (event: Event) => void): this;
  5532. once(event: 'show', listener: (event: Event) => void): this;
  5533. addListener(event: 'show', listener: (event: Event) => void): this;
  5534. removeListener(event: 'show', listener: (event: Event) => void): this;
  5535. /**
  5536. * Notification
  5537. */
  5538. constructor(options?: NotificationConstructorOptions);
  5539. /**
  5540. * Whether or not desktop notifications are supported on the current system
  5541. */
  5542. static isSupported(): boolean;
  5543. /**
  5544. * Dismisses the notification.
  5545. */
  5546. close(): void;
  5547. /**
  5548. * Immediately shows the notification to the user, please note this means unlike
  5549. * the HTML5 Notification implementation, instantiating a `new Notification` does
  5550. * not immediately show it to the user, you need to call this method before the OS
  5551. * will display it.
  5552. *
  5553. * If the notification has been shown before, this method will dismiss the
  5554. * previously shown notification and create a new one with identical properties.
  5555. */
  5556. show(): void;
  5557. actions: NotificationAction[];
  5558. body: string;
  5559. closeButtonText: string;
  5560. hasReply: boolean;
  5561. replyPlaceholder: string;
  5562. silent: boolean;
  5563. sound: string;
  5564. subtitle: string;
  5565. timeoutType: ('default' | 'never');
  5566. title: string;
  5567. urgency: ('normal' | 'critical' | 'low');
  5568. }
  5569. interface NotificationAction {
  5570. // Docs: https://electronjs.org/docs/api/structures/notification-action
  5571. /**
  5572. * The label for the given action.
  5573. */
  5574. text?: string;
  5575. /**
  5576. * The type of action, can be `button`.
  5577. */
  5578. type: ('button');
  5579. }
  5580. interface Point {
  5581. // Docs: https://electronjs.org/docs/api/structures/point
  5582. x: number;
  5583. y: number;
  5584. }
  5585. interface PostBody {
  5586. // Docs: https://electronjs.org/docs/api/structures/post-body
  5587. /**
  5588. * The boundary used to separate multiple parts of the message. Only valid when
  5589. * `contentType` is `multipart/form-data`.
  5590. */
  5591. boundary?: string;
  5592. /**
  5593. * The `content-type` header used for the data. One of
  5594. * `application/x-www-form-urlencoded` or `multipart/form-data`. Corresponds to the
  5595. * `enctype` attribute of the submitted HTML form.
  5596. */
  5597. contentType: string;
  5598. /**
  5599. * The post data to be sent to the new window.
  5600. */
  5601. data: Array<PostData>;
  5602. }
  5603. interface PostData {
  5604. // Docs: https://electronjs.org/docs/api/structures/post-data
  5605. /**
  5606. * The `UUID` of the `Blob` being uploaded. Required for the `blob` type.
  5607. */
  5608. blobUUID?: string;
  5609. /**
  5610. * The raw bytes of the post data in a `Buffer`. Required for the `rawData` type.
  5611. */
  5612. bytes?: string;
  5613. /**
  5614. * The path of the file being uploaded. Required for the `file` type.
  5615. */
  5616. filePath?: string;
  5617. /**
  5618. * The length of the file being uploaded, in bytes. If set to `-1`, the whole file
  5619. * will be uploaded. Only valid for `file` types.
  5620. */
  5621. length?: number;
  5622. /**
  5623. * The modification time of the file represented by a double, which is the number
  5624. * of seconds since the `UNIX Epoch` (Jan 1, 1970). Only valid for `file` types.
  5625. */
  5626. modificationTime?: number;
  5627. /**
  5628. * The offset from the beginning of the file being uploaded, in bytes. Only valid
  5629. * for `file` types.
  5630. */
  5631. offset?: number;
  5632. /**
  5633. * One of the following:
  5634. */
  5635. type: ('rawData' | 'file' | 'blob');
  5636. }
  5637. interface PowerMonitor extends NodeJS.EventEmitter {
  5638. // Docs: https://electronjs.org/docs/api/power-monitor
  5639. /**
  5640. * Emitted when the system is about to lock the screen.
  5641. *
  5642. * @platform darwin,win32
  5643. */
  5644. on(event: 'lock-screen', listener: Function): this;
  5645. once(event: 'lock-screen', listener: Function): this;
  5646. addListener(event: 'lock-screen', listener: Function): this;
  5647. removeListener(event: 'lock-screen', listener: Function): this;
  5648. /**
  5649. * Emitted when the system changes to AC power.
  5650. *
  5651. * @platform darwin,win32
  5652. */
  5653. on(event: 'on-ac', listener: Function): this;
  5654. once(event: 'on-ac', listener: Function): this;
  5655. addListener(event: 'on-ac', listener: Function): this;
  5656. removeListener(event: 'on-ac', listener: Function): this;
  5657. /**
  5658. * Emitted when system changes to battery power.
  5659. *
  5660. * @platform darwin
  5661. */
  5662. on(event: 'on-battery', listener: Function): this;
  5663. once(event: 'on-battery', listener: Function): this;
  5664. addListener(event: 'on-battery', listener: Function): this;
  5665. removeListener(event: 'on-battery', listener: Function): this;
  5666. /**
  5667. * Emitted when system is resuming.
  5668. *
  5669. * @platform darwin,win32
  5670. */
  5671. on(event: 'resume', listener: Function): this;
  5672. once(event: 'resume', listener: Function): this;
  5673. addListener(event: 'resume', listener: Function): this;
  5674. removeListener(event: 'resume', listener: Function): this;
  5675. /**
  5676. * Emitted when the system is about to reboot or shut down. If the event handler
  5677. * invokes `e.preventDefault()`, Electron will attempt to delay system shutdown in
  5678. * order for the app to exit cleanly. If `e.preventDefault()` is called, the app
  5679. * should exit as soon as possible by calling something like `app.quit()`.
  5680. *
  5681. * @platform linux,darwin
  5682. */
  5683. on(event: 'shutdown', listener: Function): this;
  5684. once(event: 'shutdown', listener: Function): this;
  5685. addListener(event: 'shutdown', listener: Function): this;
  5686. removeListener(event: 'shutdown', listener: Function): this;
  5687. /**
  5688. * Emitted when the system is suspending.
  5689. *
  5690. * @platform darwin,win32
  5691. */
  5692. on(event: 'suspend', listener: Function): this;
  5693. once(event: 'suspend', listener: Function): this;
  5694. addListener(event: 'suspend', listener: Function): this;
  5695. removeListener(event: 'suspend', listener: Function): this;
  5696. /**
  5697. * Emitted as soon as the systems screen is unlocked.
  5698. *
  5699. * @platform darwin,win32
  5700. */
  5701. on(event: 'unlock-screen', listener: Function): this;
  5702. once(event: 'unlock-screen', listener: Function): this;
  5703. addListener(event: 'unlock-screen', listener: Function): this;
  5704. removeListener(event: 'unlock-screen', listener: Function): this;
  5705. /**
  5706. * The system's current state. Can be `active`, `idle`, `locked` or `unknown`.
  5707. *
  5708. * Calculate the system idle state. `idleThreshold` is the amount of time (in
  5709. * seconds) before considered idle. `locked` is available on supported systems
  5710. * only.
  5711. */
  5712. getSystemIdleState(idleThreshold: number): ('active' | 'idle' | 'locked' | 'unknown');
  5713. /**
  5714. * Idle time in seconds
  5715. Calculate system idle time in seconds.
  5716. */
  5717. getSystemIdleTime(): number;
  5718. }
  5719. interface PowerSaveBlocker {
  5720. // Docs: https://electronjs.org/docs/api/power-save-blocker
  5721. /**
  5722. * Whether the corresponding `powerSaveBlocker` has started.
  5723. */
  5724. isStarted(id: number): boolean;
  5725. /**
  5726. * The blocker ID that is assigned to this power blocker.
  5727. *
  5728. * Starts preventing the system from entering lower-power mode. Returns an integer
  5729. * identifying the power save blocker.
  5730. *
  5731. * **Note:** `prevent-display-sleep` has higher precedence over
  5732. * `prevent-app-suspension`. Only the highest precedence type takes effect. In
  5733. * other words, `prevent-display-sleep` always takes precedence over
  5734. * `prevent-app-suspension`.
  5735. *
  5736. * For example, an API calling A requests for `prevent-app-suspension`, and another
  5737. * calling B requests for `prevent-display-sleep`. `prevent-display-sleep` will be
  5738. * used until B stops its request. After that, `prevent-app-suspension` is used.
  5739. */
  5740. start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number;
  5741. /**
  5742. * Stops the specified power save blocker.
  5743. */
  5744. stop(id: number): void;
  5745. }
  5746. interface PrinterInfo {
  5747. // Docs: https://electronjs.org/docs/api/structures/printer-info
  5748. /**
  5749. * a longer description of the printer's type.
  5750. */
  5751. description: string;
  5752. /**
  5753. * the name of the printer as shown in Print Preview.
  5754. */
  5755. displayName: string;
  5756. /**
  5757. * whether or not a given printer is set as the default printer on the OS.
  5758. */
  5759. isDefault: boolean;
  5760. /**
  5761. * the name of the printer as understood by the OS.
  5762. */
  5763. name: string;
  5764. /**
  5765. * an object containing a variable number of platform-specific printer information.
  5766. */
  5767. options: Options;
  5768. /**
  5769. * the current status of the printer.
  5770. */
  5771. status: number;
  5772. }
  5773. interface ProcessMemoryInfo {
  5774. // Docs: https://electronjs.org/docs/api/structures/process-memory-info
  5775. /**
  5776. * The amount of memory not shared by other processes, such as JS heap or HTML
  5777. * content in Kilobytes.
  5778. */
  5779. private: number;
  5780. /**
  5781. * The amount of memory currently pinned to actual physical RAM in Kilobytes.
  5782. *
  5783. * @platform linux,win32
  5784. */
  5785. residentSet: number;
  5786. /**
  5787. * The amount of memory shared between processes, typically memory consumed by the
  5788. * Electron code itself in Kilobytes.
  5789. */
  5790. shared: number;
  5791. }
  5792. interface ProcessMetric {
  5793. // Docs: https://electronjs.org/docs/api/structures/process-metric
  5794. /**
  5795. * CPU usage of the process.
  5796. */
  5797. cpu: CPUUsage;
  5798. /**
  5799. * Creation time for this process. The time is represented as number of
  5800. * milliseconds since epoch. Since the `pid` can be reused after a process dies, it
  5801. * is useful to use both the `pid` and the `creationTime` to uniquely identify a
  5802. * process.
  5803. */
  5804. creationTime: number;
  5805. /**
  5806. * One of the following values:
  5807. *
  5808. * @platform win32
  5809. */
  5810. integrityLevel?: ('untrusted' | 'low' | 'medium' | 'high' | 'unknown');
  5811. /**
  5812. * Memory information for the process.
  5813. */
  5814. memory: MemoryInfo;
  5815. /**
  5816. * The name of the process. i.e. for plugins it might be Flash. Examples for
  5817. * utility: `Audio Service`, `Content Decryption Module Service`, `Network
  5818. * Service`, `Video Capture`, etc.
  5819. */
  5820. name?: string;
  5821. /**
  5822. * Process id of the process.
  5823. */
  5824. pid: number;
  5825. /**
  5826. * Whether the process is sandboxed on OS level.
  5827. *
  5828. * @platform darwin,win32
  5829. */
  5830. sandboxed?: boolean;
  5831. /**
  5832. * Process type. One of the following values:
  5833. */
  5834. type: ('Browser' | 'Tab' | 'Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
  5835. }
  5836. interface Product {
  5837. // Docs: https://electronjs.org/docs/api/structures/product
  5838. /**
  5839. * The total size of the content, in bytes.
  5840. */
  5841. contentLengths: number[];
  5842. /**
  5843. * A string that identifies the version of the content.
  5844. */
  5845. contentVersion: string;
  5846. /**
  5847. * 3 character code presenting a product's currency based on the ISO 4217 standard.
  5848. */
  5849. currencyCode: string;
  5850. /**
  5851. * The locale formatted price of the product.
  5852. */
  5853. formattedPrice: string;
  5854. /**
  5855. * A Boolean value that indicates whether the App Store has downloadable content
  5856. * for this product. `true` if at least one file has been associated with the
  5857. * product.
  5858. */
  5859. isDownloadable: boolean;
  5860. /**
  5861. * A description of the product.
  5862. */
  5863. localizedDescription: string;
  5864. /**
  5865. * The name of the product.
  5866. */
  5867. localizedTitle: string;
  5868. /**
  5869. * The cost of the product in the local currency.
  5870. */
  5871. price: number;
  5872. /**
  5873. * The string that identifies the product to the Apple App Store.
  5874. */
  5875. productIdentifier: string;
  5876. }
  5877. interface Protocol {
  5878. // Docs: https://electronjs.org/docs/api/protocol
  5879. /**
  5880. * Whether the protocol was successfully intercepted
  5881. *
  5882. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  5883. * which sends a `Buffer` as a response.
  5884. */
  5885. interceptBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
  5886. /**
  5887. * Whether the protocol was successfully intercepted
  5888. *
  5889. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  5890. * which sends a file as a response.
  5891. */
  5892. interceptFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  5893. /**
  5894. * Whether the protocol was successfully intercepted
  5895. *
  5896. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  5897. * which sends a new HTTP request as a response.
  5898. */
  5899. interceptHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
  5900. /**
  5901. * Whether the protocol was successfully intercepted
  5902. *
  5903. * Same as `protocol.registerStreamProtocol`, except that it replaces an existing
  5904. * protocol handler.
  5905. */
  5906. interceptStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
  5907. /**
  5908. * Whether the protocol was successfully intercepted
  5909. *
  5910. * Intercepts `scheme` protocol and uses `handler` as the protocol's new handler
  5911. * which sends a `String` as a response.
  5912. */
  5913. interceptStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  5914. /**
  5915. * Whether `scheme` is already intercepted.
  5916. */
  5917. isProtocolIntercepted(scheme: string): boolean;
  5918. /**
  5919. * Whether `scheme` is already registered.
  5920. */
  5921. isProtocolRegistered(scheme: string): boolean;
  5922. /**
  5923. * Whether the protocol was successfully registered
  5924. *
  5925. * Registers a protocol of `scheme` that will send a `Buffer` as a response.
  5926. *
  5927. * The usage is the same with `registerFileProtocol`, except that the `callback`
  5928. * should be called with either a `Buffer` object or an object that has the `data`
  5929. * property.
  5930. Example:
  5931. */
  5932. registerBufferProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (Buffer) | (ProtocolResponse)) => void) => void): boolean;
  5933. /**
  5934. * Whether the protocol was successfully registered
  5935. *
  5936. * Registers a protocol of `scheme` that will send a file as the response. The
  5937. * `handler` will be called with `request` and `callback` where `request` is an
  5938. * incoming request for the `scheme`.
  5939. *
  5940. * To handle the `request`, the `callback` should be called with either the file's
  5941. * path or an object that has a `path` property, e.g. `callback(filePath)` or
  5942. * `callback({ path: filePath })`. The `filePath` must be an absolute path.
  5943. *
  5944. * By default the `scheme` is treated like `http:`, which is parsed differently
  5945. * from protocols that follow the "generic URI syntax" like `file:`.
  5946. */
  5947. registerFileProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  5948. /**
  5949. * Whether the protocol was successfully registered
  5950. *
  5951. * Registers a protocol of `scheme` that will send an HTTP request as a response.
  5952. *
  5953. * The usage is the same with `registerFileProtocol`, except that the `callback`
  5954. * should be called with an object that has the `url` property.
  5955. */
  5956. registerHttpProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: ProtocolResponse) => void) => void): boolean;
  5957. /**
  5958. * **Note:** This method can only be used before the `ready` event of the `app`
  5959. * module gets emitted and can be called only once.
  5960. *
  5961. * Registers the `scheme` as standard, secure, bypasses content security policy for
  5962. * resources, allows registering ServiceWorker, supports fetch API, and streaming
  5963. * video/audio. Specify a privilege with the value of `true` to enable the
  5964. * capability.
  5965. *
  5966. * An example of registering a privileged scheme, that bypasses Content Security
  5967. * Policy:
  5968. *
  5969. * A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example
  5970. * `http` and `https` are standard schemes, while `file` is not.
  5971. *
  5972. * Registering a scheme as standard allows relative and absolute resources to be
  5973. * resolved correctly when served. Otherwise the scheme will behave like the `file`
  5974. * protocol, but without the ability to resolve relative URLs.
  5975. *
  5976. * For example when you load following page with custom protocol without
  5977. * registering it as standard scheme, the image will not be loaded because
  5978. * non-standard schemes can not recognize relative URLs:
  5979. *
  5980. * Registering a scheme as standard will allow access to files through the
  5981. * FileSystem API. Otherwise the renderer will throw a security error for the
  5982. * scheme.
  5983. *
  5984. * By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB,
  5985. * cookies) are disabled for non standard schemes. So in general if you want to
  5986. * register a custom protocol to replace the `http` protocol, you have to register
  5987. * it as a standard scheme.
  5988. *
  5989. * Protocols that use streams (http and stream protocols) should set `stream:
  5990. * true`. The `<video>` and `<audio>` HTML elements expect protocols to buffer
  5991. * their responses by default. The `stream` flag configures those elements to
  5992. * correctly expect streaming responses.
  5993. */
  5994. registerSchemesAsPrivileged(customSchemes: CustomScheme[]): void;
  5995. /**
  5996. * Whether the protocol was successfully registered
  5997. *
  5998. * Registers a protocol of `scheme` that will send a stream as a response.
  5999. *
  6000. * The usage is the same with `registerFileProtocol`, except that the `callback`
  6001. * should be called with either a `ReadableStream` object or an object that has the
  6002. * `data` property.
  6003. *
  6004. * Example:
  6005. *
  6006. * It is possible to pass any object that implements the readable stream API (emits
  6007. * `data`/`end`/`error` events). For example, here's how a file could be returned:
  6008. */
  6009. registerStreamProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (NodeJS.ReadableStream) | (ProtocolResponse)) => void) => void): boolean;
  6010. /**
  6011. * Whether the protocol was successfully registered
  6012. *
  6013. * Registers a protocol of `scheme` that will send a `String` as a response.
  6014. *
  6015. * The usage is the same with `registerFileProtocol`, except that the `callback`
  6016. * should be called with either a `String` or an object that has the `data`
  6017. * property.
  6018. */
  6019. registerStringProtocol(scheme: string, handler: (request: ProtocolRequest, callback: (response: (string) | (ProtocolResponse)) => void) => void): boolean;
  6020. /**
  6021. * Whether the protocol was successfully unintercepted
  6022. *
  6023. Remove the interceptor installed for `scheme` and restore its original handler.
  6024. */
  6025. uninterceptProtocol(scheme: string): boolean;
  6026. /**
  6027. * Whether the protocol was successfully unregistered
  6028. *
  6029. Unregisters the custom protocol of `scheme`.
  6030. */
  6031. unregisterProtocol(scheme: string): boolean;
  6032. }
  6033. interface ProtocolRequest {
  6034. // Docs: https://electronjs.org/docs/api/structures/protocol-request
  6035. headers: Record<string, string>;
  6036. method: string;
  6037. referrer: string;
  6038. uploadData?: UploadData[];
  6039. url: string;
  6040. }
  6041. interface ProtocolResponse {
  6042. // Docs: https://electronjs.org/docs/api/structures/protocol-response
  6043. /**
  6044. * The charset of response body, default is `"utf-8"`.
  6045. */
  6046. charset?: string;
  6047. /**
  6048. * The response body. When returning stream as response, this is a Node.js readable
  6049. * stream representing the response body. When returning `Buffer` as response, this
  6050. * is a `Buffer`. When returning `String` as response, this is a `String`. This is
  6051. * ignored for other types of responses.
  6052. */
  6053. data?: (Buffer) | (string) | (NodeJS.ReadableStream);
  6054. /**
  6055. * When assigned, the `request` will fail with the `error` number . For the
  6056. * available error numbers you can use, please see the net error list.
  6057. */
  6058. error?: number;
  6059. /**
  6060. * An object containing the response headers. The keys must be String, and values
  6061. * must be either String or Array of String.
  6062. */
  6063. headers?: Record<string, (string) | (string[])>;
  6064. /**
  6065. * The HTTP `method`. This is only used for file and URL responses.
  6066. */
  6067. method?: string;
  6068. /**
  6069. * The MIME type of response body, default is `"text/html"`. Setting `mimeType`
  6070. * would implicitly set the `content-type` header in response, but if
  6071. * `content-type` is already set in `headers`, the `mimeType` would be ignored.
  6072. */
  6073. mimeType?: string;
  6074. /**
  6075. * Path to the file which would be sent as response body. This is only used for
  6076. * file responses.
  6077. */
  6078. path?: string;
  6079. /**
  6080. * The `referrer` URL. This is only used for file and URL responses.
  6081. */
  6082. referrer?: string;
  6083. /**
  6084. * The session used for requesting URL, by default the HTTP request will reuse the
  6085. * current session. Setting `session` to `null` would use a random independent
  6086. * session. This is only used for URL responses.
  6087. */
  6088. session?: Session;
  6089. /**
  6090. * The HTTP response code, default is 200.
  6091. */
  6092. statusCode?: number;
  6093. /**
  6094. * The data used as upload data. This is only used for URL responses when `method`
  6095. * is `"POST"`.
  6096. */
  6097. uploadData?: ProtocolResponseUploadData;
  6098. /**
  6099. * Download the `url` and pipe the result as response body. This is only used for
  6100. * URL responses.
  6101. */
  6102. url?: string;
  6103. }
  6104. interface ProtocolResponseUploadData {
  6105. // Docs: https://electronjs.org/docs/api/structures/protocol-response-upload-data
  6106. /**
  6107. * MIME type of the content.
  6108. */
  6109. contentType: string;
  6110. /**
  6111. * Content to be sent.
  6112. */
  6113. data: (string) | (Buffer);
  6114. }
  6115. interface Rectangle {
  6116. // Docs: https://electronjs.org/docs/api/structures/rectangle
  6117. /**
  6118. * The height of the rectangle (must be an integer).
  6119. */
  6120. height: number;
  6121. /**
  6122. * The width of the rectangle (must be an integer).
  6123. */
  6124. width: number;
  6125. /**
  6126. * The x coordinate of the origin of the rectangle (must be an integer).
  6127. */
  6128. x: number;
  6129. /**
  6130. * The y coordinate of the origin of the rectangle (must be an integer).
  6131. */
  6132. y: number;
  6133. }
  6134. interface Referrer {
  6135. // Docs: https://electronjs.org/docs/api/structures/referrer
  6136. /**
  6137. * Can be `default`, `unsafe-url`, `no-referrer-when-downgrade`, `no-referrer`,
  6138. * `origin`, `strict-origin-when-cross-origin`, `same-origin` or `strict-origin`.
  6139. * See the Referrer-Policy spec for more details on the meaning of these values.
  6140. */
  6141. policy: ('default' | 'unsafe-url' | 'no-referrer-when-downgrade' | 'no-referrer' | 'origin' | 'strict-origin-when-cross-origin' | 'same-origin' | 'strict-origin');
  6142. /**
  6143. * HTTP Referrer URL.
  6144. */
  6145. url: string;
  6146. }
  6147. interface Remote extends RemoteMainInterface {
  6148. // Docs: https://electronjs.org/docs/api/remote
  6149. /**
  6150. * The web contents of this web page.
  6151. */
  6152. getCurrentWebContents(): WebContents;
  6153. /**
  6154. * The window to which this web page belongs.
  6155. *
  6156. * **Note:** Do not use `removeAllListeners` on `BrowserWindow`. Use of this can
  6157. * remove all `blur` listeners, disable click events on touch bar buttons, and
  6158. * other unintended consequences.
  6159. */
  6160. getCurrentWindow(): BrowserWindow;
  6161. /**
  6162. * The global variable of `name` (e.g. `global[name]`) in the main process.
  6163. */
  6164. getGlobal(name: string): any;
  6165. /**
  6166. * The object returned by `require(module)` in the main process. Modules specified
  6167. * by their relative path will resolve relative to the entrypoint of the main
  6168. * process.
  6169. e.g.
  6170. */
  6171. require(module: string): any;
  6172. /**
  6173. * A `NodeJS.Process` object. The `process` object in the main process. This is
  6174. * the same as `remote.getGlobal('process')` but is cached.
  6175. *
  6176. */
  6177. readonly process: NodeJS.Process;
  6178. }
  6179. interface Screen extends NodeJS.EventEmitter {
  6180. // Docs: https://electronjs.org/docs/api/screen
  6181. /**
  6182. * Emitted when `newDisplay` has been added.
  6183. */
  6184. on(event: 'display-added', listener: (event: Event,
  6185. newDisplay: Display) => void): this;
  6186. once(event: 'display-added', listener: (event: Event,
  6187. newDisplay: Display) => void): this;
  6188. addListener(event: 'display-added', listener: (event: Event,
  6189. newDisplay: Display) => void): this;
  6190. removeListener(event: 'display-added', listener: (event: Event,
  6191. newDisplay: Display) => void): this;
  6192. /**
  6193. * Emitted when one or more metrics change in a `display`. The `changedMetrics` is
  6194. * an array of strings that describe the changes. Possible changes are `bounds`,
  6195. * `workArea`, `scaleFactor` and `rotation`.
  6196. */
  6197. on(event: 'display-metrics-changed', listener: (event: Event,
  6198. display: Display,
  6199. changedMetrics: string[]) => void): this;
  6200. once(event: 'display-metrics-changed', listener: (event: Event,
  6201. display: Display,
  6202. changedMetrics: string[]) => void): this;
  6203. addListener(event: 'display-metrics-changed', listener: (event: Event,
  6204. display: Display,
  6205. changedMetrics: string[]) => void): this;
  6206. removeListener(event: 'display-metrics-changed', listener: (event: Event,
  6207. display: Display,
  6208. changedMetrics: string[]) => void): this;
  6209. /**
  6210. * Emitted when `oldDisplay` has been removed.
  6211. */
  6212. on(event: 'display-removed', listener: (event: Event,
  6213. oldDisplay: Display) => void): this;
  6214. once(event: 'display-removed', listener: (event: Event,
  6215. oldDisplay: Display) => void): this;
  6216. addListener(event: 'display-removed', listener: (event: Event,
  6217. oldDisplay: Display) => void): this;
  6218. removeListener(event: 'display-removed', listener: (event: Event,
  6219. oldDisplay: Display) => void): this;
  6220. /**
  6221. * Converts a screen DIP point to a screen physical point. The DPI scale is
  6222. * performed relative to the display containing the DIP point.
  6223. *
  6224. * @platform win32
  6225. */
  6226. dipToScreenPoint(point: Point): Point;
  6227. /**
  6228. * Converts a screen DIP rect to a screen physical rect. The DPI scale is performed
  6229. * relative to the display nearest to `window`. If `window` is null, scaling will
  6230. * be performed to the display nearest to `rect`.
  6231. *
  6232. * @platform win32
  6233. */
  6234. dipToScreenRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
  6235. /**
  6236. * An array of displays that are currently available.
  6237. */
  6238. getAllDisplays(): Display[];
  6239. /**
  6240. * The current absolute position of the mouse pointer.
  6241. */
  6242. getCursorScreenPoint(): Point;
  6243. /**
  6244. * The display that most closely intersects the provided bounds.
  6245. */
  6246. getDisplayMatching(rect: Rectangle): Display;
  6247. /**
  6248. * The display nearest the specified point.
  6249. */
  6250. getDisplayNearestPoint(point: Point): Display;
  6251. /**
  6252. * The primary display.
  6253. */
  6254. getPrimaryDisplay(): Display;
  6255. /**
  6256. * Converts a screen physical point to a screen DIP point. The DPI scale is
  6257. * performed relative to the display containing the physical point.
  6258. *
  6259. * @platform win32
  6260. */
  6261. screenToDipPoint(point: Point): Point;
  6262. /**
  6263. * Converts a screen physical rect to a screen DIP rect. The DPI scale is performed
  6264. * relative to the display nearest to `window`. If `window` is null, scaling will
  6265. * be performed to the display nearest to `rect`.
  6266. *
  6267. * @platform win32
  6268. */
  6269. screenToDipRect(window: (BrowserWindow) | (null), rect: Rectangle): Rectangle;
  6270. }
  6271. interface ScrubberItem {
  6272. // Docs: https://electronjs.org/docs/api/structures/scrubber-item
  6273. /**
  6274. * The image to appear in this item.
  6275. */
  6276. icon?: NativeImage;
  6277. /**
  6278. * The text to appear in this item.
  6279. */
  6280. label?: string;
  6281. }
  6282. interface SegmentedControlSegment {
  6283. // Docs: https://electronjs.org/docs/api/structures/segmented-control-segment
  6284. /**
  6285. * Whether this segment is selectable. Default: true.
  6286. */
  6287. enabled?: boolean;
  6288. /**
  6289. * The image to appear in this segment.
  6290. */
  6291. icon?: NativeImage;
  6292. /**
  6293. * The text to appear in this segment.
  6294. */
  6295. label?: string;
  6296. }
  6297. interface ServiceWorkerInfo {
  6298. // Docs: https://electronjs.org/docs/api/structures/service-worker-info
  6299. /**
  6300. * The virtual ID of the process that this service worker is running in. This is
  6301. * not an OS level PID. This aligns with the ID set used for
  6302. * `webContents.getProcessId()`.
  6303. */
  6304. renderProcessId: number;
  6305. /**
  6306. * The base URL that this service worker is active for.
  6307. */
  6308. scope: string;
  6309. /**
  6310. * The full URL to the script that this service worker runs
  6311. */
  6312. scriptUrl: string;
  6313. }
  6314. class ServiceWorkers extends NodeEventEmitter {
  6315. // Docs: https://electronjs.org/docs/api/service-workers
  6316. /**
  6317. * Emitted when a service worker logs something to the console.
  6318. */
  6319. on(event: 'console-message', listener: (event: Event,
  6320. /**
  6321. * Information about the console message
  6322. */
  6323. messageDetails: MessageDetails) => void): this;
  6324. once(event: 'console-message', listener: (event: Event,
  6325. /**
  6326. * Information about the console message
  6327. */
  6328. messageDetails: MessageDetails) => void): this;
  6329. addListener(event: 'console-message', listener: (event: Event,
  6330. /**
  6331. * Information about the console message
  6332. */
  6333. messageDetails: MessageDetails) => void): this;
  6334. removeListener(event: 'console-message', listener: (event: Event,
  6335. /**
  6336. * Information about the console message
  6337. */
  6338. messageDetails: MessageDetails) => void): this;
  6339. /**
  6340. * A ServiceWorkerInfo object where the keys are the service worker version ID and
  6341. * the values are the information about that service worker.
  6342. */
  6343. getAllRunning(): Record<number, ServiceWorkerInfo>;
  6344. /**
  6345. * Information about this service worker
  6346. *
  6347. * If the service worker does not exist or is not running this method will throw an
  6348. * exception.
  6349. */
  6350. getFromVersionID(versionId: number): ServiceWorkerInfo;
  6351. }
  6352. class Session extends NodeEventEmitter {
  6353. // Docs: https://electronjs.org/docs/api/session
  6354. /**
  6355. * A session instance from `partition` string. When there is an existing `Session`
  6356. * with the same `partition`, it will be returned; otherwise a new `Session`
  6357. * instance will be created with `options`.
  6358. *
  6359. * If `partition` starts with `persist:`, the page will use a persistent session
  6360. * available to all pages in the app with the same `partition`. if there is no
  6361. * `persist:` prefix, the page will use an in-memory session. If the `partition` is
  6362. * empty then default session of the app will be returned.
  6363. *
  6364. * To create a `Session` with `options`, you have to ensure the `Session` with the
  6365. * `partition` has never been used before. There is no way to change the `options`
  6366. * of an existing `Session` object.
  6367. */
  6368. static fromPartition(partition: string, options?: FromPartitionOptions): Session;
  6369. /**
  6370. * A `Session` object, the default session object of the app.
  6371. */
  6372. static defaultSession: Session;
  6373. /**
  6374. * Emitted when a render process requests preconnection to a URL, generally due to
  6375. * a resource hint.
  6376. */
  6377. on(event: 'preconnect', listener: (event: Event,
  6378. /**
  6379. * The URL being requested for preconnection by the renderer.
  6380. */
  6381. preconnectUrl: string,
  6382. /**
  6383. * True if the renderer is requesting that the connection include credentials (see
  6384. * the spec for more details.)
  6385. */
  6386. allowCredentials: boolean) => void): this;
  6387. once(event: 'preconnect', listener: (event: Event,
  6388. /**
  6389. * The URL being requested for preconnection by the renderer.
  6390. */
  6391. preconnectUrl: string,
  6392. /**
  6393. * True if the renderer is requesting that the connection include credentials (see
  6394. * the spec for more details.)
  6395. */
  6396. allowCredentials: boolean) => void): this;
  6397. addListener(event: 'preconnect', listener: (event: Event,
  6398. /**
  6399. * The URL being requested for preconnection by the renderer.
  6400. */
  6401. preconnectUrl: string,
  6402. /**
  6403. * True if the renderer is requesting that the connection include credentials (see
  6404. * the spec for more details.)
  6405. */
  6406. allowCredentials: boolean) => void): this;
  6407. removeListener(event: 'preconnect', listener: (event: Event,
  6408. /**
  6409. * The URL being requested for preconnection by the renderer.
  6410. */
  6411. preconnectUrl: string,
  6412. /**
  6413. * True if the renderer is requesting that the connection include credentials (see
  6414. * the spec for more details.)
  6415. */
  6416. allowCredentials: boolean) => void): this;
  6417. /**
  6418. * Emitted when a hunspell dictionary file starts downloading
  6419. */
  6420. on(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  6421. /**
  6422. * The language code of the dictionary file
  6423. */
  6424. languageCode: string) => void): this;
  6425. once(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  6426. /**
  6427. * The language code of the dictionary file
  6428. */
  6429. languageCode: string) => void): this;
  6430. addListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  6431. /**
  6432. * The language code of the dictionary file
  6433. */
  6434. languageCode: string) => void): this;
  6435. removeListener(event: 'spellcheck-dictionary-download-begin', listener: (event: Event,
  6436. /**
  6437. * The language code of the dictionary file
  6438. */
  6439. languageCode: string) => void): this;
  6440. /**
  6441. * Emitted when a hunspell dictionary file download fails. For details on the
  6442. * failure you should collect a netlog and inspect the download request.
  6443. */
  6444. on(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  6445. /**
  6446. * The language code of the dictionary file
  6447. */
  6448. languageCode: string) => void): this;
  6449. once(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  6450. /**
  6451. * The language code of the dictionary file
  6452. */
  6453. languageCode: string) => void): this;
  6454. addListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  6455. /**
  6456. * The language code of the dictionary file
  6457. */
  6458. languageCode: string) => void): this;
  6459. removeListener(event: 'spellcheck-dictionary-download-failure', listener: (event: Event,
  6460. /**
  6461. * The language code of the dictionary file
  6462. */
  6463. languageCode: string) => void): this;
  6464. /**
  6465. * Emitted when a hunspell dictionary file has been successfully downloaded
  6466. */
  6467. on(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  6468. /**
  6469. * The language code of the dictionary file
  6470. */
  6471. languageCode: string) => void): this;
  6472. once(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  6473. /**
  6474. * The language code of the dictionary file
  6475. */
  6476. languageCode: string) => void): this;
  6477. addListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  6478. /**
  6479. * The language code of the dictionary file
  6480. */
  6481. languageCode: string) => void): this;
  6482. removeListener(event: 'spellcheck-dictionary-download-success', listener: (event: Event,
  6483. /**
  6484. * The language code of the dictionary file
  6485. */
  6486. languageCode: string) => void): this;
  6487. /**
  6488. * Emitted when a hunspell dictionary file has been successfully initialized. This
  6489. * occurs after the file has been downloaded.
  6490. */
  6491. on(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  6492. /**
  6493. * The language code of the dictionary file
  6494. */
  6495. languageCode: string) => void): this;
  6496. once(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  6497. /**
  6498. * The language code of the dictionary file
  6499. */
  6500. languageCode: string) => void): this;
  6501. addListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  6502. /**
  6503. * The language code of the dictionary file
  6504. */
  6505. languageCode: string) => void): this;
  6506. removeListener(event: 'spellcheck-dictionary-initialized', listener: (event: Event,
  6507. /**
  6508. * The language code of the dictionary file
  6509. */
  6510. languageCode: string) => void): this;
  6511. /**
  6512. * Emitted when Electron is about to download `item` in `webContents`.
  6513. *
  6514. * Calling `event.preventDefault()` will cancel the download and `item` will not be
  6515. * available from next tick of the process.
  6516. */
  6517. on(event: 'will-download', listener: (event: Event,
  6518. item: DownloadItem,
  6519. webContents: WebContents) => void): this;
  6520. once(event: 'will-download', listener: (event: Event,
  6521. item: DownloadItem,
  6522. webContents: WebContents) => void): this;
  6523. addListener(event: 'will-download', listener: (event: Event,
  6524. item: DownloadItem,
  6525. webContents: WebContents) => void): this;
  6526. removeListener(event: 'will-download', listener: (event: Event,
  6527. item: DownloadItem,
  6528. webContents: WebContents) => void): this;
  6529. /**
  6530. * Whether the word was successfully written to the custom dictionary. This API
  6531. * will not work on non-persistent (in-memory) sessions.
  6532. *
  6533. * **Note:** On macOS and Windows 10 this word will be written to the OS custom
  6534. * dictionary as well
  6535. */
  6536. addWordToSpellCheckerDictionary(word: string): boolean;
  6537. /**
  6538. * Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate
  6539. * authentication.
  6540. */
  6541. allowNTLMCredentialsForDomains(domains: string): void;
  6542. /**
  6543. * resolves when the session’s HTTP authentication cache has been cleared.
  6544. */
  6545. clearAuthCache(): Promise<void>;
  6546. /**
  6547. * resolves when the cache clear operation is complete.
  6548. *
  6549. Clears the session’s HTTP cache.
  6550. */
  6551. clearCache(): Promise<void>;
  6552. /**
  6553. * Resolves when the operation is complete.
  6554. Clears the host resolver cache.
  6555. */
  6556. clearHostResolverCache(): Promise<void>;
  6557. /**
  6558. * resolves when the storage data has been cleared.
  6559. */
  6560. clearStorageData(options?: ClearStorageDataOptions): Promise<void>;
  6561. /**
  6562. * Allows resuming `cancelled` or `interrupted` downloads from previous `Session`.
  6563. * The API will generate a DownloadItem that can be accessed with the will-download
  6564. * event. The DownloadItem will not have any `WebContents` associated with it and
  6565. * the initial state will be `interrupted`. The download will start only when the
  6566. * `resume` API is called on the DownloadItem.
  6567. */
  6568. createInterruptedDownload(options: CreateInterruptedDownloadOptions): void;
  6569. /**
  6570. * Disables any network emulation already active for the `session`. Resets to the
  6571. * original network configuration.
  6572. */
  6573. disableNetworkEmulation(): void;
  6574. /**
  6575. * Initiates a download of the resource at `url`. The API will generate a
  6576. * DownloadItem that can be accessed with the will-download event.
  6577. *
  6578. * **Note:** This does not perform any security checks that relate to a page's
  6579. * origin, unlike `webContents.downloadURL`.
  6580. */
  6581. downloadURL(url: string): void;
  6582. /**
  6583. * Emulates network with the given configuration for the `session`.
  6584. */
  6585. enableNetworkEmulation(options: EnableNetworkEmulationOptions): void;
  6586. /**
  6587. * Writes any unwritten DOMStorage data to disk.
  6588. */
  6589. flushStorageData(): void;
  6590. /**
  6591. * A list of all loaded extensions.
  6592. *
  6593. * **Note:** This API cannot be called before the `ready` event of the `app` module
  6594. * is emitted.
  6595. */
  6596. getAllExtensions(): Extension[];
  6597. /**
  6598. * resolves with blob data.
  6599. */
  6600. getBlobData(identifier: string): Promise<Buffer>;
  6601. /**
  6602. * the session's current cache size, in bytes.
  6603. */
  6604. getCacheSize(): Promise<number>;
  6605. /**
  6606. * | `null` - The loaded extension with the given ID.
  6607. *
  6608. * **Note:** This API cannot be called before the `ready` event of the `app` module
  6609. * is emitted.
  6610. */
  6611. getExtension(extensionId: string): Extension;
  6612. /**
  6613. * an array of paths to preload scripts that have been registered.
  6614. */
  6615. getPreloads(): string[];
  6616. /**
  6617. * An array of language codes the spellchecker is enabled for. If this list is
  6618. * empty the spellchecker will fallback to using `en-US`. By default on launch if
  6619. * this setting is an empty list Electron will try to populate this setting with
  6620. * the current OS locale. This setting is persisted across restarts.
  6621. *
  6622. * **Note:** On macOS the OS spellchecker is used and has its own list of
  6623. * languages. This API is a no-op on macOS.
  6624. */
  6625. getSpellCheckerLanguages(): string[];
  6626. /**
  6627. * The user agent for this session.
  6628. */
  6629. getUserAgent(): string;
  6630. /**
  6631. * Whether or not this session is a persistent one. The default `webContents`
  6632. * session of a `BrowserWindow` is persistent. When creating a session from a
  6633. * partition, session prefixed with `persist:` will be persistent, while others
  6634. * will be temporary.
  6635. */
  6636. isPersistent(): boolean;
  6637. /**
  6638. * An array of all words in app's custom dictionary. Resolves when the full
  6639. * dictionary is loaded from disk.
  6640. */
  6641. listWordsInSpellCheckerDictionary(): Promise<string[]>;
  6642. /**
  6643. * resolves when the extension is loaded.
  6644. *
  6645. * This method will raise an exception if the extension could not be loaded. If
  6646. * there are warnings when installing the extension (e.g. if the extension requests
  6647. * an API that Electron does not support) then they will be logged to the console.
  6648. *
  6649. * Note that Electron does not support the full range of Chrome extensions APIs.
  6650. * See Supported Extensions APIs for more details on what is supported.
  6651. *
  6652. * Note that in previous versions of Electron, extensions that were loaded would be
  6653. * remembered for future runs of the application. This is no longer the case:
  6654. * `loadExtension` must be called on every boot of your app if you want the
  6655. * extension to be loaded.
  6656. *
  6657. * This API does not support loading packed (.crx) extensions.
  6658. *
  6659. * **Note:** This API cannot be called before the `ready` event of the `app` module
  6660. * is emitted.
  6661. *
  6662. * **Note:** Loading extensions into in-memory (non-persistent) sessions is not
  6663. * supported and will throw an error.
  6664. */
  6665. loadExtension(path: string): Promise<Electron.Extension>;
  6666. /**
  6667. * Preconnects the given number of sockets to an origin.
  6668. */
  6669. preconnect(options: PreconnectOptions): void;
  6670. /**
  6671. * Unloads an extension.
  6672. *
  6673. * **Note:** This API cannot be called before the `ready` event of the `app` module
  6674. * is emitted.
  6675. */
  6676. removeExtension(extensionId: string): void;
  6677. /**
  6678. * Whether the word was successfully removed from the custom dictionary. This API
  6679. * will not work on non-persistent (in-memory) sessions.
  6680. *
  6681. * **Note:** On macOS and Windows 10 this word will be removed from the OS custom
  6682. * dictionary as well
  6683. */
  6684. removeWordFromSpellCheckerDictionary(word: string): boolean;
  6685. /**
  6686. * Resolves with the proxy information for `url`.
  6687. */
  6688. resolveProxy(url: string): Promise<string>;
  6689. /**
  6690. * Sets the certificate verify proc for `session`, the `proc` will be called with
  6691. * `proc(request, callback)` whenever a server certificate verification is
  6692. * requested. Calling `callback(0)` accepts the certificate, calling `callback(-2)`
  6693. * rejects it.
  6694. *
  6695. * Calling `setCertificateVerifyProc(null)` will revert back to default certificate
  6696. * verify proc.
  6697. */
  6698. setCertificateVerifyProc(proc: ((request: Request, callback: (verificationResult: number) => void) => void) | (null)): void;
  6699. /**
  6700. * Sets download saving directory. By default, the download directory will be the
  6701. * `Downloads` under the respective app folder.
  6702. */
  6703. setDownloadPath(path: string): void;
  6704. /**
  6705. * Sets the handler which can be used to respond to permission checks for the
  6706. * `session`. Returning `true` will allow the permission and `false` will reject
  6707. * it. To clear the handler, call `setPermissionCheckHandler(null)`.
  6708. */
  6709. setPermissionCheckHandler(handler: ((webContents: WebContents, permission: string, requestingOrigin: string, details: PermissionCheckHandlerHandlerDetails) => boolean) | (null)): void;
  6710. /**
  6711. * Sets the handler which can be used to respond to permission requests for the
  6712. * `session`. Calling `callback(true)` will allow the permission and
  6713. * `callback(false)` will reject it. To clear the handler, call
  6714. * `setPermissionRequestHandler(null)`.
  6715. */
  6716. setPermissionRequestHandler(handler: ((webContents: WebContents, permission: 'clipboard-read' | 'media' | 'mediaKeySystem' | 'geolocation' | 'notifications' | 'midi' | 'midiSysex' | 'pointerLock' | 'fullscreen' | 'openExternal', callback: (permissionGranted: boolean) => void, details: PermissionRequestHandlerHandlerDetails) => void) | (null)): void;
  6717. /**
  6718. * Adds scripts that will be executed on ALL web contents that are associated with
  6719. * this session just before normal `preload` scripts run.
  6720. */
  6721. setPreloads(preloads: string[]): void;
  6722. /**
  6723. * Resolves when the proxy setting process is complete.
  6724. *
  6725. * Sets the proxy settings.
  6726. *
  6727. * When `pacScript` and `proxyRules` are provided together, the `proxyRules` option
  6728. * is ignored and `pacScript` configuration is applied.
  6729. *
  6730. * The `proxyRules` has to follow the rules below:
  6731. *
  6732. * For example:
  6733. *
  6734. * * `http=foopy:80;ftp=foopy2` - Use HTTP proxy `foopy:80` for `http://` URLs, and
  6735. * HTTP proxy `foopy2:80` for `ftp://` URLs.
  6736. * * `foopy:80` - Use HTTP proxy `foopy:80` for all URLs.
  6737. * * `foopy:80,bar,direct://` - Use HTTP proxy `foopy:80` for all URLs, failing
  6738. * over to `bar` if `foopy:80` is unavailable, and after that using no proxy.
  6739. * * `socks4://foopy` - Use SOCKS v4 proxy `foopy:1080` for all URLs.
  6740. * * `http=foopy,socks5://bar.com` - Use HTTP proxy `foopy` for http URLs, and fail
  6741. * over to the SOCKS5 proxy `bar.com` if `foopy` is unavailable.
  6742. * * `http=foopy,direct://` - Use HTTP proxy `foopy` for http URLs, and use no
  6743. * proxy if `foopy` is unavailable.
  6744. * * `http=foopy;socks=foopy2` - Use HTTP proxy `foopy` for http URLs, and use
  6745. * `socks4://foopy2` for all other URLs.
  6746. *
  6747. * The `proxyBypassRules` is a comma separated list of rules described below:
  6748. *
  6749. * * `[ URL_SCHEME "://" ] HOSTNAME_PATTERN [ ":" <port> ]`
  6750. *
  6751. * Match all hostnames that match the pattern HOSTNAME_PATTERN.
  6752. *
  6753. * Examples: "foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99",
  6754. * "https://x.*.y.com:99"
  6755. * * `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
  6756. *
  6757. * Match a particular domain suffix.
  6758. *
  6759. * Examples: ".google.com", ".com", "http://.google.com"
  6760. * * `[ SCHEME "://" ] IP_LITERAL [ ":" PORT ]`
  6761. *
  6762. * Match URLs which are IP address literals.
  6763. *
  6764. * Examples: "127.0.1", "[0:0::1]", "[::1]", "http://[::1]:99"
  6765. * * `IP_LITERAL "/" PREFIX_LENGTH_IN_BITS`
  6766. *
  6767. * Match any URL that is to an IP literal that falls between the given range. IP
  6768. * range is specified using CIDR notation.
  6769. *
  6770. * Examples: "192.168.1.1/16", "fefe:13::abc/33".
  6771. * * `<local>`
  6772. *
  6773. * Match local addresses. The meaning of `<local>` is whether the host matches one
  6774. * of: "127.0.0.1", "::1", "localhost".
  6775. */
  6776. setProxy(config: Config): Promise<void>;
  6777. /**
  6778. * By default Electron will download hunspell dictionaries from the Chromium CDN.
  6779. * If you want to override this behavior you can use this API to point the
  6780. * dictionary downloader at your own hosted version of the hunspell dictionaries.
  6781. * We publish a `hunspell_dictionaries.zip` file with each release which contains
  6782. * the files you need to host here, the file server must be **case insensitive**
  6783. * you must upload each file twice, once with the case it has in the ZIP file and
  6784. * once with the filename as all lower case.
  6785. *
  6786. * If the files present in `hunspell_dictionaries.zip` are available at
  6787. * `https://example.com/dictionaries/language-code.bdic` then you should call this
  6788. * api with
  6789. * `ses.setSpellCheckerDictionaryDownloadURL('https://example.com/dictionaries/')`.
  6790. * Please note the trailing slash. The URL to the dictionaries is formed as
  6791. * `${url}${filename}`.
  6792. *
  6793. * **Note:** On macOS the OS spellchecker is used and therefore we do not download
  6794. * any dictionary files. This API is a no-op on macOS.
  6795. */
  6796. setSpellCheckerDictionaryDownloadURL(url: string): void;
  6797. /**
  6798. * The built in spellchecker does not automatically detect what language a user is
  6799. * typing in. In order for the spell checker to correctly check their words you
  6800. * must call this API with an array of language codes. You can get the list of
  6801. * supported language codes with the `ses.availableSpellCheckerLanguages` property.
  6802. *
  6803. * **Note:** On macOS the OS spellchecker is used and will detect your language
  6804. * automatically. This API is a no-op on macOS.
  6805. */
  6806. setSpellCheckerLanguages(languages: string[]): void;
  6807. /**
  6808. * Overrides the `userAgent` and `acceptLanguages` for this session.
  6809. *
  6810. * The `acceptLanguages` must a comma separated ordered list of language codes, for
  6811. * example `"en-US,fr,de,ko,zh-CN,ja"`.
  6812. *
  6813. * This doesn't affect existing `WebContents`, and each `WebContents` can use
  6814. * `webContents.setUserAgent` to override the session-wide user agent.
  6815. */
  6816. setUserAgent(userAgent: string, acceptLanguages?: string): void;
  6817. readonly availableSpellCheckerLanguages: string[];
  6818. readonly cookies: Cookies;
  6819. readonly netLog: NetLog;
  6820. readonly protocol: Protocol;
  6821. readonly serviceWorkers: ServiceWorkers;
  6822. readonly webRequest: WebRequest;
  6823. }
  6824. interface SharedWorkerInfo {
  6825. // Docs: https://electronjs.org/docs/api/structures/shared-worker-info
  6826. /**
  6827. * The unique id of the shared worker.
  6828. */
  6829. id: string;
  6830. /**
  6831. * The url of the shared worker.
  6832. */
  6833. url: string;
  6834. }
  6835. interface Shell {
  6836. // Docs: https://electronjs.org/docs/api/shell
  6837. /**
  6838. * Play the beep sound.
  6839. */
  6840. beep(): void;
  6841. /**
  6842. * Whether the item was successfully moved to the trash or otherwise deleted.
  6843. *
  6844. Move the given file to trash and returns a boolean status for the operation.
  6845. */
  6846. moveItemToTrash(fullPath: string, deleteOnFail?: boolean): boolean;
  6847. /**
  6848. * Open the given external protocol URL in the desktop's default manner. (For
  6849. * example, mailto: URLs in the user's default mail agent).
  6850. */
  6851. openExternal(url: string, options?: OpenExternalOptions): Promise<void>;
  6852. /**
  6853. * Resolves with a string containing the error message corresponding to the failure
  6854. * if a failure occurred, otherwise "".
  6855. *
  6856. Open the given file in the desktop's default manner.
  6857. */
  6858. openPath(path: string): Promise<string>;
  6859. /**
  6860. * Resolves the shortcut link at `shortcutPath`.
  6861. *
  6862. An exception will be thrown when any error happens.
  6863. *
  6864. * @platform win32
  6865. */
  6866. readShortcutLink(shortcutPath: string): ShortcutDetails;
  6867. /**
  6868. * Show the given file in a file manager. If possible, select the file.
  6869. */
  6870. showItemInFolder(fullPath: string): void;
  6871. /**
  6872. * Whether the shortcut was created successfully.
  6873. *
  6874. Creates or updates a shortcut link at `shortcutPath`.
  6875. *
  6876. * @platform win32
  6877. */
  6878. writeShortcutLink(shortcutPath: string, operation: 'create' | 'update' | 'replace', options: ShortcutDetails): boolean;
  6879. /**
  6880. * Whether the shortcut was created successfully.
  6881. *
  6882. Creates or updates a shortcut link at `shortcutPath`.
  6883. *
  6884. * @platform win32
  6885. */
  6886. writeShortcutLink(shortcutPath: string, options: ShortcutDetails): boolean;
  6887. }
  6888. interface ShortcutDetails {
  6889. // Docs: https://electronjs.org/docs/api/structures/shortcut-details
  6890. /**
  6891. * The Application User Model ID. Default is empty.
  6892. */
  6893. appUserModelId?: string;
  6894. /**
  6895. * The arguments to be applied to `target` when launching from this shortcut.
  6896. * Default is empty.
  6897. */
  6898. args?: string;
  6899. /**
  6900. * The working directory. Default is empty.
  6901. */
  6902. cwd?: string;
  6903. /**
  6904. * The description of the shortcut. Default is empty.
  6905. */
  6906. description?: string;
  6907. /**
  6908. * The path to the icon, can be a DLL or EXE. `icon` and `iconIndex` have to be set
  6909. * together. Default is empty, which uses the target's icon.
  6910. */
  6911. icon?: string;
  6912. /**
  6913. * The resource ID of icon when `icon` is a DLL or EXE. Default is 0.
  6914. */
  6915. iconIndex?: number;
  6916. /**
  6917. * The target to launch from this shortcut.
  6918. */
  6919. target: string;
  6920. }
  6921. interface Size {
  6922. // Docs: https://electronjs.org/docs/api/structures/size
  6923. height: number;
  6924. width: number;
  6925. }
  6926. interface SystemPreferences extends NodeJS.EventEmitter {
  6927. // Docs: https://electronjs.org/docs/api/system-preferences
  6928. on(event: 'accent-color-changed', listener: (event: Event,
  6929. /**
  6930. * The new RGBA color the user assigned to be their system accent color.
  6931. */
  6932. newColor: string) => void): this;
  6933. once(event: 'accent-color-changed', listener: (event: Event,
  6934. /**
  6935. * The new RGBA color the user assigned to be their system accent color.
  6936. */
  6937. newColor: string) => void): this;
  6938. addListener(event: 'accent-color-changed', listener: (event: Event,
  6939. /**
  6940. * The new RGBA color the user assigned to be their system accent color.
  6941. */
  6942. newColor: string) => void): this;
  6943. removeListener(event: 'accent-color-changed', listener: (event: Event,
  6944. /**
  6945. * The new RGBA color the user assigned to be their system accent color.
  6946. */
  6947. newColor: string) => void): this;
  6948. on(event: 'color-changed', listener: (event: Event) => void): this;
  6949. once(event: 'color-changed', listener: (event: Event) => void): this;
  6950. addListener(event: 'color-changed', listener: (event: Event) => void): this;
  6951. removeListener(event: 'color-changed', listener: (event: Event) => void): this;
  6952. /**
  6953. * **Deprecated:** Should use the new `updated` event on the `nativeTheme` module.
  6954. *
  6955. * @deprecated
  6956. * @platform win32
  6957. */
  6958. on(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
  6959. /**
  6960. * `true` if a high contrast theme is being used, `false` otherwise.
  6961. */
  6962. highContrastColorScheme: boolean) => void): this;
  6963. once(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
  6964. /**
  6965. * `true` if a high contrast theme is being used, `false` otherwise.
  6966. */
  6967. highContrastColorScheme: boolean) => void): this;
  6968. addListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
  6969. /**
  6970. * `true` if a high contrast theme is being used, `false` otherwise.
  6971. */
  6972. highContrastColorScheme: boolean) => void): this;
  6973. removeListener(event: 'high-contrast-color-scheme-changed', listener: (event: Event,
  6974. /**
  6975. * `true` if a high contrast theme is being used, `false` otherwise.
  6976. */
  6977. highContrastColorScheme: boolean) => void): this;
  6978. /**
  6979. * **Deprecated:** Should use the new `updated` event on the `nativeTheme` module.
  6980. *
  6981. * @deprecated
  6982. * @platform win32
  6983. */
  6984. on(event: 'inverted-color-scheme-changed', listener: (event: Event,
  6985. /**
  6986. * `true` if an inverted color scheme (a high contrast color scheme with light text
  6987. * and dark backgrounds) is being used, `false` otherwise.
  6988. */
  6989. invertedColorScheme: boolean) => void): this;
  6990. once(event: 'inverted-color-scheme-changed', listener: (event: Event,
  6991. /**
  6992. * `true` if an inverted color scheme (a high contrast color scheme with light text
  6993. * and dark backgrounds) is being used, `false` otherwise.
  6994. */
  6995. invertedColorScheme: boolean) => void): this;
  6996. addListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
  6997. /**
  6998. * `true` if an inverted color scheme (a high contrast color scheme with light text
  6999. * and dark backgrounds) is being used, `false` otherwise.
  7000. */
  7001. invertedColorScheme: boolean) => void): this;
  7002. removeListener(event: 'inverted-color-scheme-changed', listener: (event: Event,
  7003. /**
  7004. * `true` if an inverted color scheme (a high contrast color scheme with light text
  7005. * and dark backgrounds) is being used, `false` otherwise.
  7006. */
  7007. invertedColorScheme: boolean) => void): this;
  7008. /**
  7009. * A promise that resolves with `true` if consent was granted and `false` if it was
  7010. * denied. If an invalid `mediaType` is passed, the promise will be rejected. If an
  7011. * access request was denied and later is changed through the System Preferences
  7012. * pane, a restart of the app will be required for the new permissions to take
  7013. * effect. If access has already been requested and denied, it _must_ be changed
  7014. * through the preference pane; an alert will not pop up and the promise will
  7015. * resolve with the existing access status.
  7016. *
  7017. * **Important:** In order to properly leverage this API, you must set the
  7018. * `NSMicrophoneUsageDescription` and `NSCameraUsageDescription` strings in your
  7019. * app's `Info.plist` file. The values for these keys will be used to populate the
  7020. * permission dialogs so that the user will be properly informed as to the purpose
  7021. * of the permission request. See Electron Application Distribution for more
  7022. * information about how to set these in the context of Electron.
  7023. *
  7024. * This user consent was not required until macOS 10.14 Mojave, so this method will
  7025. * always return `true` if your system is running 10.13 High Sierra or lower.
  7026. *
  7027. * @platform darwin
  7028. */
  7029. askForMediaAccess(mediaType: 'microphone' | 'camera'): Promise<boolean>;
  7030. /**
  7031. * whether or not this device has the ability to use Touch ID.
  7032. *
  7033. * **NOTE:** This API will return `false` on macOS systems older than Sierra
  7034. * 10.12.2.
  7035. *
  7036. * @platform darwin
  7037. */
  7038. canPromptTouchID(): boolean;
  7039. /**
  7040. * The users current system wide accent color preference in RGBA hexadecimal form.
  7041. *
  7042. This API is only available on macOS 10.14 Mojave or newer.
  7043. *
  7044. * @platform win32,darwin
  7045. */
  7046. getAccentColor(): string;
  7047. /**
  7048. * * `shouldRenderRichAnimation` Boolean - Returns true if rich animations should
  7049. * be rendered. Looks at session type (e.g. remote desktop) and accessibility
  7050. * settings to give guidance for heavy animations.
  7051. * * `scrollAnimationsEnabledBySystem` Boolean - Determines on a per-platform basis
  7052. * whether scroll animations (e.g. produced by home/end key) should be enabled.
  7053. * * `prefersReducedMotion` Boolean - Determines whether the user desires reduced
  7054. * motion based on platform APIs.
  7055. *
  7056. Returns an object with system animation settings.
  7057. */
  7058. getAnimationSettings(): AnimationSettings;
  7059. /**
  7060. * | `null` - Can be `dark`, `light` or `unknown`.
  7061. *
  7062. * Gets the macOS appearance setting that you have declared you want for your
  7063. * application, maps to NSApplication.appearance. You can use the
  7064. * `setAppLevelAppearance` API to set this value.
  7065. *
  7066. * @deprecated
  7067. * @platform darwin
  7068. */
  7069. getAppLevelAppearance(): ('dark' | 'light' | 'unknown');
  7070. /**
  7071. * The system color setting in RGB hexadecimal form (`#ABCDEF`). See the Windows
  7072. * docs and the macOS docs for more details.
  7073. *
  7074. * The following colors are only available on macOS 10.14: `find-highlight`,
  7075. * `selected-content-background`, `separator`,
  7076. * `unemphasized-selected-content-background`,
  7077. * `unemphasized-selected-text-background`, and `unemphasized-selected-text`.
  7078. *
  7079. * @platform win32,darwin
  7080. */
  7081. 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;
  7082. /**
  7083. * Can be `dark`, `light` or `unknown`.
  7084. *
  7085. * Gets the macOS appearance setting that is currently applied to your application,
  7086. * maps to NSApplication.effectiveAppearance
  7087. *
  7088. * @platform darwin
  7089. */
  7090. getEffectiveAppearance(): ('dark' | 'light' | 'unknown');
  7091. /**
  7092. * Can be `not-determined`, `granted`, `denied`, `restricted` or `unknown`.
  7093. *
  7094. * This user consent was not required on macOS 10.13 High Sierra or lower so this
  7095. * method will always return `granted`. macOS 10.14 Mojave or higher requires
  7096. * consent for `microphone` and `camera` access. macOS 10.15 Catalina or higher
  7097. * requires consent for `screen` access.
  7098. *
  7099. * Windows 10 has a global setting controlling `microphone` and `camera` access for
  7100. * all win32 applications. It will always return `granted` for `screen` and for all
  7101. * media types on older versions of Windows.
  7102. *
  7103. * @platform win32,darwin
  7104. */
  7105. getMediaAccessStatus(mediaType: 'microphone' | 'camera' | 'screen'): ('not-determined' | 'granted' | 'denied' | 'restricted' | 'unknown');
  7106. /**
  7107. * The standard system color formatted as `#RRGGBBAA`.
  7108. *
  7109. * Returns one of several standard system colors that automatically adapt to
  7110. * vibrancy and changes in accessibility settings like 'Increase contrast' and
  7111. * 'Reduce transparency'. See Apple Documentation for more details.
  7112. *
  7113. * @platform darwin
  7114. */
  7115. getSystemColor(color: 'blue' | 'brown' | 'gray' | 'green' | 'orange' | 'pink' | 'purple' | 'red' | 'yellow'): string;
  7116. /**
  7117. * The value of `key` in `NSUserDefaults`.
  7118. *
  7119. * Some popular `key` and `type`s are:
  7120. *
  7121. * * `AppleInterfaceStyle`: `string`
  7122. * * `AppleAquaColorVariant`: `integer`
  7123. * * `AppleHighlightColor`: `string`
  7124. * * `AppleShowScrollBars`: `string`
  7125. * * `NSNavRecentPlaces`: `array`
  7126. * * `NSPreferredWebServices`: `dictionary`
  7127. * * `NSUserDictionaryReplacementItems`: `array`
  7128. *
  7129. * @platform darwin
  7130. */
  7131. getUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary'): any;
  7132. /**
  7133. * `true` if DWM composition (Aero Glass) is enabled, and `false` otherwise.
  7134. *
  7135. * An example of using it to determine if you should create a transparent window or
  7136. * not (transparent windows won't work correctly when DWM composition is disabled):
  7137. *
  7138. * @platform win32
  7139. */
  7140. isAeroGlassEnabled(): boolean;
  7141. /**
  7142. * Whether the system is in Dark Mode.
  7143. *
  7144. * **Note:** On macOS 10.15 Catalina in order for this API to return the correct
  7145. * value when in the "automatic" dark mode setting you must either have
  7146. * `NSRequiresAquaSystemAppearance=false` in your `Info.plist` or be on Electron
  7147. * `>=7.0.0`. See the dark mode guide for more information.
  7148. *
  7149. **Deprecated:** Should use the new `nativeTheme.shouldUseDarkColors` API.
  7150. *
  7151. * @deprecated
  7152. * @platform darwin,win32
  7153. */
  7154. isDarkMode(): boolean;
  7155. /**
  7156. * `true` if a high contrast theme is active, `false` otherwise.
  7157. *
  7158. * **Deprecated:** Should use the new `nativeTheme.shouldUseHighContrastColors`
  7159. * API.
  7160. *
  7161. * @deprecated
  7162. * @platform darwin,win32
  7163. */
  7164. isHighContrastColorScheme(): boolean;
  7165. /**
  7166. * `true` if an inverted color scheme (a high contrast color scheme with light text
  7167. * and dark backgrounds) is active, `false` otherwise.
  7168. *
  7169. * **Deprecated:** Should use the new `nativeTheme.shouldUseInvertedColorScheme`
  7170. * API.
  7171. *
  7172. * @deprecated
  7173. * @platform win32
  7174. */
  7175. isInvertedColorScheme(): boolean;
  7176. /**
  7177. * Whether the Swipe between pages setting is on.
  7178. *
  7179. * @platform darwin
  7180. */
  7181. isSwipeTrackingFromScrollEventsEnabled(): boolean;
  7182. /**
  7183. * `true` if the current process is a trusted accessibility client and `false` if
  7184. * it is not.
  7185. *
  7186. * @platform darwin
  7187. */
  7188. isTrustedAccessibilityClient(prompt: boolean): boolean;
  7189. /**
  7190. * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
  7191. * contains the user information dictionary sent along with the notification.
  7192. *
  7193. * @platform darwin
  7194. */
  7195. postLocalNotification(event: string, userInfo: Record<string, any>): void;
  7196. /**
  7197. * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
  7198. * contains the user information dictionary sent along with the notification.
  7199. *
  7200. * @platform darwin
  7201. */
  7202. postNotification(event: string, userInfo: Record<string, any>, deliverImmediately?: boolean): void;
  7203. /**
  7204. * Posts `event` as native notifications of macOS. The `userInfo` is an Object that
  7205. * contains the user information dictionary sent along with the notification.
  7206. *
  7207. * @platform darwin
  7208. */
  7209. postWorkspaceNotification(event: string, userInfo: Record<string, any>): void;
  7210. /**
  7211. * resolves if the user has successfully authenticated with Touch ID.
  7212. *
  7213. * This API itself will not protect your user data; rather, it is a mechanism to
  7214. * allow you to do so. Native apps will need to set Access Control Constants like
  7215. * `kSecAccessControlUserPresence` on their keychain entry so that reading it would
  7216. * auto-prompt for Touch ID biometric consent. This could be done with
  7217. * `node-keytar`, such that one would store an encryption key with `node-keytar`
  7218. * and only fetch it if `promptTouchID()` resolves.
  7219. *
  7220. * **NOTE:** This API will return a rejected Promise on macOS systems older than
  7221. * Sierra 10.12.2.
  7222. *
  7223. * @platform darwin
  7224. */
  7225. promptTouchID(reason: string): Promise<void>;
  7226. /**
  7227. * Add the specified defaults to your application's `NSUserDefaults`.
  7228. *
  7229. * @platform darwin
  7230. */
  7231. registerDefaults(defaults: Record<string, (string) | (boolean) | (number)>): void;
  7232. /**
  7233. * Removes the `key` in `NSUserDefaults`. This can be used to restore the default
  7234. * or global value of a `key` previously set with `setUserDefault`.
  7235. *
  7236. * @platform darwin
  7237. */
  7238. removeUserDefault(key: string): void;
  7239. /**
  7240. * Sets the appearance setting for your application, this should override the
  7241. * system default and override the value of `getEffectiveAppearance`.
  7242. *
  7243. * @deprecated
  7244. * @platform darwin
  7245. */
  7246. setAppLevelAppearance(appearance: (('dark' | 'light')) | (null)): void;
  7247. /**
  7248. * Set the value of `key` in `NSUserDefaults`.
  7249. *
  7250. * Note that `type` should match actual type of `value`. An exception is thrown if
  7251. * they don't.
  7252. *
  7253. Some popular `key` and `type`s are:
  7254. * `ApplePressAndHoldEnabled`: `boolean`
  7255. *
  7256. * @platform darwin
  7257. */
  7258. setUserDefault(key: string, type: 'string' | 'boolean' | 'integer' | 'float' | 'double' | 'url' | 'array' | 'dictionary', value: string): void;
  7259. /**
  7260. * The ID of this subscription
  7261. *
  7262. * Same as `subscribeNotification`, but uses `NSNotificationCenter` for local
  7263. * defaults. This is necessary for events such as
  7264. * `NSUserDefaultsDidChangeNotification`.
  7265. *
  7266. * @platform darwin
  7267. */
  7268. subscribeLocalNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
  7269. /**
  7270. * The ID of this subscription
  7271. *
  7272. * Subscribes to native notifications of macOS, `callback` will be called with
  7273. * `callback(event, userInfo)` when the corresponding `event` happens. The
  7274. * `userInfo` is an Object that contains the user information dictionary sent along
  7275. * with the notification. The `object` is the sender of the notification, and only
  7276. * supports `NSString` values for now.
  7277. *
  7278. * The `id` of the subscriber is returned, which can be used to unsubscribe the
  7279. * `event`.
  7280. *
  7281. * Under the hood this API subscribes to `NSDistributedNotificationCenter`, example
  7282. * values of `event` are:
  7283. *
  7284. * * `AppleInterfaceThemeChangedNotification`
  7285. * * `AppleAquaColorVariantChanged`
  7286. * * `AppleColorPreferencesChangedNotification`
  7287. * * `AppleShowScrollBarsSettingChanged`
  7288. *
  7289. * @platform darwin
  7290. */
  7291. subscribeNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): number;
  7292. /**
  7293. * Same as `subscribeNotification`, but uses
  7294. * `NSWorkspace.sharedWorkspace.notificationCenter`. This is necessary for events
  7295. * such as `NSWorkspaceDidActivateApplicationNotification`.
  7296. *
  7297. * @platform darwin
  7298. */
  7299. subscribeWorkspaceNotification(event: string, callback: (event: string, userInfo: Record<string, unknown>, object: string) => void): void;
  7300. /**
  7301. * Same as `unsubscribeNotification`, but removes the subscriber from
  7302. * `NSNotificationCenter`.
  7303. *
  7304. * @platform darwin
  7305. */
  7306. unsubscribeLocalNotification(id: number): void;
  7307. /**
  7308. * Removes the subscriber with `id`.
  7309. *
  7310. * @platform darwin
  7311. */
  7312. unsubscribeNotification(id: number): void;
  7313. /**
  7314. * Same as `unsubscribeNotification`, but removes the subscriber from
  7315. * `NSWorkspace.sharedWorkspace.notificationCenter`.
  7316. *
  7317. * @platform darwin
  7318. */
  7319. unsubscribeWorkspaceNotification(id: number): void;
  7320. /**
  7321. * A `String` property that can be `dark`, `light` or `unknown`. It determines the
  7322. * macOS appearance setting for your application. This maps to values in:
  7323. * NSApplication.appearance. Setting this will override the system default as well
  7324. * as the value of `getEffectiveAppearance`.
  7325. *
  7326. * Possible values that can be set are `dark` and `light`, and possible return
  7327. * values are `dark`, `light`, and `unknown`.
  7328. *
  7329. This property is only available on macOS 10.14 Mojave or newer.
  7330. *
  7331. * @platform darwin
  7332. */
  7333. appLevelAppearance: ('dark' | 'light' | 'unknown');
  7334. /**
  7335. * A `String` property that can be `dark`, `light` or `unknown`.
  7336. *
  7337. * Returns the macOS appearance setting that is currently applied to your
  7338. * application, maps to NSApplication.effectiveAppearance
  7339. *
  7340. * @platform darwin
  7341. */
  7342. readonly effectiveAppearance: ('dark' | 'light' | 'unknown');
  7343. }
  7344. interface Task {
  7345. // Docs: https://electronjs.org/docs/api/structures/task
  7346. /**
  7347. * The command line arguments when `program` is executed.
  7348. */
  7349. arguments: string;
  7350. /**
  7351. * Description of this task.
  7352. */
  7353. description: string;
  7354. /**
  7355. * The icon index in the icon file. If an icon file consists of two or more icons,
  7356. * set this value to identify the icon. If an icon file consists of one icon, this
  7357. * value is 0.
  7358. */
  7359. iconIndex: number;
  7360. /**
  7361. * The absolute path to an icon to be displayed in a JumpList, which can be an
  7362. * arbitrary resource file that contains an icon. You can usually specify
  7363. * `process.execPath` to show the icon of the program.
  7364. */
  7365. iconPath: string;
  7366. /**
  7367. * Path of the program to execute, usually you should specify `process.execPath`
  7368. * which opens the current program.
  7369. */
  7370. program: string;
  7371. /**
  7372. * The string to be displayed in a JumpList.
  7373. */
  7374. title: string;
  7375. /**
  7376. * The working directory. Default is empty.
  7377. */
  7378. workingDirectory?: string;
  7379. }
  7380. interface ThumbarButton {
  7381. // Docs: https://electronjs.org/docs/api/structures/thumbar-button
  7382. click: Function;
  7383. /**
  7384. * Control specific states and behaviors of the button. By default, it is
  7385. * `['enabled']`.
  7386. */
  7387. flags?: string[];
  7388. /**
  7389. * The icon showing in thumbnail toolbar.
  7390. */
  7391. icon: NativeImage;
  7392. /**
  7393. * The text of the button's tooltip.
  7394. */
  7395. tooltip?: string;
  7396. }
  7397. class TouchBar {
  7398. // Docs: https://electronjs.org/docs/api/touch-bar
  7399. /**
  7400. * TouchBar
  7401. */
  7402. constructor(options: TouchBarConstructorOptions);
  7403. escapeItem: (TouchBarButton | TouchBarColorPicker | TouchBarGroup | TouchBarLabel | TouchBarPopover | TouchBarScrubber | TouchBarSegmentedControl | TouchBarSlider | TouchBarSpacer | null);
  7404. static TouchBarButton: typeof TouchBarButton;
  7405. static TouchBarColorPicker: typeof TouchBarColorPicker;
  7406. static TouchBarGroup: typeof TouchBarGroup;
  7407. static TouchBarLabel: typeof TouchBarLabel;
  7408. static TouchBarOtherItemsProxy: typeof TouchBarOtherItemsProxy;
  7409. static TouchBarPopover: typeof TouchBarPopover;
  7410. static TouchBarScrubber: typeof TouchBarScrubber;
  7411. static TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
  7412. static TouchBarSlider: typeof TouchBarSlider;
  7413. static TouchBarSpacer: typeof TouchBarSpacer;
  7414. }
  7415. class TouchBarButton {
  7416. // Docs: https://electronjs.org/docs/api/touch-bar-button
  7417. /**
  7418. * TouchBarButton
  7419. */
  7420. constructor(options: TouchBarButtonConstructorOptions);
  7421. accessibilityLabel: string;
  7422. backgroundColor: string;
  7423. enabled: boolean;
  7424. icon: NativeImage;
  7425. iconPosition: ('left' | 'right' | 'overlay');
  7426. label: string;
  7427. }
  7428. class TouchBarColorPicker extends NodeEventEmitter {
  7429. // Docs: https://electronjs.org/docs/api/touch-bar-color-picker
  7430. /**
  7431. * TouchBarColorPicker
  7432. */
  7433. constructor(options: TouchBarColorPickerConstructorOptions);
  7434. availableColors: string[];
  7435. selectedColor: string;
  7436. }
  7437. class TouchBarGroup extends NodeEventEmitter {
  7438. // Docs: https://electronjs.org/docs/api/touch-bar-group
  7439. /**
  7440. * TouchBarGroup
  7441. */
  7442. constructor(options: TouchBarGroupConstructorOptions);
  7443. }
  7444. class TouchBarLabel extends NodeEventEmitter {
  7445. // Docs: https://electronjs.org/docs/api/touch-bar-label
  7446. /**
  7447. * TouchBarLabel
  7448. */
  7449. constructor(options: TouchBarLabelConstructorOptions);
  7450. accessibilityLabel: string;
  7451. label: string;
  7452. textColor: string;
  7453. }
  7454. class TouchBarOtherItemsProxy extends NodeEventEmitter {
  7455. // Docs: https://electronjs.org/docs/api/touch-bar-other-items-proxy
  7456. /**
  7457. * TouchBarOtherItemsProxy
  7458. */
  7459. constructor();
  7460. }
  7461. class TouchBarPopover extends NodeEventEmitter {
  7462. // Docs: https://electronjs.org/docs/api/touch-bar-popover
  7463. /**
  7464. * TouchBarPopover
  7465. */
  7466. constructor(options: TouchBarPopoverConstructorOptions);
  7467. icon: NativeImage;
  7468. label: string;
  7469. }
  7470. class TouchBarScrubber extends NodeEventEmitter {
  7471. // Docs: https://electronjs.org/docs/api/touch-bar-scrubber
  7472. /**
  7473. * TouchBarScrubber
  7474. */
  7475. constructor(options: TouchBarScrubberConstructorOptions);
  7476. continuous: boolean;
  7477. items: ScrubberItem[];
  7478. mode: ('fixed' | 'free');
  7479. overlayStyle: ('background' | 'outline' | 'none');
  7480. selectedStyle: ('background' | 'outline' | 'none');
  7481. showArrowButtons: boolean;
  7482. }
  7483. class TouchBarSegmentedControl extends NodeEventEmitter {
  7484. // Docs: https://electronjs.org/docs/api/touch-bar-segmented-control
  7485. /**
  7486. * TouchBarSegmentedControl
  7487. */
  7488. constructor(options: TouchBarSegmentedControlConstructorOptions);
  7489. mode: ('single' | 'multiple' | 'buttons');
  7490. segments: SegmentedControlSegment[];
  7491. segmentStyle: string;
  7492. selectedIndex: number;
  7493. }
  7494. class TouchBarSlider extends NodeEventEmitter {
  7495. // Docs: https://electronjs.org/docs/api/touch-bar-slider
  7496. /**
  7497. * TouchBarSlider
  7498. */
  7499. constructor(options: TouchBarSliderConstructorOptions);
  7500. label: string;
  7501. maxValue: number;
  7502. minValue: number;
  7503. value: number;
  7504. }
  7505. class TouchBarSpacer extends NodeEventEmitter {
  7506. // Docs: https://electronjs.org/docs/api/touch-bar-spacer
  7507. /**
  7508. * TouchBarSpacer
  7509. */
  7510. constructor(options: TouchBarSpacerConstructorOptions);
  7511. size: ('small' | 'large' | 'flexible');
  7512. }
  7513. interface TraceCategoriesAndOptions {
  7514. // Docs: https://electronjs.org/docs/api/structures/trace-categories-and-options
  7515. /**
  7516. * A filter to control what category groups should be traced. A filter can have an
  7517. * optional '-' prefix to exclude category groups that contain a matching category.
  7518. * Having both included and excluded category patterns in the same list is not
  7519. * supported. Examples: `test_MyTest*`, `test_MyTest*,test_OtherStuff`,
  7520. * `-excluded_category1,-excluded_category2`.
  7521. */
  7522. categoryFilter: string;
  7523. /**
  7524. * Controls what kind of tracing is enabled, it is a comma-delimited sequence of
  7525. * the following strings: `record-until-full`, `record-continuously`,
  7526. * `trace-to-console`, `enable-sampling`, `enable-systrace`, e.g.
  7527. * `'record-until-full,enable-sampling'`. The first 3 options are trace recording
  7528. * modes and hence mutually exclusive. If more than one trace recording modes
  7529. * appear in the `traceOptions` string, the last one takes precedence. If none of
  7530. * the trace recording modes are specified, recording mode is `record-until-full`.
  7531. * The trace option will first be reset to the default option (`record_mode` set to
  7532. * `record-until-full`, `enable_sampling` and `enable_systrace` set to `false`)
  7533. * before options parsed from `traceOptions` are applied on it.
  7534. */
  7535. traceOptions: string;
  7536. }
  7537. interface TraceConfig {
  7538. // Docs: https://electronjs.org/docs/api/structures/trace-config
  7539. /**
  7540. * if true, filter event data according to a specific list of events that have been
  7541. * manually vetted to not include any PII. See the implementation in Chromium for
  7542. * specifics.
  7543. */
  7544. enable_argument_filter?: boolean;
  7545. /**
  7546. * a list of tracing categories to exclude. Can include glob-like patterns using
  7547. * `*` at the end of the category name. See tracing categories for the list of
  7548. * categories.
  7549. */
  7550. excluded_categories?: string[];
  7551. /**
  7552. * a list of histogram names to report with the trace.
  7553. */
  7554. histogram_names?: string[];
  7555. /**
  7556. * a list of tracing categories to include. Can include glob-like patterns using
  7557. * `*` at the end of the category name. See tracing categories for the list of
  7558. * categories.
  7559. */
  7560. included_categories?: string[];
  7561. /**
  7562. * a list of process IDs to include in the trace. If not specified, trace all
  7563. * processes.
  7564. */
  7565. included_process_ids?: number[];
  7566. /**
  7567. * if the `disabled-by-default-memory-infra` category is enabled, this contains
  7568. * optional additional configuration for data collection. See the Chromium
  7569. * memory-infra docs for more information.
  7570. */
  7571. memory_dump_config?: Record<string, any>;
  7572. /**
  7573. * Can be `record-until-full`, `record-continuously`, `record-as-much-as-possible`
  7574. * or `trace-to-console`. Defaults to `record-until-full`.
  7575. */
  7576. recording_mode?: ('record-until-full' | 'record-continuously' | 'record-as-much-as-possible' | 'trace-to-console');
  7577. /**
  7578. * maximum size of the trace recording buffer in events.
  7579. */
  7580. trace_buffer_size_in_events?: number;
  7581. /**
  7582. * maximum size of the trace recording buffer in kilobytes. Defaults to 100MB.
  7583. */
  7584. trace_buffer_size_in_kb?: number;
  7585. }
  7586. interface Transaction {
  7587. // Docs: https://electronjs.org/docs/api/structures/transaction
  7588. /**
  7589. * The error code if an error occurred while processing the transaction.
  7590. */
  7591. errorCode: number;
  7592. /**
  7593. * The error message if an error occurred while processing the transaction.
  7594. */
  7595. errorMessage: string;
  7596. /**
  7597. * The identifier of the restored transaction by the App Store.
  7598. */
  7599. originalTransactionIdentifier: string;
  7600. payment: Payment;
  7601. /**
  7602. * The date the transaction was added to the App Store’s payment queue.
  7603. */
  7604. transactionDate: string;
  7605. /**
  7606. * A string that uniquely identifies a successful payment transaction.
  7607. */
  7608. transactionIdentifier: string;
  7609. /**
  7610. * The transaction state, can be `purchasing`, `purchased`, `failed`, `restored` or
  7611. * `deferred`.
  7612. */
  7613. transactionState: ('purchasing' | 'purchased' | 'failed' | 'restored' | 'deferred');
  7614. }
  7615. class Tray extends NodeEventEmitter {
  7616. // Docs: https://electronjs.org/docs/api/tray
  7617. /**
  7618. * Emitted when the tray balloon is clicked.
  7619. *
  7620. * @platform win32
  7621. */
  7622. on(event: 'balloon-click', listener: Function): this;
  7623. once(event: 'balloon-click', listener: Function): this;
  7624. addListener(event: 'balloon-click', listener: Function): this;
  7625. removeListener(event: 'balloon-click', listener: Function): this;
  7626. /**
  7627. * Emitted when the tray balloon is closed because of timeout or user manually
  7628. * closes it.
  7629. *
  7630. * @platform win32
  7631. */
  7632. on(event: 'balloon-closed', listener: Function): this;
  7633. once(event: 'balloon-closed', listener: Function): this;
  7634. addListener(event: 'balloon-closed', listener: Function): this;
  7635. removeListener(event: 'balloon-closed', listener: Function): this;
  7636. /**
  7637. * Emitted when the tray balloon shows.
  7638. *
  7639. * @platform win32
  7640. */
  7641. on(event: 'balloon-show', listener: Function): this;
  7642. once(event: 'balloon-show', listener: Function): this;
  7643. addListener(event: 'balloon-show', listener: Function): this;
  7644. removeListener(event: 'balloon-show', listener: Function): this;
  7645. /**
  7646. * Emitted when the tray icon is clicked.
  7647. */
  7648. on(event: 'click', listener: (event: KeyboardEvent,
  7649. /**
  7650. * The bounds of tray icon.
  7651. */
  7652. bounds: Rectangle,
  7653. /**
  7654. * The position of the event.
  7655. */
  7656. position: Point) => void): this;
  7657. once(event: 'click', listener: (event: KeyboardEvent,
  7658. /**
  7659. * The bounds of tray icon.
  7660. */
  7661. bounds: Rectangle,
  7662. /**
  7663. * The position of the event.
  7664. */
  7665. position: Point) => void): this;
  7666. addListener(event: 'click', listener: (event: KeyboardEvent,
  7667. /**
  7668. * The bounds of tray icon.
  7669. */
  7670. bounds: Rectangle,
  7671. /**
  7672. * The position of the event.
  7673. */
  7674. position: Point) => void): this;
  7675. removeListener(event: 'click', listener: (event: KeyboardEvent,
  7676. /**
  7677. * The bounds of tray icon.
  7678. */
  7679. bounds: Rectangle,
  7680. /**
  7681. * The position of the event.
  7682. */
  7683. position: Point) => void): this;
  7684. /**
  7685. * Emitted when the tray icon is double clicked.
  7686. *
  7687. * @platform darwin,win32
  7688. */
  7689. on(event: 'double-click', listener: (event: KeyboardEvent,
  7690. /**
  7691. * The bounds of tray icon.
  7692. */
  7693. bounds: Rectangle) => void): this;
  7694. once(event: 'double-click', listener: (event: KeyboardEvent,
  7695. /**
  7696. * The bounds of tray icon.
  7697. */
  7698. bounds: Rectangle) => void): this;
  7699. addListener(event: 'double-click', listener: (event: KeyboardEvent,
  7700. /**
  7701. * The bounds of tray icon.
  7702. */
  7703. bounds: Rectangle) => void): this;
  7704. removeListener(event: 'double-click', listener: (event: KeyboardEvent,
  7705. /**
  7706. * The bounds of tray icon.
  7707. */
  7708. bounds: Rectangle) => void): this;
  7709. /**
  7710. * Emitted when a drag operation ends on the tray or ends at another location.
  7711. *
  7712. * @platform darwin
  7713. */
  7714. on(event: 'drag-end', listener: Function): this;
  7715. once(event: 'drag-end', listener: Function): this;
  7716. addListener(event: 'drag-end', listener: Function): this;
  7717. removeListener(event: 'drag-end', listener: Function): this;
  7718. /**
  7719. * Emitted when a drag operation enters the tray icon.
  7720. *
  7721. * @platform darwin
  7722. */
  7723. on(event: 'drag-enter', listener: Function): this;
  7724. once(event: 'drag-enter', listener: Function): this;
  7725. addListener(event: 'drag-enter', listener: Function): this;
  7726. removeListener(event: 'drag-enter', listener: Function): this;
  7727. /**
  7728. * Emitted when a drag operation exits the tray icon.
  7729. *
  7730. * @platform darwin
  7731. */
  7732. on(event: 'drag-leave', listener: Function): this;
  7733. once(event: 'drag-leave', listener: Function): this;
  7734. addListener(event: 'drag-leave', listener: Function): this;
  7735. removeListener(event: 'drag-leave', listener: Function): this;
  7736. /**
  7737. * Emitted when any dragged items are dropped on the tray icon.
  7738. *
  7739. * @platform darwin
  7740. */
  7741. on(event: 'drop', listener: Function): this;
  7742. once(event: 'drop', listener: Function): this;
  7743. addListener(event: 'drop', listener: Function): this;
  7744. removeListener(event: 'drop', listener: Function): this;
  7745. /**
  7746. * Emitted when dragged files are dropped in the tray icon.
  7747. *
  7748. * @platform darwin
  7749. */
  7750. on(event: 'drop-files', listener: (event: Event,
  7751. /**
  7752. * The paths of the dropped files.
  7753. */
  7754. files: string[]) => void): this;
  7755. once(event: 'drop-files', listener: (event: Event,
  7756. /**
  7757. * The paths of the dropped files.
  7758. */
  7759. files: string[]) => void): this;
  7760. addListener(event: 'drop-files', listener: (event: Event,
  7761. /**
  7762. * The paths of the dropped files.
  7763. */
  7764. files: string[]) => void): this;
  7765. removeListener(event: 'drop-files', listener: (event: Event,
  7766. /**
  7767. * The paths of the dropped files.
  7768. */
  7769. files: string[]) => void): this;
  7770. /**
  7771. * Emitted when dragged text is dropped in the tray icon.
  7772. *
  7773. * @platform darwin
  7774. */
  7775. on(event: 'drop-text', listener: (event: Event,
  7776. /**
  7777. * the dropped text string.
  7778. */
  7779. text: string) => void): this;
  7780. once(event: 'drop-text', listener: (event: Event,
  7781. /**
  7782. * the dropped text string.
  7783. */
  7784. text: string) => void): this;
  7785. addListener(event: 'drop-text', listener: (event: Event,
  7786. /**
  7787. * the dropped text string.
  7788. */
  7789. text: string) => void): this;
  7790. removeListener(event: 'drop-text', listener: (event: Event,
  7791. /**
  7792. * the dropped text string.
  7793. */
  7794. text: string) => void): this;
  7795. /**
  7796. * Emitted when the mouse clicks the tray icon.
  7797. *
  7798. * @platform darwin
  7799. */
  7800. on(event: 'mouse-down', listener: (event: KeyboardEvent,
  7801. /**
  7802. * The position of the event.
  7803. */
  7804. position: Point) => void): this;
  7805. once(event: 'mouse-down', listener: (event: KeyboardEvent,
  7806. /**
  7807. * The position of the event.
  7808. */
  7809. position: Point) => void): this;
  7810. addListener(event: 'mouse-down', listener: (event: KeyboardEvent,
  7811. /**
  7812. * The position of the event.
  7813. */
  7814. position: Point) => void): this;
  7815. removeListener(event: 'mouse-down', listener: (event: KeyboardEvent,
  7816. /**
  7817. * The position of the event.
  7818. */
  7819. position: Point) => void): this;
  7820. /**
  7821. * Emitted when the mouse enters the tray icon.
  7822. *
  7823. * @platform darwin
  7824. */
  7825. on(event: 'mouse-enter', listener: (event: KeyboardEvent,
  7826. /**
  7827. * The position of the event.
  7828. */
  7829. position: Point) => void): this;
  7830. once(event: 'mouse-enter', listener: (event: KeyboardEvent,
  7831. /**
  7832. * The position of the event.
  7833. */
  7834. position: Point) => void): this;
  7835. addListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
  7836. /**
  7837. * The position of the event.
  7838. */
  7839. position: Point) => void): this;
  7840. removeListener(event: 'mouse-enter', listener: (event: KeyboardEvent,
  7841. /**
  7842. * The position of the event.
  7843. */
  7844. position: Point) => void): this;
  7845. /**
  7846. * Emitted when the mouse exits the tray icon.
  7847. *
  7848. * @platform darwin
  7849. */
  7850. on(event: 'mouse-leave', listener: (event: KeyboardEvent,
  7851. /**
  7852. * The position of the event.
  7853. */
  7854. position: Point) => void): this;
  7855. once(event: 'mouse-leave', listener: (event: KeyboardEvent,
  7856. /**
  7857. * The position of the event.
  7858. */
  7859. position: Point) => void): this;
  7860. addListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
  7861. /**
  7862. * The position of the event.
  7863. */
  7864. position: Point) => void): this;
  7865. removeListener(event: 'mouse-leave', listener: (event: KeyboardEvent,
  7866. /**
  7867. * The position of the event.
  7868. */
  7869. position: Point) => void): this;
  7870. /**
  7871. * Emitted when the mouse moves in the tray icon.
  7872. *
  7873. * @platform darwin,win32
  7874. */
  7875. on(event: 'mouse-move', listener: (event: KeyboardEvent,
  7876. /**
  7877. * The position of the event.
  7878. */
  7879. position: Point) => void): this;
  7880. once(event: 'mouse-move', listener: (event: KeyboardEvent,
  7881. /**
  7882. * The position of the event.
  7883. */
  7884. position: Point) => void): this;
  7885. addListener(event: 'mouse-move', listener: (event: KeyboardEvent,
  7886. /**
  7887. * The position of the event.
  7888. */
  7889. position: Point) => void): this;
  7890. removeListener(event: 'mouse-move', listener: (event: KeyboardEvent,
  7891. /**
  7892. * The position of the event.
  7893. */
  7894. position: Point) => void): this;
  7895. /**
  7896. * Emitted when the mouse is released from clicking the tray icon.
  7897. *
  7898. * Note: This will not be emitted if you have set a context menu for your Tray
  7899. * using `tray.setContextMenu`, as a result of macOS-level constraints.
  7900. *
  7901. * @platform darwin
  7902. */
  7903. on(event: 'mouse-up', listener: (event: KeyboardEvent,
  7904. /**
  7905. * The position of the event.
  7906. */
  7907. position: Point) => void): this;
  7908. once(event: 'mouse-up', listener: (event: KeyboardEvent,
  7909. /**
  7910. * The position of the event.
  7911. */
  7912. position: Point) => void): this;
  7913. addListener(event: 'mouse-up', listener: (event: KeyboardEvent,
  7914. /**
  7915. * The position of the event.
  7916. */
  7917. position: Point) => void): this;
  7918. removeListener(event: 'mouse-up', listener: (event: KeyboardEvent,
  7919. /**
  7920. * The position of the event.
  7921. */
  7922. position: Point) => void): this;
  7923. /**
  7924. * Emitted when the tray icon is right clicked.
  7925. *
  7926. * @platform darwin,win32
  7927. */
  7928. on(event: 'right-click', listener: (event: KeyboardEvent,
  7929. /**
  7930. * The bounds of tray icon.
  7931. */
  7932. bounds: Rectangle) => void): this;
  7933. once(event: 'right-click', listener: (event: KeyboardEvent,
  7934. /**
  7935. * The bounds of tray icon.
  7936. */
  7937. bounds: Rectangle) => void): this;
  7938. addListener(event: 'right-click', listener: (event: KeyboardEvent,
  7939. /**
  7940. * The bounds of tray icon.
  7941. */
  7942. bounds: Rectangle) => void): this;
  7943. removeListener(event: 'right-click', listener: (event: KeyboardEvent,
  7944. /**
  7945. * The bounds of tray icon.
  7946. */
  7947. bounds: Rectangle) => void): this;
  7948. /**
  7949. * Tray
  7950. */
  7951. constructor(image: (NativeImage) | (string), guid?: string);
  7952. /**
  7953. * Closes an open context menu, as set by `tray.setContextMenu()`.
  7954. *
  7955. * @platform darwin,win32
  7956. */
  7957. closeContextMenu(): void;
  7958. /**
  7959. * Destroys the tray icon immediately.
  7960. */
  7961. destroy(): void;
  7962. /**
  7963. * Displays a tray balloon.
  7964. *
  7965. * @platform win32
  7966. */
  7967. displayBalloon(options: DisplayBalloonOptions): void;
  7968. /**
  7969. * Returns focus to the taskbar notification area. Notification area icons should
  7970. * use this message when they have completed their UI operation. For example, if
  7971. * the icon displays a shortcut menu, but the user presses ESC to cancel it, use
  7972. * `tray.focus()` to return focus to the notification area.
  7973. *
  7974. * @platform win32
  7975. */
  7976. focus(): void;
  7977. /**
  7978. * The `bounds` of this tray icon as `Object`.
  7979. *
  7980. * @platform darwin,win32
  7981. */
  7982. getBounds(): Rectangle;
  7983. /**
  7984. * Whether double click events will be ignored.
  7985. *
  7986. * @platform darwin
  7987. */
  7988. getIgnoreDoubleClickEvents(): boolean;
  7989. /**
  7990. * the title displayed next to the tray icon in the status bar
  7991. *
  7992. * @platform darwin
  7993. */
  7994. getTitle(): string;
  7995. /**
  7996. * Whether the tray icon is destroyed.
  7997. */
  7998. isDestroyed(): boolean;
  7999. /**
  8000. * Pops up the context menu of the tray icon. When `menu` is passed, the `menu`
  8001. * will be shown instead of the tray icon's context menu.
  8002. *
  8003. The `position` is only available on Windows, and it is (0, 0) by default.
  8004. *
  8005. * @platform darwin,win32
  8006. */
  8007. popUpContextMenu(menu?: Menu, position?: Point): void;
  8008. /**
  8009. * Removes a tray balloon.
  8010. *
  8011. * @platform win32
  8012. */
  8013. removeBalloon(): void;
  8014. /**
  8015. * Sets the context menu for this icon.
  8016. */
  8017. setContextMenu(menu: (Menu) | (null)): void;
  8018. /**
  8019. * Sets the option to ignore double click events. Ignoring these events allows you
  8020. * to detect every individual click of the tray icon.
  8021. *
  8022. This value is set to false by default.
  8023. *
  8024. * @platform darwin
  8025. */
  8026. setIgnoreDoubleClickEvents(ignore: boolean): void;
  8027. /**
  8028. * Sets the `image` associated with this tray icon.
  8029. */
  8030. setImage(image: (NativeImage) | (string)): void;
  8031. /**
  8032. * Sets the `image` associated with this tray icon when pressed on macOS.
  8033. *
  8034. * @platform darwin
  8035. */
  8036. setPressedImage(image: (NativeImage) | (string)): void;
  8037. /**
  8038. * Sets the title displayed next to the tray icon in the status bar (Support ANSI
  8039. * colors).
  8040. *
  8041. * @platform darwin
  8042. */
  8043. setTitle(title: string, options?: TitleOptions): void;
  8044. /**
  8045. * Sets the hover text for this tray icon.
  8046. */
  8047. setToolTip(toolTip: string): void;
  8048. }
  8049. interface UploadBlob {
  8050. // Docs: https://electronjs.org/docs/api/structures/upload-blob
  8051. /**
  8052. * UUID of blob data to upload.
  8053. */
  8054. blobUUID: string;
  8055. /**
  8056. * `blob`.
  8057. */
  8058. type: string;
  8059. }
  8060. interface UploadData {
  8061. // Docs: https://electronjs.org/docs/api/structures/upload-data
  8062. /**
  8063. * UUID of blob data. Use ses.getBlobData method to retrieve the data.
  8064. */
  8065. blobUUID?: string;
  8066. /**
  8067. * Content being sent.
  8068. */
  8069. bytes: Buffer;
  8070. /**
  8071. * Path of file being uploaded.
  8072. */
  8073. file?: string;
  8074. }
  8075. interface UploadFile {
  8076. // Docs: https://electronjs.org/docs/api/structures/upload-file
  8077. /**
  8078. * Path of file to be uploaded.
  8079. */
  8080. filePath: string;
  8081. /**
  8082. * Number of bytes to read from `offset`. Defaults to `0`.
  8083. */
  8084. length: number;
  8085. /**
  8086. * Last Modification time in number of seconds since the UNIX epoch.
  8087. */
  8088. modificationTime: number;
  8089. /**
  8090. * Defaults to `0`.
  8091. */
  8092. offset: number;
  8093. /**
  8094. * `file`.
  8095. */
  8096. type: string;
  8097. }
  8098. interface UploadRawData {
  8099. // Docs: https://electronjs.org/docs/api/structures/upload-raw-data
  8100. /**
  8101. * Data to be uploaded.
  8102. */
  8103. bytes: Buffer;
  8104. /**
  8105. * `rawData`.
  8106. */
  8107. type: string;
  8108. }
  8109. class WebContents extends NodeEventEmitter {
  8110. // Docs: https://electronjs.org/docs/api/web-contents
  8111. /**
  8112. * | undefined - A WebContents instance with the given ID, or `undefined` if there
  8113. * is no WebContents associated with the given ID.
  8114. */
  8115. static fromId(id: number): WebContents;
  8116. /**
  8117. * An array of all `WebContents` instances. This will contain web contents for all
  8118. * windows, webviews, opened devtools, and devtools extension background pages.
  8119. */
  8120. static getAllWebContents(): WebContents[];
  8121. /**
  8122. * The web contents that is focused in this application, otherwise returns `null`.
  8123. */
  8124. static getFocusedWebContents(): WebContents;
  8125. /**
  8126. * Emitted before dispatching the `keydown` and `keyup` events in the page. Calling
  8127. * `event.preventDefault` will prevent the page `keydown`/`keyup` events and the
  8128. * menu shortcuts.
  8129. *
  8130. To only prevent the menu shortcuts, use `setIgnoreMenuShortcuts`:
  8131. */
  8132. on(event: 'before-input-event', listener: (event: Event,
  8133. /**
  8134. * Input properties.
  8135. */
  8136. input: Input) => void): this;
  8137. once(event: 'before-input-event', listener: (event: Event,
  8138. /**
  8139. * Input properties.
  8140. */
  8141. input: Input) => void): this;
  8142. addListener(event: 'before-input-event', listener: (event: Event,
  8143. /**
  8144. * Input properties.
  8145. */
  8146. input: Input) => void): this;
  8147. removeListener(event: 'before-input-event', listener: (event: Event,
  8148. /**
  8149. * Input properties.
  8150. */
  8151. input: Input) => void): this;
  8152. /**
  8153. * Emitted when failed to verify the `certificate` for `url`.
  8154. *
  8155. The usage is the same with the `certificate-error` event of `app`.
  8156. */
  8157. on(event: 'certificate-error', listener: (event: Event,
  8158. url: string,
  8159. /**
  8160. * The error code.
  8161. */
  8162. error: string,
  8163. certificate: Certificate,
  8164. callback: (isTrusted: boolean) => void) => void): this;
  8165. once(event: 'certificate-error', listener: (event: Event,
  8166. url: string,
  8167. /**
  8168. * The error code.
  8169. */
  8170. error: string,
  8171. certificate: Certificate,
  8172. callback: (isTrusted: boolean) => void) => void): this;
  8173. addListener(event: 'certificate-error', listener: (event: Event,
  8174. url: string,
  8175. /**
  8176. * The error code.
  8177. */
  8178. error: string,
  8179. certificate: Certificate,
  8180. callback: (isTrusted: boolean) => void) => void): this;
  8181. removeListener(event: 'certificate-error', listener: (event: Event,
  8182. url: string,
  8183. /**
  8184. * The error code.
  8185. */
  8186. error: string,
  8187. certificate: Certificate,
  8188. callback: (isTrusted: boolean) => void) => void): this;
  8189. /**
  8190. * Emitted when the associated window logs a console message.
  8191. */
  8192. on(event: 'console-message', listener: (event: Event,
  8193. /**
  8194. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  8195. * `error`.
  8196. */
  8197. level: number,
  8198. /**
  8199. * The actual console message
  8200. */
  8201. message: string,
  8202. /**
  8203. * The line number of the source that triggered this console message
  8204. */
  8205. line: number,
  8206. sourceId: string) => void): this;
  8207. once(event: 'console-message', listener: (event: Event,
  8208. /**
  8209. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  8210. * `error`.
  8211. */
  8212. level: number,
  8213. /**
  8214. * The actual console message
  8215. */
  8216. message: string,
  8217. /**
  8218. * The line number of the source that triggered this console message
  8219. */
  8220. line: number,
  8221. sourceId: string) => void): this;
  8222. addListener(event: 'console-message', listener: (event: Event,
  8223. /**
  8224. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  8225. * `error`.
  8226. */
  8227. level: number,
  8228. /**
  8229. * The actual console message
  8230. */
  8231. message: string,
  8232. /**
  8233. * The line number of the source that triggered this console message
  8234. */
  8235. line: number,
  8236. sourceId: string) => void): this;
  8237. removeListener(event: 'console-message', listener: (event: Event,
  8238. /**
  8239. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  8240. * `error`.
  8241. */
  8242. level: number,
  8243. /**
  8244. * The actual console message
  8245. */
  8246. message: string,
  8247. /**
  8248. * The line number of the source that triggered this console message
  8249. */
  8250. line: number,
  8251. sourceId: string) => void): this;
  8252. /**
  8253. * Emitted when there is a new context menu that needs to be handled.
  8254. */
  8255. on(event: 'context-menu', listener: (event: Event,
  8256. params: ContextMenuParams) => void): this;
  8257. once(event: 'context-menu', listener: (event: Event,
  8258. params: ContextMenuParams) => void): this;
  8259. addListener(event: 'context-menu', listener: (event: Event,
  8260. params: ContextMenuParams) => void): this;
  8261. removeListener(event: 'context-menu', listener: (event: Event,
  8262. params: ContextMenuParams) => void): this;
  8263. /**
  8264. * Emitted when the renderer process crashes or is killed.
  8265. *
  8266. * **Deprecated:** This event is superceded by the `render-process-gone` event
  8267. * which contains more information about why the render process disappeared. It
  8268. * isn't always because it crashed. The `killed` boolean can be replaced by
  8269. * checking `reason === 'killed'` when you switch to that event.
  8270. *
  8271. * @deprecated
  8272. */
  8273. on(event: 'crashed', listener: (event: Event,
  8274. killed: boolean) => void): this;
  8275. once(event: 'crashed', listener: (event: Event,
  8276. killed: boolean) => void): this;
  8277. addListener(event: 'crashed', listener: (event: Event,
  8278. killed: boolean) => void): this;
  8279. removeListener(event: 'crashed', listener: (event: Event,
  8280. killed: boolean) => void): this;
  8281. /**
  8282. * Emitted when the cursor's type changes. The `type` parameter can be `default`,
  8283. * `crosshair`, `pointer`, `text`, `wait`, `help`, `e-resize`, `n-resize`,
  8284. * `ne-resize`, `nw-resize`, `s-resize`, `se-resize`, `sw-resize`, `w-resize`,
  8285. * `ns-resize`, `ew-resize`, `nesw-resize`, `nwse-resize`, `col-resize`,
  8286. * `row-resize`, `m-panning`, `e-panning`, `n-panning`, `ne-panning`, `nw-panning`,
  8287. * `s-panning`, `se-panning`, `sw-panning`, `w-panning`, `move`, `vertical-text`,
  8288. * `cell`, `context-menu`, `alias`, `progress`, `nodrop`, `copy`, `none`,
  8289. * `not-allowed`, `zoom-in`, `zoom-out`, `grab`, `grabbing` or `custom`.
  8290. *
  8291. * If the `type` parameter is `custom`, the `image` parameter will hold the custom
  8292. * cursor image in a `NativeImage`, and `scale`, `size` and `hotspot` will hold
  8293. * additional information about the custom cursor.
  8294. */
  8295. on(event: 'cursor-changed', listener: (event: Event,
  8296. type: string,
  8297. image: NativeImage,
  8298. /**
  8299. * scaling factor for the custom cursor.
  8300. */
  8301. scale: number,
  8302. /**
  8303. * the size of the `image`.
  8304. */
  8305. size: Size,
  8306. /**
  8307. * coordinates of the custom cursor's hotspot.
  8308. */
  8309. hotspot: Point) => void): this;
  8310. once(event: 'cursor-changed', listener: (event: Event,
  8311. type: string,
  8312. image: NativeImage,
  8313. /**
  8314. * scaling factor for the custom cursor.
  8315. */
  8316. scale: number,
  8317. /**
  8318. * the size of the `image`.
  8319. */
  8320. size: Size,
  8321. /**
  8322. * coordinates of the custom cursor's hotspot.
  8323. */
  8324. hotspot: Point) => void): this;
  8325. addListener(event: 'cursor-changed', listener: (event: Event,
  8326. type: string,
  8327. image: NativeImage,
  8328. /**
  8329. * scaling factor for the custom cursor.
  8330. */
  8331. scale: number,
  8332. /**
  8333. * the size of the `image`.
  8334. */
  8335. size: Size,
  8336. /**
  8337. * coordinates of the custom cursor's hotspot.
  8338. */
  8339. hotspot: Point) => void): this;
  8340. removeListener(event: 'cursor-changed', listener: (event: Event,
  8341. type: string,
  8342. image: NativeImage,
  8343. /**
  8344. * scaling factor for the custom cursor.
  8345. */
  8346. scale: number,
  8347. /**
  8348. * the size of the `image`.
  8349. */
  8350. size: Size,
  8351. /**
  8352. * coordinates of the custom cursor's hotspot.
  8353. */
  8354. hotspot: Point) => void): this;
  8355. /**
  8356. * Emitted when `desktopCapturer.getSources()` is called in the renderer process.
  8357. * Calling `event.preventDefault()` will make it return empty sources.
  8358. */
  8359. on(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
  8360. once(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
  8361. addListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
  8362. removeListener(event: 'desktop-capturer-get-sources', listener: (event: Event) => void): this;
  8363. /**
  8364. * Emitted when `webContents` is destroyed.
  8365. */
  8366. on(event: 'destroyed', listener: Function): this;
  8367. once(event: 'destroyed', listener: Function): this;
  8368. addListener(event: 'destroyed', listener: Function): this;
  8369. removeListener(event: 'destroyed', listener: Function): this;
  8370. /**
  8371. * Emitted when DevTools is closed.
  8372. */
  8373. on(event: 'devtools-closed', listener: Function): this;
  8374. once(event: 'devtools-closed', listener: Function): this;
  8375. addListener(event: 'devtools-closed', listener: Function): this;
  8376. removeListener(event: 'devtools-closed', listener: Function): this;
  8377. /**
  8378. * Emitted when DevTools is focused / opened.
  8379. */
  8380. on(event: 'devtools-focused', listener: Function): this;
  8381. once(event: 'devtools-focused', listener: Function): this;
  8382. addListener(event: 'devtools-focused', listener: Function): this;
  8383. removeListener(event: 'devtools-focused', listener: Function): this;
  8384. /**
  8385. * Emitted when DevTools is opened.
  8386. */
  8387. on(event: 'devtools-opened', listener: Function): this;
  8388. once(event: 'devtools-opened', listener: Function): this;
  8389. addListener(event: 'devtools-opened', listener: Function): this;
  8390. removeListener(event: 'devtools-opened', listener: Function): this;
  8391. /**
  8392. * Emitted when the devtools window instructs the webContents to reload
  8393. */
  8394. on(event: 'devtools-reload-page', listener: Function): this;
  8395. once(event: 'devtools-reload-page', listener: Function): this;
  8396. addListener(event: 'devtools-reload-page', listener: Function): this;
  8397. removeListener(event: 'devtools-reload-page', listener: Function): this;
  8398. /**
  8399. * Emitted when a `<webview>` has been attached to this web contents.
  8400. */
  8401. on(event: 'did-attach-webview', listener: (event: Event,
  8402. /**
  8403. * The guest web contents that is used by the `<webview>`.
  8404. */
  8405. webContents: WebContents) => void): this;
  8406. once(event: 'did-attach-webview', listener: (event: Event,
  8407. /**
  8408. * The guest web contents that is used by the `<webview>`.
  8409. */
  8410. webContents: WebContents) => void): this;
  8411. addListener(event: 'did-attach-webview', listener: (event: Event,
  8412. /**
  8413. * The guest web contents that is used by the `<webview>`.
  8414. */
  8415. webContents: WebContents) => void): this;
  8416. removeListener(event: 'did-attach-webview', listener: (event: Event,
  8417. /**
  8418. * The guest web contents that is used by the `<webview>`.
  8419. */
  8420. webContents: WebContents) => void): this;
  8421. /**
  8422. * Emitted when a page's theme color changes. This is usually due to encountering a
  8423. * meta tag:
  8424. */
  8425. on(event: 'did-change-theme-color', listener: (event: Event,
  8426. /**
  8427. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  8428. */
  8429. color: (string) | (null)) => void): this;
  8430. once(event: 'did-change-theme-color', listener: (event: Event,
  8431. /**
  8432. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  8433. */
  8434. color: (string) | (null)) => void): this;
  8435. addListener(event: 'did-change-theme-color', listener: (event: Event,
  8436. /**
  8437. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  8438. */
  8439. color: (string) | (null)) => void): this;
  8440. removeListener(event: 'did-change-theme-color', listener: (event: Event,
  8441. /**
  8442. * Theme color is in format of '#rrggbb'. It is `null` when no theme color is set.
  8443. */
  8444. color: (string) | (null)) => void): this;
  8445. /**
  8446. * This event is like `did-finish-load` but emitted when the load failed. The full
  8447. * list of error codes and their meaning is available here.
  8448. */
  8449. on(event: 'did-fail-load', listener: (event: Event,
  8450. errorCode: number,
  8451. errorDescription: string,
  8452. validatedURL: string,
  8453. isMainFrame: boolean,
  8454. frameProcessId: number,
  8455. frameRoutingId: number) => void): this;
  8456. once(event: 'did-fail-load', listener: (event: Event,
  8457. errorCode: number,
  8458. errorDescription: string,
  8459. validatedURL: string,
  8460. isMainFrame: boolean,
  8461. frameProcessId: number,
  8462. frameRoutingId: number) => void): this;
  8463. addListener(event: 'did-fail-load', listener: (event: Event,
  8464. errorCode: number,
  8465. errorDescription: string,
  8466. validatedURL: string,
  8467. isMainFrame: boolean,
  8468. frameProcessId: number,
  8469. frameRoutingId: number) => void): this;
  8470. removeListener(event: 'did-fail-load', listener: (event: Event,
  8471. errorCode: number,
  8472. errorDescription: string,
  8473. validatedURL: string,
  8474. isMainFrame: boolean,
  8475. frameProcessId: number,
  8476. frameRoutingId: number) => void): this;
  8477. /**
  8478. * This event is like `did-fail-load` but emitted when the load was cancelled (e.g.
  8479. * `window.stop()` was invoked).
  8480. */
  8481. on(event: 'did-fail-provisional-load', listener: (event: Event,
  8482. errorCode: number,
  8483. errorDescription: string,
  8484. validatedURL: string,
  8485. isMainFrame: boolean,
  8486. frameProcessId: number,
  8487. frameRoutingId: number) => void): this;
  8488. once(event: 'did-fail-provisional-load', listener: (event: Event,
  8489. errorCode: number,
  8490. errorDescription: string,
  8491. validatedURL: string,
  8492. isMainFrame: boolean,
  8493. frameProcessId: number,
  8494. frameRoutingId: number) => void): this;
  8495. addListener(event: 'did-fail-provisional-load', listener: (event: Event,
  8496. errorCode: number,
  8497. errorDescription: string,
  8498. validatedURL: string,
  8499. isMainFrame: boolean,
  8500. frameProcessId: number,
  8501. frameRoutingId: number) => void): this;
  8502. removeListener(event: 'did-fail-provisional-load', listener: (event: Event,
  8503. errorCode: number,
  8504. errorDescription: string,
  8505. validatedURL: string,
  8506. isMainFrame: boolean,
  8507. frameProcessId: number,
  8508. frameRoutingId: number) => void): this;
  8509. /**
  8510. * Emitted when the navigation is done, i.e. the spinner of the tab has stopped
  8511. * spinning, and the `onload` event was dispatched.
  8512. */
  8513. on(event: 'did-finish-load', listener: Function): this;
  8514. once(event: 'did-finish-load', listener: Function): this;
  8515. addListener(event: 'did-finish-load', listener: Function): this;
  8516. removeListener(event: 'did-finish-load', listener: Function): this;
  8517. /**
  8518. * Emitted when a frame has done navigation.
  8519. */
  8520. on(event: 'did-frame-finish-load', listener: (event: Event,
  8521. isMainFrame: boolean,
  8522. frameProcessId: number,
  8523. frameRoutingId: number) => void): this;
  8524. once(event: 'did-frame-finish-load', listener: (event: Event,
  8525. isMainFrame: boolean,
  8526. frameProcessId: number,
  8527. frameRoutingId: number) => void): this;
  8528. addListener(event: 'did-frame-finish-load', listener: (event: Event,
  8529. isMainFrame: boolean,
  8530. frameProcessId: number,
  8531. frameRoutingId: number) => void): this;
  8532. removeListener(event: 'did-frame-finish-load', listener: (event: Event,
  8533. isMainFrame: boolean,
  8534. frameProcessId: number,
  8535. frameRoutingId: number) => void): this;
  8536. /**
  8537. * Emitted when any frame navigation is done.
  8538. *
  8539. * This event is not emitted for in-page navigations, such as clicking anchor links
  8540. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  8541. * this purpose.
  8542. */
  8543. on(event: 'did-frame-navigate', listener: (event: Event,
  8544. url: string,
  8545. /**
  8546. * -1 for non HTTP navigations
  8547. */
  8548. httpResponseCode: number,
  8549. /**
  8550. * empty for non HTTP navigations,
  8551. */
  8552. httpStatusText: string,
  8553. isMainFrame: boolean,
  8554. frameProcessId: number,
  8555. frameRoutingId: number) => void): this;
  8556. once(event: 'did-frame-navigate', listener: (event: Event,
  8557. url: string,
  8558. /**
  8559. * -1 for non HTTP navigations
  8560. */
  8561. httpResponseCode: number,
  8562. /**
  8563. * empty for non HTTP navigations,
  8564. */
  8565. httpStatusText: string,
  8566. isMainFrame: boolean,
  8567. frameProcessId: number,
  8568. frameRoutingId: number) => void): this;
  8569. addListener(event: 'did-frame-navigate', listener: (event: Event,
  8570. url: string,
  8571. /**
  8572. * -1 for non HTTP navigations
  8573. */
  8574. httpResponseCode: number,
  8575. /**
  8576. * empty for non HTTP navigations,
  8577. */
  8578. httpStatusText: string,
  8579. isMainFrame: boolean,
  8580. frameProcessId: number,
  8581. frameRoutingId: number) => void): this;
  8582. removeListener(event: 'did-frame-navigate', listener: (event: Event,
  8583. url: string,
  8584. /**
  8585. * -1 for non HTTP navigations
  8586. */
  8587. httpResponseCode: number,
  8588. /**
  8589. * empty for non HTTP navigations,
  8590. */
  8591. httpStatusText: string,
  8592. isMainFrame: boolean,
  8593. frameProcessId: number,
  8594. frameRoutingId: number) => void): this;
  8595. /**
  8596. * Emitted when a main frame navigation is done.
  8597. *
  8598. * This event is not emitted for in-page navigations, such as clicking anchor links
  8599. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  8600. * this purpose.
  8601. */
  8602. on(event: 'did-navigate', listener: (event: Event,
  8603. url: string,
  8604. /**
  8605. * -1 for non HTTP navigations
  8606. */
  8607. httpResponseCode: number,
  8608. /**
  8609. * empty for non HTTP navigations
  8610. */
  8611. httpStatusText: string) => void): this;
  8612. once(event: 'did-navigate', listener: (event: Event,
  8613. url: string,
  8614. /**
  8615. * -1 for non HTTP navigations
  8616. */
  8617. httpResponseCode: number,
  8618. /**
  8619. * empty for non HTTP navigations
  8620. */
  8621. httpStatusText: string) => void): this;
  8622. addListener(event: 'did-navigate', listener: (event: Event,
  8623. url: string,
  8624. /**
  8625. * -1 for non HTTP navigations
  8626. */
  8627. httpResponseCode: number,
  8628. /**
  8629. * empty for non HTTP navigations
  8630. */
  8631. httpStatusText: string) => void): this;
  8632. removeListener(event: 'did-navigate', listener: (event: Event,
  8633. url: string,
  8634. /**
  8635. * -1 for non HTTP navigations
  8636. */
  8637. httpResponseCode: number,
  8638. /**
  8639. * empty for non HTTP navigations
  8640. */
  8641. httpStatusText: string) => void): this;
  8642. /**
  8643. * Emitted when an in-page navigation happened in any frame.
  8644. *
  8645. * When in-page navigation happens, the page URL changes but does not cause
  8646. * navigation outside of the page. Examples of this occurring are when anchor links
  8647. * are clicked or when the DOM `hashchange` event is triggered.
  8648. */
  8649. on(event: 'did-navigate-in-page', listener: (event: Event,
  8650. url: string,
  8651. isMainFrame: boolean,
  8652. frameProcessId: number,
  8653. frameRoutingId: number) => void): this;
  8654. once(event: 'did-navigate-in-page', listener: (event: Event,
  8655. url: string,
  8656. isMainFrame: boolean,
  8657. frameProcessId: number,
  8658. frameRoutingId: number) => void): this;
  8659. addListener(event: 'did-navigate-in-page', listener: (event: Event,
  8660. url: string,
  8661. isMainFrame: boolean,
  8662. frameProcessId: number,
  8663. frameRoutingId: number) => void): this;
  8664. removeListener(event: 'did-navigate-in-page', listener: (event: Event,
  8665. url: string,
  8666. isMainFrame: boolean,
  8667. frameProcessId: number,
  8668. frameRoutingId: number) => void): this;
  8669. /**
  8670. * Emitted after a server side redirect occurs during navigation. For example a
  8671. * 302 redirect.
  8672. *
  8673. * This event cannot be prevented, if you want to prevent redirects you should
  8674. * checkout out the `will-redirect` event above.
  8675. */
  8676. on(event: 'did-redirect-navigation', listener: (event: Event,
  8677. url: string,
  8678. isInPlace: boolean,
  8679. isMainFrame: boolean,
  8680. frameProcessId: number,
  8681. frameRoutingId: number) => void): this;
  8682. once(event: 'did-redirect-navigation', listener: (event: Event,
  8683. url: string,
  8684. isInPlace: boolean,
  8685. isMainFrame: boolean,
  8686. frameProcessId: number,
  8687. frameRoutingId: number) => void): this;
  8688. addListener(event: 'did-redirect-navigation', listener: (event: Event,
  8689. url: string,
  8690. isInPlace: boolean,
  8691. isMainFrame: boolean,
  8692. frameProcessId: number,
  8693. frameRoutingId: number) => void): this;
  8694. removeListener(event: 'did-redirect-navigation', listener: (event: Event,
  8695. url: string,
  8696. isInPlace: boolean,
  8697. isMainFrame: boolean,
  8698. frameProcessId: number,
  8699. frameRoutingId: number) => void): this;
  8700. /**
  8701. * Corresponds to the points in time when the spinner of the tab started spinning.
  8702. */
  8703. on(event: 'did-start-loading', listener: Function): this;
  8704. once(event: 'did-start-loading', listener: Function): this;
  8705. addListener(event: 'did-start-loading', listener: Function): this;
  8706. removeListener(event: 'did-start-loading', listener: Function): this;
  8707. /**
  8708. * Emitted when any frame (including main) starts navigating. `isInplace` will be
  8709. * `true` for in-page navigations.
  8710. */
  8711. on(event: 'did-start-navigation', listener: (event: Event,
  8712. url: string,
  8713. isInPlace: boolean,
  8714. isMainFrame: boolean,
  8715. frameProcessId: number,
  8716. frameRoutingId: number) => void): this;
  8717. once(event: 'did-start-navigation', listener: (event: Event,
  8718. url: string,
  8719. isInPlace: boolean,
  8720. isMainFrame: boolean,
  8721. frameProcessId: number,
  8722. frameRoutingId: number) => void): this;
  8723. addListener(event: 'did-start-navigation', listener: (event: Event,
  8724. url: string,
  8725. isInPlace: boolean,
  8726. isMainFrame: boolean,
  8727. frameProcessId: number,
  8728. frameRoutingId: number) => void): this;
  8729. removeListener(event: 'did-start-navigation', listener: (event: Event,
  8730. url: string,
  8731. isInPlace: boolean,
  8732. isMainFrame: boolean,
  8733. frameProcessId: number,
  8734. frameRoutingId: number) => void): this;
  8735. /**
  8736. * Corresponds to the points in time when the spinner of the tab stopped spinning.
  8737. */
  8738. on(event: 'did-stop-loading', listener: Function): this;
  8739. once(event: 'did-stop-loading', listener: Function): this;
  8740. addListener(event: 'did-stop-loading', listener: Function): this;
  8741. removeListener(event: 'did-stop-loading', listener: Function): this;
  8742. /**
  8743. * Emitted when the document in the given frame is loaded.
  8744. */
  8745. on(event: 'dom-ready', listener: (event: Event) => void): this;
  8746. once(event: 'dom-ready', listener: (event: Event) => void): this;
  8747. addListener(event: 'dom-ready', listener: (event: Event) => void): this;
  8748. removeListener(event: 'dom-ready', listener: (event: Event) => void): this;
  8749. /**
  8750. * Emitted when the window enters a full-screen state triggered by HTML API.
  8751. */
  8752. on(event: 'enter-html-full-screen', listener: Function): this;
  8753. once(event: 'enter-html-full-screen', listener: Function): this;
  8754. addListener(event: 'enter-html-full-screen', listener: Function): this;
  8755. removeListener(event: 'enter-html-full-screen', listener: Function): this;
  8756. /**
  8757. * Emitted when a result is available for [`webContents.findInPage`] request.
  8758. */
  8759. on(event: 'found-in-page', listener: (event: Event,
  8760. result: Result) => void): this;
  8761. once(event: 'found-in-page', listener: (event: Event,
  8762. result: Result) => void): this;
  8763. addListener(event: 'found-in-page', listener: (event: Event,
  8764. result: Result) => void): this;
  8765. removeListener(event: 'found-in-page', listener: (event: Event,
  8766. result: Result) => void): this;
  8767. /**
  8768. * Emitted when the renderer process sends an asynchronous message via
  8769. * `ipcRenderer.send()`.
  8770. */
  8771. on(event: 'ipc-message', listener: (event: Event,
  8772. channel: string,
  8773. ...args: any[]) => void): this;
  8774. once(event: 'ipc-message', listener: (event: Event,
  8775. channel: string,
  8776. ...args: any[]) => void): this;
  8777. addListener(event: 'ipc-message', listener: (event: Event,
  8778. channel: string,
  8779. ...args: any[]) => void): this;
  8780. removeListener(event: 'ipc-message', listener: (event: Event,
  8781. channel: string,
  8782. ...args: any[]) => void): this;
  8783. /**
  8784. * Emitted when the renderer process sends a synchronous message via
  8785. * `ipcRenderer.sendSync()`.
  8786. */
  8787. on(event: 'ipc-message-sync', listener: (event: Event,
  8788. channel: string,
  8789. ...args: any[]) => void): this;
  8790. once(event: 'ipc-message-sync', listener: (event: Event,
  8791. channel: string,
  8792. ...args: any[]) => void): this;
  8793. addListener(event: 'ipc-message-sync', listener: (event: Event,
  8794. channel: string,
  8795. ...args: any[]) => void): this;
  8796. removeListener(event: 'ipc-message-sync', listener: (event: Event,
  8797. channel: string,
  8798. ...args: any[]) => void): this;
  8799. /**
  8800. * Emitted when the window leaves a full-screen state triggered by HTML API.
  8801. */
  8802. on(event: 'leave-html-full-screen', listener: Function): this;
  8803. once(event: 'leave-html-full-screen', listener: Function): this;
  8804. addListener(event: 'leave-html-full-screen', listener: Function): this;
  8805. removeListener(event: 'leave-html-full-screen', listener: Function): this;
  8806. /**
  8807. * Emitted when `webContents` wants to do basic auth.
  8808. *
  8809. The usage is the same with the `login` event of `app`.
  8810. */
  8811. on(event: 'login', listener: (event: Event,
  8812. authenticationResponseDetails: AuthenticationResponseDetails,
  8813. authInfo: AuthInfo,
  8814. callback: (username?: string, password?: string) => void) => void): this;
  8815. once(event: 'login', listener: (event: Event,
  8816. authenticationResponseDetails: AuthenticationResponseDetails,
  8817. authInfo: AuthInfo,
  8818. callback: (username?: string, password?: string) => void) => void): this;
  8819. addListener(event: 'login', listener: (event: Event,
  8820. authenticationResponseDetails: AuthenticationResponseDetails,
  8821. authInfo: AuthInfo,
  8822. callback: (username?: string, password?: string) => void) => void): this;
  8823. removeListener(event: 'login', listener: (event: Event,
  8824. authenticationResponseDetails: AuthenticationResponseDetails,
  8825. authInfo: AuthInfo,
  8826. callback: (username?: string, password?: string) => void) => void): this;
  8827. /**
  8828. * Emitted when media is paused or done playing.
  8829. */
  8830. on(event: 'media-paused', listener: Function): this;
  8831. once(event: 'media-paused', listener: Function): this;
  8832. addListener(event: 'media-paused', listener: Function): this;
  8833. removeListener(event: 'media-paused', listener: Function): this;
  8834. /**
  8835. * Emitted when media starts playing.
  8836. */
  8837. on(event: 'media-started-playing', listener: Function): this;
  8838. once(event: 'media-started-playing', listener: Function): this;
  8839. addListener(event: 'media-started-playing', listener: Function): this;
  8840. removeListener(event: 'media-started-playing', listener: Function): this;
  8841. /**
  8842. * Emitted when the page requests to open a new window for a `url`. It could be
  8843. * requested by `window.open` or an external link like `<a target='_blank'>`.
  8844. *
  8845. * By default a new `BrowserWindow` will be created for the `url`.
  8846. *
  8847. * Calling `event.preventDefault()` will prevent Electron from automatically
  8848. * creating a new `BrowserWindow`. If you call `event.preventDefault()` and
  8849. * manually create a new `BrowserWindow` then you must set `event.newGuest` to
  8850. * reference the new `BrowserWindow` instance, failing to do so may result in
  8851. * unexpected behavior. For example:
  8852. */
  8853. on(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
  8854. url: string,
  8855. frameName: string,
  8856. /**
  8857. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  8858. * `save-to-disk` and `other`.
  8859. */
  8860. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
  8861. /**
  8862. * The options which will be used for creating the new `BrowserWindow`.
  8863. */
  8864. options: BrowserWindowConstructorOptions,
  8865. /**
  8866. * The non-standard features (features not handled by Chromium or Electron) given
  8867. * to `window.open()`.
  8868. */
  8869. additionalFeatures: string[],
  8870. /**
  8871. * The referrer that will be passed to the new window. May or may not result in the
  8872. * `Referer` header being sent, depending on the referrer policy.
  8873. */
  8874. referrer: Referrer,
  8875. /**
  8876. * The post data that will be sent to the new window, along with the appropriate
  8877. * headers that will be set. If no post data is to be sent, the value will be
  8878. * `null`. Only defined when the window is being created by a form that set
  8879. * `target=_blank`.
  8880. */
  8881. postBody: PostBody) => void): this;
  8882. once(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
  8883. url: string,
  8884. frameName: string,
  8885. /**
  8886. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  8887. * `save-to-disk` and `other`.
  8888. */
  8889. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
  8890. /**
  8891. * The options which will be used for creating the new `BrowserWindow`.
  8892. */
  8893. options: BrowserWindowConstructorOptions,
  8894. /**
  8895. * The non-standard features (features not handled by Chromium or Electron) given
  8896. * to `window.open()`.
  8897. */
  8898. additionalFeatures: string[],
  8899. /**
  8900. * The referrer that will be passed to the new window. May or may not result in the
  8901. * `Referer` header being sent, depending on the referrer policy.
  8902. */
  8903. referrer: Referrer,
  8904. /**
  8905. * The post data that will be sent to the new window, along with the appropriate
  8906. * headers that will be set. If no post data is to be sent, the value will be
  8907. * `null`. Only defined when the window is being created by a form that set
  8908. * `target=_blank`.
  8909. */
  8910. postBody: PostBody) => void): this;
  8911. addListener(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
  8912. url: string,
  8913. frameName: string,
  8914. /**
  8915. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  8916. * `save-to-disk` and `other`.
  8917. */
  8918. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
  8919. /**
  8920. * The options which will be used for creating the new `BrowserWindow`.
  8921. */
  8922. options: BrowserWindowConstructorOptions,
  8923. /**
  8924. * The non-standard features (features not handled by Chromium or Electron) given
  8925. * to `window.open()`.
  8926. */
  8927. additionalFeatures: string[],
  8928. /**
  8929. * The referrer that will be passed to the new window. May or may not result in the
  8930. * `Referer` header being sent, depending on the referrer policy.
  8931. */
  8932. referrer: Referrer,
  8933. /**
  8934. * The post data that will be sent to the new window, along with the appropriate
  8935. * headers that will be set. If no post data is to be sent, the value will be
  8936. * `null`. Only defined when the window is being created by a form that set
  8937. * `target=_blank`.
  8938. */
  8939. postBody: PostBody) => void): this;
  8940. removeListener(event: 'new-window', listener: (event: NewWindowWebContentsEvent,
  8941. url: string,
  8942. frameName: string,
  8943. /**
  8944. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  8945. * `save-to-disk` and `other`.
  8946. */
  8947. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'),
  8948. /**
  8949. * The options which will be used for creating the new `BrowserWindow`.
  8950. */
  8951. options: BrowserWindowConstructorOptions,
  8952. /**
  8953. * The non-standard features (features not handled by Chromium or Electron) given
  8954. * to `window.open()`.
  8955. */
  8956. additionalFeatures: string[],
  8957. /**
  8958. * The referrer that will be passed to the new window. May or may not result in the
  8959. * `Referer` header being sent, depending on the referrer policy.
  8960. */
  8961. referrer: Referrer,
  8962. /**
  8963. * The post data that will be sent to the new window, along with the appropriate
  8964. * headers that will be set. If no post data is to be sent, the value will be
  8965. * `null`. Only defined when the window is being created by a form that set
  8966. * `target=_blank`.
  8967. */
  8968. postBody: PostBody) => void): this;
  8969. /**
  8970. * Emitted when page receives favicon urls.
  8971. */
  8972. on(event: 'page-favicon-updated', listener: (event: Event,
  8973. /**
  8974. * Array of URLs.
  8975. */
  8976. favicons: string[]) => void): this;
  8977. once(event: 'page-favicon-updated', listener: (event: Event,
  8978. /**
  8979. * Array of URLs.
  8980. */
  8981. favicons: string[]) => void): this;
  8982. addListener(event: 'page-favicon-updated', listener: (event: Event,
  8983. /**
  8984. * Array of URLs.
  8985. */
  8986. favicons: string[]) => void): this;
  8987. removeListener(event: 'page-favicon-updated', listener: (event: Event,
  8988. /**
  8989. * Array of URLs.
  8990. */
  8991. favicons: string[]) => void): this;
  8992. /**
  8993. * Fired when page title is set during navigation. `explicitSet` is false when
  8994. * title is synthesized from file url.
  8995. */
  8996. on(event: 'page-title-updated', listener: (event: Event,
  8997. title: string,
  8998. explicitSet: boolean) => void): this;
  8999. once(event: 'page-title-updated', listener: (event: Event,
  9000. title: string,
  9001. explicitSet: boolean) => void): this;
  9002. addListener(event: 'page-title-updated', listener: (event: Event,
  9003. title: string,
  9004. explicitSet: boolean) => void): this;
  9005. removeListener(event: 'page-title-updated', listener: (event: Event,
  9006. title: string,
  9007. explicitSet: boolean) => void): this;
  9008. /**
  9009. * Emitted when a new frame is generated. Only the dirty area is passed in the
  9010. * buffer.
  9011. */
  9012. on(event: 'paint', listener: (event: Event,
  9013. dirtyRect: Rectangle,
  9014. /**
  9015. * The image data of the whole frame.
  9016. */
  9017. image: NativeImage) => void): this;
  9018. once(event: 'paint', listener: (event: Event,
  9019. dirtyRect: Rectangle,
  9020. /**
  9021. * The image data of the whole frame.
  9022. */
  9023. image: NativeImage) => void): this;
  9024. addListener(event: 'paint', listener: (event: Event,
  9025. dirtyRect: Rectangle,
  9026. /**
  9027. * The image data of the whole frame.
  9028. */
  9029. image: NativeImage) => void): this;
  9030. removeListener(event: 'paint', listener: (event: Event,
  9031. dirtyRect: Rectangle,
  9032. /**
  9033. * The image data of the whole frame.
  9034. */
  9035. image: NativeImage) => void): this;
  9036. /**
  9037. * Emitted when a plugin process has crashed.
  9038. */
  9039. on(event: 'plugin-crashed', listener: (event: Event,
  9040. name: string,
  9041. version: string) => void): this;
  9042. once(event: 'plugin-crashed', listener: (event: Event,
  9043. name: string,
  9044. version: string) => void): this;
  9045. addListener(event: 'plugin-crashed', listener: (event: Event,
  9046. name: string,
  9047. version: string) => void): this;
  9048. removeListener(event: 'plugin-crashed', listener: (event: Event,
  9049. name: string,
  9050. version: string) => void): this;
  9051. /**
  9052. * Emitted when the preload script `preloadPath` throws an unhandled exception
  9053. * `error`.
  9054. */
  9055. on(event: 'preload-error', listener: (event: Event,
  9056. preloadPath: string,
  9057. error: Error) => void): this;
  9058. once(event: 'preload-error', listener: (event: Event,
  9059. preloadPath: string,
  9060. error: Error) => void): this;
  9061. addListener(event: 'preload-error', listener: (event: Event,
  9062. preloadPath: string,
  9063. error: Error) => void): this;
  9064. removeListener(event: 'preload-error', listener: (event: Event,
  9065. preloadPath: string,
  9066. error: Error) => void): this;
  9067. /**
  9068. * Emitted when `remote.getBuiltin()` is called in the renderer process. Calling
  9069. * `event.preventDefault()` will prevent the module from being returned. Custom
  9070. * value can be returned by setting `event.returnValue`.
  9071. */
  9072. on(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
  9073. moduleName: string) => void): this;
  9074. once(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
  9075. moduleName: string) => void): this;
  9076. addListener(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
  9077. moduleName: string) => void): this;
  9078. removeListener(event: 'remote-get-builtin', listener: (event: IpcMainEvent,
  9079. moduleName: string) => void): this;
  9080. /**
  9081. * Emitted when `remote.getCurrentWebContents()` is called in the renderer process.
  9082. * Calling `event.preventDefault()` will prevent the object from being returned.
  9083. * Custom value can be returned by setting `event.returnValue`.
  9084. */
  9085. on(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
  9086. once(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
  9087. addListener(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
  9088. removeListener(event: 'remote-get-current-web-contents', listener: (event: IpcMainEvent) => void): this;
  9089. /**
  9090. * Emitted when `remote.getCurrentWindow()` is called in the renderer process.
  9091. * Calling `event.preventDefault()` will prevent the object from being returned.
  9092. * Custom value can be returned by setting `event.returnValue`.
  9093. */
  9094. on(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
  9095. once(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
  9096. addListener(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
  9097. removeListener(event: 'remote-get-current-window', listener: (event: IpcMainEvent) => void): this;
  9098. /**
  9099. * Emitted when `remote.getGlobal()` is called in the renderer process. Calling
  9100. * `event.preventDefault()` will prevent the global from being returned. Custom
  9101. * value can be returned by setting `event.returnValue`.
  9102. */
  9103. on(event: 'remote-get-global', listener: (event: IpcMainEvent,
  9104. globalName: string) => void): this;
  9105. once(event: 'remote-get-global', listener: (event: IpcMainEvent,
  9106. globalName: string) => void): this;
  9107. addListener(event: 'remote-get-global', listener: (event: IpcMainEvent,
  9108. globalName: string) => void): this;
  9109. removeListener(event: 'remote-get-global', listener: (event: IpcMainEvent,
  9110. globalName: string) => void): this;
  9111. /**
  9112. * Emitted when `remote.require()` is called in the renderer process. Calling
  9113. * `event.preventDefault()` will prevent the module from being returned. Custom
  9114. * value can be returned by setting `event.returnValue`.
  9115. */
  9116. on(event: 'remote-require', listener: (event: IpcMainEvent,
  9117. moduleName: string) => void): this;
  9118. once(event: 'remote-require', listener: (event: IpcMainEvent,
  9119. moduleName: string) => void): this;
  9120. addListener(event: 'remote-require', listener: (event: IpcMainEvent,
  9121. moduleName: string) => void): this;
  9122. removeListener(event: 'remote-require', listener: (event: IpcMainEvent,
  9123. moduleName: string) => void): this;
  9124. /**
  9125. * Emitted when the renderer process unexpectedly disappears. This is normally
  9126. * because it was crashed or killed.
  9127. */
  9128. on(event: 'render-process-gone', listener: (event: Event,
  9129. details: RenderProcessGoneDetails) => void): this;
  9130. once(event: 'render-process-gone', listener: (event: Event,
  9131. details: RenderProcessGoneDetails) => void): this;
  9132. addListener(event: 'render-process-gone', listener: (event: Event,
  9133. details: RenderProcessGoneDetails) => void): this;
  9134. removeListener(event: 'render-process-gone', listener: (event: Event,
  9135. details: RenderProcessGoneDetails) => void): this;
  9136. /**
  9137. * Emitted when the unresponsive web page becomes responsive again.
  9138. */
  9139. on(event: 'responsive', listener: Function): this;
  9140. once(event: 'responsive', listener: Function): this;
  9141. addListener(event: 'responsive', listener: Function): this;
  9142. removeListener(event: 'responsive', listener: Function): this;
  9143. /**
  9144. * Emitted when bluetooth device needs to be selected on call to
  9145. * `navigator.bluetooth.requestDevice`. To use `navigator.bluetooth` api
  9146. * `webBluetooth` should be enabled. If `event.preventDefault` is not called, first
  9147. * available device will be selected. `callback` should be called with `deviceId`
  9148. * to be selected, passing empty string to `callback` will cancel the request.
  9149. */
  9150. on(event: 'select-bluetooth-device', listener: (event: Event,
  9151. devices: BluetoothDevice[],
  9152. callback: (deviceId: string) => void) => void): this;
  9153. once(event: 'select-bluetooth-device', listener: (event: Event,
  9154. devices: BluetoothDevice[],
  9155. callback: (deviceId: string) => void) => void): this;
  9156. addListener(event: 'select-bluetooth-device', listener: (event: Event,
  9157. devices: BluetoothDevice[],
  9158. callback: (deviceId: string) => void) => void): this;
  9159. removeListener(event: 'select-bluetooth-device', listener: (event: Event,
  9160. devices: BluetoothDevice[],
  9161. callback: (deviceId: string) => void) => void): this;
  9162. /**
  9163. * Emitted when a client certificate is requested.
  9164. *
  9165. The usage is the same with the `select-client-certificate` event of `app`.
  9166. */
  9167. on(event: 'select-client-certificate', listener: (event: Event,
  9168. url: string,
  9169. certificateList: Certificate[],
  9170. callback: (certificate: Certificate) => void) => void): this;
  9171. once(event: 'select-client-certificate', listener: (event: Event,
  9172. url: string,
  9173. certificateList: Certificate[],
  9174. callback: (certificate: Certificate) => void) => void): this;
  9175. addListener(event: 'select-client-certificate', listener: (event: Event,
  9176. url: string,
  9177. certificateList: Certificate[],
  9178. callback: (certificate: Certificate) => void) => void): this;
  9179. removeListener(event: 'select-client-certificate', listener: (event: Event,
  9180. url: string,
  9181. certificateList: Certificate[],
  9182. callback: (certificate: Certificate) => void) => void): this;
  9183. /**
  9184. * Emitted when the web page becomes unresponsive.
  9185. */
  9186. on(event: 'unresponsive', listener: Function): this;
  9187. once(event: 'unresponsive', listener: Function): this;
  9188. addListener(event: 'unresponsive', listener: Function): this;
  9189. removeListener(event: 'unresponsive', listener: Function): this;
  9190. /**
  9191. * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
  9192. */
  9193. on(event: 'update-target-url', listener: (event: Event,
  9194. url: string) => void): this;
  9195. once(event: 'update-target-url', listener: (event: Event,
  9196. url: string) => void): this;
  9197. addListener(event: 'update-target-url', listener: (event: Event,
  9198. url: string) => void): this;
  9199. removeListener(event: 'update-target-url', listener: (event: Event,
  9200. url: string) => void): this;
  9201. /**
  9202. * Emitted when a `<webview>`'s web contents is being attached to this web
  9203. * contents. Calling `event.preventDefault()` will destroy the guest page.
  9204. *
  9205. * This event can be used to configure `webPreferences` for the `webContents` of a
  9206. * `<webview>` before it's loaded, and provides the ability to set settings that
  9207. * can't be set via `<webview>` attributes.
  9208. *
  9209. * **Note:** The specified `preload` script option will appear as `preloadURL` (not
  9210. * `preload`) in the `webPreferences` object emitted with this event.
  9211. */
  9212. on(event: 'will-attach-webview', listener: (event: Event,
  9213. /**
  9214. * The web preferences that will be used by the guest page. This object can be
  9215. * modified to adjust the preferences for the guest page.
  9216. */
  9217. webPreferences: WebPreferences,
  9218. /**
  9219. * The other `<webview>` parameters such as the `src` URL. This object can be
  9220. * modified to adjust the parameters of the guest page.
  9221. */
  9222. params: Record<string, string>) => void): this;
  9223. once(event: 'will-attach-webview', listener: (event: Event,
  9224. /**
  9225. * The web preferences that will be used by the guest page. This object can be
  9226. * modified to adjust the preferences for the guest page.
  9227. */
  9228. webPreferences: WebPreferences,
  9229. /**
  9230. * The other `<webview>` parameters such as the `src` URL. This object can be
  9231. * modified to adjust the parameters of the guest page.
  9232. */
  9233. params: Record<string, string>) => void): this;
  9234. addListener(event: 'will-attach-webview', listener: (event: Event,
  9235. /**
  9236. * The web preferences that will be used by the guest page. This object can be
  9237. * modified to adjust the preferences for the guest page.
  9238. */
  9239. webPreferences: WebPreferences,
  9240. /**
  9241. * The other `<webview>` parameters such as the `src` URL. This object can be
  9242. * modified to adjust the parameters of the guest page.
  9243. */
  9244. params: Record<string, string>) => void): this;
  9245. removeListener(event: 'will-attach-webview', listener: (event: Event,
  9246. /**
  9247. * The web preferences that will be used by the guest page. This object can be
  9248. * modified to adjust the preferences for the guest page.
  9249. */
  9250. webPreferences: WebPreferences,
  9251. /**
  9252. * The other `<webview>` parameters such as the `src` URL. This object can be
  9253. * modified to adjust the parameters of the guest page.
  9254. */
  9255. params: Record<string, string>) => void): this;
  9256. /**
  9257. * Emitted when a user or the page wants to start navigation. It can happen when
  9258. * the `window.location` object is changed or a user clicks a link in the page.
  9259. *
  9260. * This event will not emit when the navigation is started programmatically with
  9261. * APIs like `webContents.loadURL` and `webContents.back`.
  9262. *
  9263. * It is also not emitted for in-page navigations, such as clicking anchor links or
  9264. * updating the `window.location.hash`. Use `did-navigate-in-page` event for this
  9265. * purpose.
  9266. Calling `event.preventDefault()` will prevent the navigation.
  9267. */
  9268. on(event: 'will-navigate', listener: (event: Event,
  9269. url: string) => void): this;
  9270. once(event: 'will-navigate', listener: (event: Event,
  9271. url: string) => void): this;
  9272. addListener(event: 'will-navigate', listener: (event: Event,
  9273. url: string) => void): this;
  9274. removeListener(event: 'will-navigate', listener: (event: Event,
  9275. url: string) => void): this;
  9276. /**
  9277. * Emitted when a `beforeunload` event handler is attempting to cancel a page
  9278. * unload.
  9279. *
  9280. * Calling `event.preventDefault()` will ignore the `beforeunload` event handler
  9281. * and allow the page to be unloaded.
  9282. */
  9283. on(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  9284. once(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  9285. addListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  9286. removeListener(event: 'will-prevent-unload', listener: (event: Event) => void): this;
  9287. /**
  9288. * Emitted as a server side redirect occurs during navigation. For example a 302
  9289. * redirect.
  9290. *
  9291. * This event will be emitted after `did-start-navigation` and always before the
  9292. * `did-redirect-navigation` event for the same navigation.
  9293. *
  9294. * Calling `event.preventDefault()` will prevent the navigation (not just the
  9295. * redirect).
  9296. */
  9297. on(event: 'will-redirect', listener: (event: Event,
  9298. url: string,
  9299. isInPlace: boolean,
  9300. isMainFrame: boolean,
  9301. frameProcessId: number,
  9302. frameRoutingId: number) => void): this;
  9303. once(event: 'will-redirect', listener: (event: Event,
  9304. url: string,
  9305. isInPlace: boolean,
  9306. isMainFrame: boolean,
  9307. frameProcessId: number,
  9308. frameRoutingId: number) => void): this;
  9309. addListener(event: 'will-redirect', listener: (event: Event,
  9310. url: string,
  9311. isInPlace: boolean,
  9312. isMainFrame: boolean,
  9313. frameProcessId: number,
  9314. frameRoutingId: number) => void): this;
  9315. removeListener(event: 'will-redirect', listener: (event: Event,
  9316. url: string,
  9317. isInPlace: boolean,
  9318. isMainFrame: boolean,
  9319. frameProcessId: number,
  9320. frameRoutingId: number) => void): this;
  9321. /**
  9322. * Emitted when the user is requesting to change the zoom level using the mouse
  9323. * wheel.
  9324. */
  9325. on(event: 'zoom-changed', listener: (event: Event,
  9326. /**
  9327. * Can be `in` or `out`.
  9328. */
  9329. zoomDirection: ('in' | 'out')) => void): this;
  9330. once(event: 'zoom-changed', listener: (event: Event,
  9331. /**
  9332. * Can be `in` or `out`.
  9333. */
  9334. zoomDirection: ('in' | 'out')) => void): this;
  9335. addListener(event: 'zoom-changed', listener: (event: Event,
  9336. /**
  9337. * Can be `in` or `out`.
  9338. */
  9339. zoomDirection: ('in' | 'out')) => void): this;
  9340. removeListener(event: 'zoom-changed', listener: (event: Event,
  9341. /**
  9342. * Can be `in` or `out`.
  9343. */
  9344. zoomDirection: ('in' | 'out')) => void): this;
  9345. /**
  9346. * Adds the specified path to DevTools workspace. Must be used after DevTools
  9347. * creation:
  9348. */
  9349. addWorkSpace(path: string): void;
  9350. /**
  9351. * Begin subscribing for presentation events and captured frames, the `callback`
  9352. * will be called with `callback(image, dirtyRect)` when there is a presentation
  9353. * event.
  9354. *
  9355. * The `image` is an instance of NativeImage that stores the captured frame.
  9356. *
  9357. * The `dirtyRect` is an object with `x, y, width, height` properties that
  9358. * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
  9359. * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
  9360. */
  9361. beginFrameSubscription(onlyDirty: boolean, callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
  9362. /**
  9363. * Begin subscribing for presentation events and captured frames, the `callback`
  9364. * will be called with `callback(image, dirtyRect)` when there is a presentation
  9365. * event.
  9366. *
  9367. * The `image` is an instance of NativeImage that stores the captured frame.
  9368. *
  9369. * The `dirtyRect` is an object with `x, y, width, height` properties that
  9370. * describes which part of the page was repainted. If `onlyDirty` is set to `true`,
  9371. * `image` will only contain the repainted area. `onlyDirty` defaults to `false`.
  9372. */
  9373. beginFrameSubscription(callback: (image: NativeImage, dirtyRect: Rectangle) => void): void;
  9374. /**
  9375. * Whether the browser can go back to previous web page.
  9376. */
  9377. canGoBack(): boolean;
  9378. /**
  9379. * Whether the browser can go forward to next web page.
  9380. */
  9381. canGoForward(): boolean;
  9382. /**
  9383. * Whether the web page can go to `offset`.
  9384. */
  9385. canGoToOffset(offset: number): boolean;
  9386. /**
  9387. * Resolves with a NativeImage
  9388. *
  9389. * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
  9390. * whole visible page.
  9391. */
  9392. capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
  9393. /**
  9394. * Clears the navigation history.
  9395. */
  9396. clearHistory(): void;
  9397. /**
  9398. * Closes the devtools.
  9399. */
  9400. closeDevTools(): void;
  9401. /**
  9402. * Executes the editing command `copy` in web page.
  9403. */
  9404. copy(): void;
  9405. /**
  9406. * Copy the image at the given position to the clipboard.
  9407. */
  9408. copyImageAt(x: number, y: number): void;
  9409. /**
  9410. * Executes the editing command `cut` in web page.
  9411. */
  9412. cut(): void;
  9413. /**
  9414. * Decrease the capturer count by one. The page will be set to hidden or occluded
  9415. * state when its browser window is hidden or occluded and the capturer count
  9416. * reaches zero. If you want to decrease the hidden capturer count instead you
  9417. * should set `stayHidden` to true.
  9418. */
  9419. decrementCapturerCount(stayHidden?: boolean): void;
  9420. /**
  9421. * Executes the editing command `delete` in web page.
  9422. */
  9423. delete(): void;
  9424. /**
  9425. * Disable device emulation enabled by `webContents.enableDeviceEmulation`.
  9426. */
  9427. disableDeviceEmulation(): void;
  9428. /**
  9429. * Initiates a download of the resource at `url` without navigating. The
  9430. * `will-download` event of `session` will be triggered.
  9431. */
  9432. downloadURL(url: string): void;
  9433. /**
  9434. * Enable device emulation with the given parameters.
  9435. */
  9436. enableDeviceEmulation(parameters: Parameters): void;
  9437. /**
  9438. * End subscribing for frame presentation events.
  9439. */
  9440. endFrameSubscription(): void;
  9441. /**
  9442. * A promise that resolves with the result of the executed code or is rejected if
  9443. * the result of the code is a rejected promise.
  9444. *
  9445. * Evaluates `code` in page.
  9446. *
  9447. * In the browser window some HTML APIs like `requestFullScreen` can only be
  9448. * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
  9449. * this limitation.
  9450. Code execution will be suspended until web page stop loading.
  9451. */
  9452. executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
  9453. /**
  9454. * A promise that resolves with the result of the executed code or is rejected if
  9455. * the result of the code is a rejected promise.
  9456. *
  9457. Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
  9458. */
  9459. executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean): Promise<any>;
  9460. /**
  9461. * The request id used for the request.
  9462. *
  9463. * Starts a request to find all matches for the `text` in the web page. The result
  9464. * of the request can be obtained by subscribing to `found-in-page` event.
  9465. */
  9466. findInPage(text: string, options?: FindInPageOptions): number;
  9467. /**
  9468. * Focuses the web page.
  9469. */
  9470. focus(): void;
  9471. /**
  9472. * Forcefully terminates the renderer process that is currently hosting this
  9473. * `webContents`. This will cause the `render-process-gone` event to be emitted
  9474. * with the `reason=killed || reason=crashed`. Please note that some webContents
  9475. * share renderer processes and therefore calling this method may also crash the
  9476. * host process for other webContents as well.
  9477. *
  9478. * Calling `reload()` immediately after calling this method will force the reload
  9479. * to occur in a new process. This should be used when this process is unstable or
  9480. * unusable, for instance in order to recover from the `unresponsive` event.
  9481. */
  9482. forcefullyCrashRenderer(): void;
  9483. /**
  9484. * Information about all Shared Workers.
  9485. */
  9486. getAllSharedWorkers(): SharedWorkerInfo[];
  9487. /**
  9488. * whether or not this WebContents will throttle animations and timers when the
  9489. * page becomes backgrounded. This also affects the Page Visibility API.
  9490. */
  9491. getBackgroundThrottling(): boolean;
  9492. /**
  9493. * If *offscreen rendering* is enabled returns the current frame rate.
  9494. */
  9495. getFrameRate(): number;
  9496. /**
  9497. * The operating system `pid` of the associated renderer process.
  9498. */
  9499. getOSProcessId(): number;
  9500. /**
  9501. * Get the system printer list.
  9502. */
  9503. getPrinters(): PrinterInfo[];
  9504. /**
  9505. * The Chromium internal `pid` of the associated renderer. Can be compared to the
  9506. * `frameProcessId` passed by frame specific navigation events (e.g.
  9507. * `did-frame-navigate`)
  9508. */
  9509. getProcessId(): number;
  9510. /**
  9511. * The title of the current web page.
  9512. */
  9513. getTitle(): string;
  9514. /**
  9515. * the type of the webContent. Can be `backgroundPage`, `window`, `browserView`,
  9516. * `remote`, `webview` or `offscreen`.
  9517. */
  9518. getType(): ('backgroundPage' | 'window' | 'browserView' | 'remote' | 'webview' | 'offscreen');
  9519. /**
  9520. * The URL of the current web page.
  9521. */
  9522. getURL(): string;
  9523. /**
  9524. * The user agent for this web page.
  9525. */
  9526. getUserAgent(): string;
  9527. /**
  9528. * Returns the WebRTC IP Handling Policy.
  9529. */
  9530. getWebRTCIPHandlingPolicy(): string;
  9531. /**
  9532. * the current zoom factor.
  9533. */
  9534. getZoomFactor(): number;
  9535. /**
  9536. * the current zoom level.
  9537. */
  9538. getZoomLevel(): number;
  9539. /**
  9540. * Makes the browser go back a web page.
  9541. */
  9542. goBack(): void;
  9543. /**
  9544. * Makes the browser go forward a web page.
  9545. */
  9546. goForward(): void;
  9547. /**
  9548. * Navigates browser to the specified absolute web page index.
  9549. */
  9550. goToIndex(index: number): void;
  9551. /**
  9552. * Navigates to the specified offset from the "current entry".
  9553. */
  9554. goToOffset(offset: number): void;
  9555. /**
  9556. * Increase the capturer count by one. The page is considered visible when its
  9557. * browser window is hidden and the capturer count is non-zero. If you would like
  9558. * the page to stay hidden, you should ensure that `stayHidden` is set to true.
  9559. *
  9560. This also affects the Page Visibility API.
  9561. */
  9562. incrementCapturerCount(size?: Size, stayHidden?: boolean): void;
  9563. /**
  9564. * A promise that resolves with a key for the inserted CSS that can later be used
  9565. * to remove the CSS via `contents.removeInsertedCSS(key)`.
  9566. *
  9567. * Injects CSS into the current web page and returns a unique key for the inserted
  9568. * stylesheet.
  9569. */
  9570. insertCSS(css: string, options?: InsertCSSOptions): Promise<string>;
  9571. /**
  9572. * Inserts `text` to the focused element.
  9573. */
  9574. insertText(text: string): Promise<void>;
  9575. /**
  9576. * Starts inspecting element at position (`x`, `y`).
  9577. */
  9578. inspectElement(x: number, y: number): void;
  9579. /**
  9580. * Opens the developer tools for the service worker context.
  9581. */
  9582. inspectServiceWorker(): void;
  9583. /**
  9584. * Opens the developer tools for the shared worker context.
  9585. */
  9586. inspectSharedWorker(): void;
  9587. /**
  9588. * Inspects the shared worker based on its ID.
  9589. */
  9590. inspectSharedWorkerById(workerId: string): void;
  9591. /**
  9592. * Schedules a full repaint of the window this web contents is in.
  9593. *
  9594. * If *offscreen rendering* is enabled invalidates the frame and generates a new
  9595. * one through the `'paint'` event.
  9596. */
  9597. invalidate(): void;
  9598. /**
  9599. * Whether this page has been muted.
  9600. */
  9601. isAudioMuted(): boolean;
  9602. /**
  9603. * Whether this page is being captured. It returns true when the capturer count is
  9604. * large then 0.
  9605. */
  9606. isBeingCaptured(): boolean;
  9607. /**
  9608. * Whether the renderer process has crashed.
  9609. */
  9610. isCrashed(): boolean;
  9611. /**
  9612. * Whether audio is currently playing.
  9613. */
  9614. isCurrentlyAudible(): boolean;
  9615. /**
  9616. * Whether the web page is destroyed.
  9617. */
  9618. isDestroyed(): boolean;
  9619. /**
  9620. * Whether the devtools view is focused .
  9621. */
  9622. isDevToolsFocused(): boolean;
  9623. /**
  9624. * Whether the devtools is opened.
  9625. */
  9626. isDevToolsOpened(): boolean;
  9627. /**
  9628. * Whether the web page is focused.
  9629. */
  9630. isFocused(): boolean;
  9631. /**
  9632. * Whether web page is still loading resources.
  9633. */
  9634. isLoading(): boolean;
  9635. /**
  9636. * Whether the main frame (and not just iframes or frames within it) is still
  9637. * loading.
  9638. */
  9639. isLoadingMainFrame(): boolean;
  9640. /**
  9641. * Indicates whether *offscreen rendering* is enabled.
  9642. */
  9643. isOffscreen(): boolean;
  9644. /**
  9645. * If *offscreen rendering* is enabled returns whether it is currently painting.
  9646. */
  9647. isPainting(): boolean;
  9648. /**
  9649. * Whether the web page is waiting for a first-response from the main resource of
  9650. * the page.
  9651. */
  9652. isWaitingForResponse(): boolean;
  9653. /**
  9654. * the promise will resolve when the page has finished loading (see
  9655. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  9656. *
  9657. * Loads the given file in the window, `filePath` should be a path to an HTML file
  9658. * relative to the root of your application. For instance an app structure like
  9659. * this:
  9660. Would require code like this
  9661. */
  9662. loadFile(filePath: string, options?: LoadFileOptions): Promise<void>;
  9663. /**
  9664. * the promise will resolve when the page has finished loading (see
  9665. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  9666. * A noop rejection handler is already attached, which avoids unhandled rejection
  9667. * errors.
  9668. *
  9669. * Loads the `url` in the window. The `url` must contain the protocol prefix, e.g.
  9670. * the `http://` or `file://`. If the load should bypass http cache then use the
  9671. * `pragma` header to achieve it.
  9672. */
  9673. loadURL(url: string, options?: LoadURLOptions): Promise<void>;
  9674. /**
  9675. * Opens the devtools.
  9676. *
  9677. * When `contents` is a `<webview>` tag, the `mode` would be `detach` by default,
  9678. * explicitly passing an empty `mode` can force using last used dock state.
  9679. */
  9680. openDevTools(options?: OpenDevToolsOptions): void;
  9681. /**
  9682. * Executes the editing command `paste` in web page.
  9683. */
  9684. paste(): void;
  9685. /**
  9686. * Executes the editing command `pasteAndMatchStyle` in web page.
  9687. */
  9688. pasteAndMatchStyle(): void;
  9689. /**
  9690. * Send a message to the renderer process, optionally transferring ownership of
  9691. * zero or more [`MessagePortMain`][] objects.
  9692. *
  9693. * The transferred `MessagePortMain` objects will be available in the renderer
  9694. * process by accessing the `ports` property of the emitted event. When they arrive
  9695. * in the renderer, they will be native DOM `MessagePort` objects.
  9696. For example:
  9697. */
  9698. postMessage(channel: string, message: any, transfer?: MessagePortMain[]): void;
  9699. /**
  9700. * When a custom `pageSize` is passed, Chromium attempts to validate platform
  9701. * specific minimum values for `width_microns` and `height_microns`. Width and
  9702. * height must both be minimum 353 microns but may be higher on some operating
  9703. * systems.
  9704. *
  9705. * Prints window's web page. When `silent` is set to `true`, Electron will pick the
  9706. * system's default printer if `deviceName` is empty and the default settings for
  9707. * printing.
  9708. *
  9709. * Use `page-break-before: always;` CSS style to force to print to a new page.
  9710. *
  9711. Example usage:
  9712. */
  9713. print(options?: WebContentsPrintOptions, callback?: (success: boolean, failureReason: string) => void): void;
  9714. /**
  9715. * Resolves with the generated PDF data.
  9716. *
  9717. * Prints window's web page as PDF with Chromium's preview printing custom
  9718. * settings.
  9719. *
  9720. * The `landscape` will be ignored if `@page` CSS at-rule is used in the web page.
  9721. *
  9722. * By default, an empty `options` will be regarded as:
  9723. *
  9724. * Use `page-break-before: always; ` CSS style to force to print to a new page.
  9725. *
  9726. An example of `webContents.printToPDF`:
  9727. */
  9728. printToPDF(options: PrintToPDFOptions): Promise<Buffer>;
  9729. /**
  9730. * Executes the editing command `redo` in web page.
  9731. */
  9732. redo(): void;
  9733. /**
  9734. * Reloads the current web page.
  9735. */
  9736. reload(): void;
  9737. /**
  9738. * Reloads current page and ignores cache.
  9739. */
  9740. reloadIgnoringCache(): void;
  9741. /**
  9742. * Resolves if the removal was successful.
  9743. *
  9744. * Removes the inserted CSS from the current web page. The stylesheet is identified
  9745. * by its key, which is returned from `contents.insertCSS(css)`.
  9746. */
  9747. removeInsertedCSS(key: string): Promise<void>;
  9748. /**
  9749. * Removes the specified path from DevTools workspace.
  9750. */
  9751. removeWorkSpace(path: string): void;
  9752. /**
  9753. * Executes the editing command `replace` in web page.
  9754. */
  9755. replace(text: string): void;
  9756. /**
  9757. * Executes the editing command `replaceMisspelling` in web page.
  9758. */
  9759. replaceMisspelling(text: string): void;
  9760. /**
  9761. * resolves if the page is saved.
  9762. */
  9763. savePage(fullPath: string, saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML'): Promise<void>;
  9764. /**
  9765. * Executes the editing command `selectAll` in web page.
  9766. */
  9767. selectAll(): void;
  9768. /**
  9769. * Send an asynchronous message to the renderer process via `channel`, along with
  9770. * arguments. Arguments will be serialized with the Structured Clone Algorithm,
  9771. * just like `postMessage`, so prototype chains will not be included. Sending
  9772. * Functions, Promises, Symbols, WeakMaps, or WeakSets will throw an exception.
  9773. *
  9774. * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
  9775. * Electron objects is deprecated, and will begin throwing an exception starting
  9776. * with Electron 9.
  9777. *
  9778. * The renderer process can handle the message by listening to `channel` with the
  9779. * `ipcRenderer` module.
  9780. *
  9781. An example of sending messages from the main process to the renderer process:
  9782. */
  9783. send(channel: string, ...args: any[]): void;
  9784. /**
  9785. * Sends an input `event` to the page. **Note:** The `BrowserWindow` containing the
  9786. * contents needs to be focused for `sendInputEvent()` to work.
  9787. */
  9788. sendInputEvent(inputEvent: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): void;
  9789. /**
  9790. * Send an asynchronous message to a specific frame in a renderer process via
  9791. * `channel`, along with arguments. Arguments will be serialized with the
  9792. * Structured Clone Algorithm, just like `postMessage`, so prototype chains will
  9793. * not be included. Sending Functions, Promises, Symbols, WeakMaps, or WeakSets
  9794. * will throw an exception.
  9795. *
  9796. * > **NOTE**: Sending non-standard JavaScript types such as DOM objects or special
  9797. * Electron objects is deprecated, and will begin throwing an exception starting
  9798. * with Electron 9.
  9799. *
  9800. * The renderer process can handle the message by listening to `channel` with the
  9801. * `ipcRenderer` module.
  9802. *
  9803. * If you want to get the `frameId` of a given renderer context you should use the
  9804. * `webFrame.routingId` value. E.g.
  9805. *
  9806. You can also read `frameId` from all incoming IPC messages in the main process.
  9807. */
  9808. sendToFrame(frameId: (number) | ([number, number]), channel: string, ...args: any[]): void;
  9809. /**
  9810. * Mute the audio on the current web page.
  9811. */
  9812. setAudioMuted(muted: boolean): void;
  9813. /**
  9814. * Controls whether or not this WebContents will throttle animations and timers
  9815. * when the page becomes backgrounded. This also affects the Page Visibility API.
  9816. */
  9817. setBackgroundThrottling(allowed: boolean): void;
  9818. /**
  9819. * Uses the `devToolsWebContents` as the target `WebContents` to show devtools.
  9820. *
  9821. * The `devToolsWebContents` must not have done any navigation, and it should not
  9822. * be used for other purposes after the call.
  9823. *
  9824. * By default Electron manages the devtools by creating an internal `WebContents`
  9825. * with native view, which developers have very limited control of. With the
  9826. * `setDevToolsWebContents` method, developers can use any `WebContents` to show
  9827. * the devtools in it, including `BrowserWindow`, `BrowserView` and `<webview>`
  9828. * tag.
  9829. *
  9830. * Note that closing the devtools does not destroy the `devToolsWebContents`, it is
  9831. * caller's responsibility to destroy `devToolsWebContents`.
  9832. *
  9833. * An example of showing devtools in a `<webview>` tag:
  9834. *
  9835. An example of showing devtools in a `BrowserWindow`:
  9836. */
  9837. setDevToolsWebContents(devToolsWebContents: WebContents): void;
  9838. /**
  9839. * If *offscreen rendering* is enabled sets the frame rate to the specified number.
  9840. * Only values between 1 and 240 are accepted.
  9841. */
  9842. setFrameRate(fps: number): void;
  9843. /**
  9844. * Ignore application menu shortcuts while this web contents is focused.
  9845. */
  9846. setIgnoreMenuShortcuts(ignore: boolean): void;
  9847. /**
  9848. * Overrides the user agent for this web page.
  9849. */
  9850. setUserAgent(userAgent: string): void;
  9851. /**
  9852. * Sets the maximum and minimum pinch-to-zoom level.
  9853. *
  9854. * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
  9855. * call:
  9856. */
  9857. setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
  9858. /**
  9859. * Setting the WebRTC IP handling policy allows you to control which IPs are
  9860. * exposed via WebRTC. See BrowserLeaks for more details.
  9861. */
  9862. setWebRTCIPHandlingPolicy(policy: 'default' | 'default_public_interface_only' | 'default_public_and_private_interfaces' | 'disable_non_proxied_udp'): void;
  9863. /**
  9864. * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
  9865. * divided by 100, so 300% = 3.0.
  9866. The factor must be greater than 0.0.
  9867. */
  9868. setZoomFactor(factor: number): void;
  9869. /**
  9870. * Changes the zoom level to the specified level. The original size is 0 and each
  9871. * increment above or below represents zooming 20% larger or smaller to default
  9872. * limits of 300% and 50% of original size, respectively. The formula for this is
  9873. * `scale := 1.2 ^ level`.
  9874. */
  9875. setZoomLevel(level: number): void;
  9876. /**
  9877. * Shows pop-up dictionary that searches the selected word on the page.
  9878. *
  9879. * @platform darwin
  9880. */
  9881. showDefinitionForSelection(): void;
  9882. /**
  9883. * Sets the `item` as dragging item for current drag-drop operation, `file` is the
  9884. * absolute path of the file to be dragged, and `icon` is the image showing under
  9885. * the cursor when dragging.
  9886. */
  9887. startDrag(item: Item): void;
  9888. /**
  9889. * If *offscreen rendering* is enabled and not painting, start painting.
  9890. */
  9891. startPainting(): void;
  9892. /**
  9893. * Stops any pending navigation.
  9894. */
  9895. stop(): void;
  9896. /**
  9897. * Stops any `findInPage` request for the `webContents` with the provided `action`.
  9898. */
  9899. stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
  9900. /**
  9901. * If *offscreen rendering* is enabled and painting, stop painting.
  9902. */
  9903. stopPainting(): void;
  9904. /**
  9905. * Indicates whether the snapshot has been created successfully.
  9906. *
  9907. Takes a V8 heap snapshot and saves it to `filePath`.
  9908. */
  9909. takeHeapSnapshot(filePath: string): Promise<void>;
  9910. /**
  9911. * Toggles the developer tools.
  9912. */
  9913. toggleDevTools(): void;
  9914. /**
  9915. * Executes the editing command `undo` in web page.
  9916. */
  9917. undo(): void;
  9918. /**
  9919. * Executes the editing command `unselect` in web page.
  9920. */
  9921. unselect(): void;
  9922. audioMuted: boolean;
  9923. backgroundThrottling: boolean;
  9924. readonly debugger: Debugger;
  9925. readonly devToolsWebContents: (WebContents) | (null);
  9926. frameRate: number;
  9927. readonly hostWebContents: WebContents;
  9928. readonly id: number;
  9929. readonly session: Session;
  9930. userAgent: string;
  9931. zoomFactor: number;
  9932. zoomLevel: number;
  9933. }
  9934. interface WebFrame extends NodeJS.EventEmitter {
  9935. // Docs: https://electronjs.org/docs/api/web-frame
  9936. /**
  9937. * Attempts to free memory that is no longer being used (like images from a
  9938. * previous navigation).
  9939. *
  9940. * Note that blindly calling this method probably makes Electron slower since it
  9941. * will have to refill these emptied caches, you should only call it if an event in
  9942. * your app has occurred that makes you think your page is actually using less
  9943. * memory (i.e. you have navigated from a super heavy page to a mostly empty one,
  9944. * and intend to stay there).
  9945. */
  9946. clearCache(): void;
  9947. /**
  9948. * A promise that resolves with the result of the executed code or is rejected if
  9949. * execution throws or results in a rejected promise.
  9950. *
  9951. * Evaluates `code` in page.
  9952. *
  9953. * In the browser window some HTML APIs like `requestFullScreen` can only be
  9954. * invoked by a gesture from the user. Setting `userGesture` to `true` will remove
  9955. * this limitation.
  9956. */
  9957. executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
  9958. /**
  9959. * A promise that resolves with the result of the executed code or is rejected if
  9960. * execution could not start.
  9961. *
  9962. * Works like `executeJavaScript` but evaluates `scripts` in an isolated context.
  9963. *
  9964. * Note that when the execution of script fails, the returned promise will not
  9965. * reject and the `result` would be `undefined`. This is because Chromium does not
  9966. * dispatch errors of isolated worlds to foreign worlds.
  9967. */
  9968. executeJavaScriptInIsolatedWorld(worldId: number, scripts: WebSource[], userGesture?: boolean, callback?: (result: any, error: Error) => void): Promise<any>;
  9969. /**
  9970. * A child of `webFrame` with the supplied `name`, `null` would be returned if
  9971. * there's no such frame or if the frame is not in the current renderer process.
  9972. */
  9973. findFrameByName(name: string): WebFrame;
  9974. /**
  9975. * that has the supplied `routingId`, `null` if not found.
  9976. */
  9977. findFrameByRoutingId(routingId: number): WebFrame;
  9978. /**
  9979. * The frame element in `webFrame's` document selected by `selector`, `null` would
  9980. * be returned if `selector` does not select a frame or if the frame is not in the
  9981. * current renderer process.
  9982. */
  9983. getFrameForSelector(selector: string): WebFrame;
  9984. /**
  9985. * * `images` MemoryUsageDetails
  9986. * * `scripts` MemoryUsageDetails
  9987. * * `cssStyleSheets` MemoryUsageDetails
  9988. * * `xslStyleSheets` MemoryUsageDetails
  9989. * * `fonts` MemoryUsageDetails
  9990. * * `other` MemoryUsageDetails
  9991. *
  9992. * Returns an object describing usage information of Blink's internal memory
  9993. * caches.
  9994. This will generate:
  9995. */
  9996. getResourceUsage(): ResourceUsage;
  9997. /**
  9998. * The current zoom factor.
  9999. */
  10000. getZoomFactor(): number;
  10001. /**
  10002. * The current zoom level.
  10003. */
  10004. getZoomLevel(): number;
  10005. /**
  10006. * A key for the inserted CSS that can later be used to remove the CSS via
  10007. * `webFrame.removeInsertedCSS(key)`.
  10008. *
  10009. * Injects CSS into the current web page and returns a unique key for the inserted
  10010. * stylesheet.
  10011. */
  10012. insertCSS(css: string): string;
  10013. /**
  10014. * Inserts `text` to the focused element.
  10015. */
  10016. insertText(text: string): void;
  10017. /**
  10018. * Removes the inserted CSS from the current web page. The stylesheet is identified
  10019. * by its key, which is returned from `webFrame.insertCSS(css)`.
  10020. */
  10021. removeInsertedCSS(key: string): void;
  10022. /**
  10023. * Set the security origin, content security policy and name of the isolated world.
  10024. * Note: If the `csp` is specified, then the `securityOrigin` also has to be
  10025. * specified.
  10026. */
  10027. setIsolatedWorldInfo(worldId: number, info: Info): void;
  10028. /**
  10029. * Sets a provider for spell checking in input fields and text areas.
  10030. *
  10031. * If you want to use this method you must disable the builtin spellchecker when
  10032. * you construct the window.
  10033. *
  10034. * The `provider` must be an object that has a `spellCheck` method that accepts an
  10035. * array of individual words for spellchecking. The `spellCheck` function runs
  10036. * asynchronously and calls the `callback` function with an array of misspelt words
  10037. * when complete.
  10038. An example of using node-spellchecker as provider:
  10039. */
  10040. setSpellCheckProvider(language: string, provider: Provider): void;
  10041. /**
  10042. * Sets the maximum and minimum pinch-to-zoom level.
  10043. *
  10044. * > **NOTE**: Visual zoom is disabled by default in Electron. To re-enable it,
  10045. * call:
  10046. */
  10047. setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): void;
  10048. /**
  10049. * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
  10050. * divided by 100, so 300% = 3.0.
  10051. The factor must be greater than 0.0.
  10052. */
  10053. setZoomFactor(factor: number): void;
  10054. /**
  10055. * Changes the zoom level to the specified level. The original size is 0 and each
  10056. * increment above or below represents zooming 20% larger or smaller to default
  10057. * limits of 300% and 50% of original size, respectively.
  10058. */
  10059. setZoomLevel(level: number): void;
  10060. /**
  10061. * A `WebFrame | null` representing the first child frame of `webFrame`, the
  10062. * property would be `null` if `webFrame` has no children or if first child is not
  10063. * in the current renderer process.
  10064. *
  10065. */
  10066. readonly firstChild: (WebFrame) | (null);
  10067. /**
  10068. * A `WebFrame | null` representing next sibling frame, the property would be
  10069. * `null` if `webFrame` is the last frame in its parent or if the next sibling is
  10070. * not in the current renderer process.
  10071. *
  10072. */
  10073. readonly nextSibling: (WebFrame) | (null);
  10074. /**
  10075. * A `WebFrame | null` representing the frame which opened `webFrame`, the property
  10076. * would be `null` if there's no opener or opener is not in the current renderer
  10077. * process.
  10078. *
  10079. */
  10080. readonly opener: (WebFrame) | (null);
  10081. /**
  10082. * A `WebFrame | null` representing parent frame of `webFrame`, the property would
  10083. * be `null` if `webFrame` is top or parent is not in the current renderer process.
  10084. *
  10085. */
  10086. readonly parent: (WebFrame) | (null);
  10087. /**
  10088. * An `Integer` representing the unique frame id in the current renderer process.
  10089. * Distinct WebFrame instances that refer to the same underlying frame will have
  10090. * the same `routingId`.
  10091. *
  10092. */
  10093. readonly routingId: number;
  10094. /**
  10095. * A `WebFrame | null` representing top frame in frame hierarchy to which
  10096. * `webFrame` belongs, the property would be `null` if top frame is not in the
  10097. * current renderer process.
  10098. *
  10099. */
  10100. readonly top: (WebFrame) | (null);
  10101. }
  10102. class WebRequest {
  10103. // Docs: https://electronjs.org/docs/api/web-request
  10104. /**
  10105. * The `listener` will be called with `listener(details)` when a server initiated
  10106. * redirect is about to occur.
  10107. */
  10108. onBeforeRedirect(filter: Filter, listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
  10109. /**
  10110. * The `listener` will be called with `listener(details)` when a server initiated
  10111. * redirect is about to occur.
  10112. */
  10113. onBeforeRedirect(listener: ((details: OnBeforeRedirectListenerDetails) => void) | (null)): void;
  10114. /**
  10115. * The `listener` will be called with `listener(details, callback)` when a request
  10116. * is about to occur.
  10117. *
  10118. * The `uploadData` is an array of `UploadData` objects.
  10119. *
  10120. * The `callback` has to be called with an `response` object.
  10121. *
  10122. Some examples of valid `urls`:
  10123. */
  10124. onBeforeRequest(filter: Filter, listener: ((details: OnBeforeRequestListenerDetails, callback: (response: Response) => void) => void) | (null)): void;
  10125. /**
  10126. * The `listener` will be called with `listener(details, callback)` when a request
  10127. * is about to occur.
  10128. *
  10129. * The `uploadData` is an array of `UploadData` objects.
  10130. *
  10131. * The `callback` has to be called with an `response` object.
  10132. *
  10133. Some examples of valid `urls`:
  10134. */
  10135. onBeforeRequest(listener: ((details: OnBeforeRequestListenerDetails, callback: (response: Response) => void) => void) | (null)): void;
  10136. /**
  10137. * The `listener` will be called with `listener(details, callback)` before sending
  10138. * an HTTP request, once the request headers are available. This may occur after a
  10139. * TCP connection is made to the server, but before any http data is sent.
  10140. *
  10141. The `callback` has to be called with a `response` object.
  10142. */
  10143. onBeforeSendHeaders(filter: Filter, listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
  10144. /**
  10145. * The `listener` will be called with `listener(details, callback)` before sending
  10146. * an HTTP request, once the request headers are available. This may occur after a
  10147. * TCP connection is made to the server, but before any http data is sent.
  10148. *
  10149. The `callback` has to be called with a `response` object.
  10150. */
  10151. onBeforeSendHeaders(listener: ((details: OnBeforeSendHeadersListenerDetails, callback: (beforeSendResponse: BeforeSendResponse) => void) => void) | (null)): void;
  10152. /**
  10153. * The `listener` will be called with `listener(details)` when a request is
  10154. * completed.
  10155. */
  10156. onCompleted(filter: Filter, listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
  10157. /**
  10158. * The `listener` will be called with `listener(details)` when a request is
  10159. * completed.
  10160. */
  10161. onCompleted(listener: ((details: OnCompletedListenerDetails) => void) | (null)): void;
  10162. /**
  10163. * The `listener` will be called with `listener(details)` when an error occurs.
  10164. */
  10165. onErrorOccurred(filter: Filter, listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
  10166. /**
  10167. * The `listener` will be called with `listener(details)` when an error occurs.
  10168. */
  10169. onErrorOccurred(listener: ((details: OnErrorOccurredListenerDetails) => void) | (null)): void;
  10170. /**
  10171. * The `listener` will be called with `listener(details, callback)` when HTTP
  10172. * response headers of a request have been received.
  10173. *
  10174. The `callback` has to be called with a `response` object.
  10175. */
  10176. onHeadersReceived(filter: Filter, listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
  10177. /**
  10178. * The `listener` will be called with `listener(details, callback)` when HTTP
  10179. * response headers of a request have been received.
  10180. *
  10181. The `callback` has to be called with a `response` object.
  10182. */
  10183. onHeadersReceived(listener: ((details: OnHeadersReceivedListenerDetails, callback: (headersReceivedResponse: HeadersReceivedResponse) => void) => void) | (null)): void;
  10184. /**
  10185. * The `listener` will be called with `listener(details)` when first byte of the
  10186. * response body is received. For HTTP requests, this means that the status line
  10187. * and response headers are available.
  10188. */
  10189. onResponseStarted(filter: Filter, listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
  10190. /**
  10191. * The `listener` will be called with `listener(details)` when first byte of the
  10192. * response body is received. For HTTP requests, this means that the status line
  10193. * and response headers are available.
  10194. */
  10195. onResponseStarted(listener: ((details: OnResponseStartedListenerDetails) => void) | (null)): void;
  10196. /**
  10197. * The `listener` will be called with `listener(details)` just before a request is
  10198. * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
  10199. * response are visible by the time this listener is fired.
  10200. */
  10201. onSendHeaders(filter: Filter, listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
  10202. /**
  10203. * The `listener` will be called with `listener(details)` just before a request is
  10204. * going to be sent to the server, modifications of previous `onBeforeSendHeaders`
  10205. * response are visible by the time this listener is fired.
  10206. */
  10207. onSendHeaders(listener: ((details: OnSendHeadersListenerDetails) => void) | (null)): void;
  10208. }
  10209. interface WebSource {
  10210. // Docs: https://electronjs.org/docs/api/structures/web-source
  10211. code: string;
  10212. /**
  10213. * Default is 1.
  10214. */
  10215. startLine?: number;
  10216. url?: string;
  10217. }
  10218. interface WebviewTag extends HTMLElement {
  10219. // Docs: https://electronjs.org/docs/api/webview-tag
  10220. /**
  10221. * Fired when a load has committed. This includes navigation within the current
  10222. * document as well as subframe document-level loads, but does not include
  10223. * asynchronous resource loads.
  10224. */
  10225. addEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void, useCapture?: boolean): this;
  10226. removeEventListener(event: 'load-commit', listener: (event: LoadCommitEvent) => void): this;
  10227. /**
  10228. * Fired when the navigation is done, i.e. the spinner of the tab will stop
  10229. * spinning, and the `onload` event is dispatched.
  10230. */
  10231. addEventListener(event: 'did-finish-load', listener: (event: Event) => void, useCapture?: boolean): this;
  10232. removeEventListener(event: 'did-finish-load', listener: (event: Event) => void): this;
  10233. /**
  10234. * This event is like `did-finish-load`, but fired when the load failed or was
  10235. * cancelled, e.g. `window.stop()` is invoked.
  10236. */
  10237. addEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void, useCapture?: boolean): this;
  10238. removeEventListener(event: 'did-fail-load', listener: (event: DidFailLoadEvent) => void): this;
  10239. /**
  10240. * Fired when a frame has done navigation.
  10241. */
  10242. addEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void, useCapture?: boolean): this;
  10243. removeEventListener(event: 'did-frame-finish-load', listener: (event: DidFrameFinishLoadEvent) => void): this;
  10244. /**
  10245. * Corresponds to the points in time when the spinner of the tab starts spinning.
  10246. */
  10247. addEventListener(event: 'did-start-loading', listener: (event: Event) => void, useCapture?: boolean): this;
  10248. removeEventListener(event: 'did-start-loading', listener: (event: Event) => void): this;
  10249. /**
  10250. * Corresponds to the points in time when the spinner of the tab stops spinning.
  10251. */
  10252. addEventListener(event: 'did-stop-loading', listener: (event: Event) => void, useCapture?: boolean): this;
  10253. removeEventListener(event: 'did-stop-loading', listener: (event: Event) => void): this;
  10254. /**
  10255. * Fired when document in the given frame is loaded.
  10256. */
  10257. addEventListener(event: 'dom-ready', listener: (event: Event) => void, useCapture?: boolean): this;
  10258. removeEventListener(event: 'dom-ready', listener: (event: Event) => void): this;
  10259. /**
  10260. * Fired when page title is set during navigation. `explicitSet` is false when
  10261. * title is synthesized from file url.
  10262. */
  10263. addEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void, useCapture?: boolean): this;
  10264. removeEventListener(event: 'page-title-updated', listener: (event: PageTitleUpdatedEvent) => void): this;
  10265. /**
  10266. * Fired when page receives favicon urls.
  10267. */
  10268. addEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void, useCapture?: boolean): this;
  10269. removeEventListener(event: 'page-favicon-updated', listener: (event: PageFaviconUpdatedEvent) => void): this;
  10270. /**
  10271. * Fired when page enters fullscreen triggered by HTML API.
  10272. */
  10273. addEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this;
  10274. removeEventListener(event: 'enter-html-full-screen', listener: (event: Event) => void): this;
  10275. /**
  10276. * Fired when page leaves fullscreen triggered by HTML API.
  10277. */
  10278. addEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void, useCapture?: boolean): this;
  10279. removeEventListener(event: 'leave-html-full-screen', listener: (event: Event) => void): this;
  10280. /**
  10281. * Fired when the guest window logs a console message.
  10282. *
  10283. * The following example code forwards all log messages to the embedder's console
  10284. * without regard for log level or other properties.
  10285. */
  10286. addEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void, useCapture?: boolean): this;
  10287. removeEventListener(event: 'console-message', listener: (event: ConsoleMessageEvent) => void): this;
  10288. /**
  10289. * Fired when a result is available for `webview.findInPage` request.
  10290. */
  10291. addEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void, useCapture?: boolean): this;
  10292. removeEventListener(event: 'found-in-page', listener: (event: FoundInPageEvent) => void): this;
  10293. /**
  10294. * Fired when the guest page attempts to open a new browser window.
  10295. *
  10296. The following example code opens the new url in system's default browser.
  10297. */
  10298. addEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void, useCapture?: boolean): this;
  10299. removeEventListener(event: 'new-window', listener: (event: NewWindowEvent) => void): this;
  10300. /**
  10301. * Emitted when a user or the page wants to start navigation. It can happen when
  10302. * the `window.location` object is changed or a user clicks a link in the page.
  10303. *
  10304. * This event will not emit when the navigation is started programmatically with
  10305. * APIs like `<webview>.loadURL` and `<webview>.back`.
  10306. *
  10307. * It is also not emitted during in-page navigation, such as clicking anchor links
  10308. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  10309. * this purpose.
  10310. Calling `event.preventDefault()` does __NOT__ have any effect.
  10311. */
  10312. addEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void, useCapture?: boolean): this;
  10313. removeEventListener(event: 'will-navigate', listener: (event: WillNavigateEvent) => void): this;
  10314. /**
  10315. * Emitted when a navigation is done.
  10316. *
  10317. * This event is not emitted for in-page navigations, such as clicking anchor links
  10318. * or updating the `window.location.hash`. Use `did-navigate-in-page` event for
  10319. * this purpose.
  10320. */
  10321. addEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void, useCapture?: boolean): this;
  10322. removeEventListener(event: 'did-navigate', listener: (event: DidNavigateEvent) => void): this;
  10323. /**
  10324. * Emitted when an in-page navigation happened.
  10325. *
  10326. * When in-page navigation happens, the page URL changes but does not cause
  10327. * navigation outside of the page. Examples of this occurring are when anchor links
  10328. * are clicked or when the DOM `hashchange` event is triggered.
  10329. */
  10330. addEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void, useCapture?: boolean): this;
  10331. removeEventListener(event: 'did-navigate-in-page', listener: (event: DidNavigateInPageEvent) => void): this;
  10332. /**
  10333. * Fired when the guest page attempts to close itself.
  10334. *
  10335. * The following example code navigates the `webview` to `about:blank` when the
  10336. * guest attempts to close itself.
  10337. */
  10338. addEventListener(event: 'close', listener: (event: Event) => void, useCapture?: boolean): this;
  10339. removeEventListener(event: 'close', listener: (event: Event) => void): this;
  10340. /**
  10341. * Fired when the guest page has sent an asynchronous message to embedder page.
  10342. *
  10343. * With `sendToHost` method and `ipc-message` event you can communicate between
  10344. * guest page and embedder page:
  10345. */
  10346. addEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void, useCapture?: boolean): this;
  10347. removeEventListener(event: 'ipc-message', listener: (event: IpcMessageEvent) => void): this;
  10348. /**
  10349. * Fired when the renderer process is crashed.
  10350. */
  10351. addEventListener(event: 'crashed', listener: (event: Event) => void, useCapture?: boolean): this;
  10352. removeEventListener(event: 'crashed', listener: (event: Event) => void): this;
  10353. /**
  10354. * Fired when a plugin process is crashed.
  10355. */
  10356. addEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void, useCapture?: boolean): this;
  10357. removeEventListener(event: 'plugin-crashed', listener: (event: PluginCrashedEvent) => void): this;
  10358. /**
  10359. * Fired when the WebContents is destroyed.
  10360. */
  10361. addEventListener(event: 'destroyed', listener: (event: Event) => void, useCapture?: boolean): this;
  10362. removeEventListener(event: 'destroyed', listener: (event: Event) => void): this;
  10363. /**
  10364. * Emitted when media starts playing.
  10365. */
  10366. addEventListener(event: 'media-started-playing', listener: (event: Event) => void, useCapture?: boolean): this;
  10367. removeEventListener(event: 'media-started-playing', listener: (event: Event) => void): this;
  10368. /**
  10369. * Emitted when media is paused or done playing.
  10370. */
  10371. addEventListener(event: 'media-paused', listener: (event: Event) => void, useCapture?: boolean): this;
  10372. removeEventListener(event: 'media-paused', listener: (event: Event) => void): this;
  10373. /**
  10374. * Emitted when a page's theme color changes. This is usually due to encountering a
  10375. * meta tag:
  10376. */
  10377. addEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void, useCapture?: boolean): this;
  10378. removeEventListener(event: 'did-change-theme-color', listener: (event: DidChangeThemeColorEvent) => void): this;
  10379. /**
  10380. * Emitted when mouse moves over a link or the keyboard moves the focus to a link.
  10381. */
  10382. addEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void, useCapture?: boolean): this;
  10383. removeEventListener(event: 'update-target-url', listener: (event: UpdateTargetUrlEvent) => void): this;
  10384. /**
  10385. * Emitted when DevTools is opened.
  10386. */
  10387. addEventListener(event: 'devtools-opened', listener: (event: Event) => void, useCapture?: boolean): this;
  10388. removeEventListener(event: 'devtools-opened', listener: (event: Event) => void): this;
  10389. /**
  10390. * Emitted when DevTools is closed.
  10391. */
  10392. addEventListener(event: 'devtools-closed', listener: (event: Event) => void, useCapture?: boolean): this;
  10393. removeEventListener(event: 'devtools-closed', listener: (event: Event) => void): this;
  10394. /**
  10395. * Emitted when DevTools is focused / opened.
  10396. */
  10397. addEventListener(event: 'devtools-focused', listener: (event: Event) => void, useCapture?: boolean): this;
  10398. removeEventListener(event: 'devtools-focused', listener: (event: Event) => void): this;
  10399. addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
  10400. addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
  10401. removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLElement, ev: HTMLElementEventMap[K]) => any, useCapture?: boolean): void;
  10402. removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean): void;
  10403. /**
  10404. * Whether the guest page can go back.
  10405. */
  10406. canGoBack(): boolean;
  10407. /**
  10408. * Whether the guest page can go forward.
  10409. */
  10410. canGoForward(): boolean;
  10411. /**
  10412. * Whether the guest page can go to `offset`.
  10413. */
  10414. canGoToOffset(offset: number): boolean;
  10415. /**
  10416. * Resolves with a NativeImage
  10417. *
  10418. * Captures a snapshot of the page within `rect`. Omitting `rect` will capture the
  10419. * whole visible page.
  10420. */
  10421. capturePage(rect?: Rectangle): Promise<Electron.NativeImage>;
  10422. /**
  10423. * Clears the navigation history.
  10424. */
  10425. clearHistory(): void;
  10426. /**
  10427. * Closes the DevTools window of guest page.
  10428. */
  10429. closeDevTools(): void;
  10430. /**
  10431. * Executes editing command `copy` in page.
  10432. */
  10433. copy(): void;
  10434. /**
  10435. * Executes editing command `cut` in page.
  10436. */
  10437. cut(): void;
  10438. /**
  10439. * Executes editing command `delete` in page.
  10440. */
  10441. delete(): void;
  10442. /**
  10443. * Initiates a download of the resource at `url` without navigating.
  10444. */
  10445. downloadURL(url: string): void;
  10446. /**
  10447. * A promise that resolves with the result of the executed code or is rejected if
  10448. * the result of the code is a rejected promise.
  10449. *
  10450. * Evaluates `code` in page. If `userGesture` is set, it will create the user
  10451. * gesture context in the page. HTML APIs like `requestFullScreen`, which require
  10452. * user action, can take advantage of this option for automation.
  10453. */
  10454. executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
  10455. /**
  10456. * The request id used for the request.
  10457. *
  10458. * Starts a request to find all matches for the `text` in the web page. The result
  10459. * of the request can be obtained by subscribing to `found-in-page` event.
  10460. */
  10461. findInPage(text: string, options?: FindInPageOptions): number;
  10462. /**
  10463. * The title of guest page.
  10464. */
  10465. getTitle(): string;
  10466. /**
  10467. * The URL of guest page.
  10468. */
  10469. getURL(): string;
  10470. /**
  10471. * The user agent for guest page.
  10472. */
  10473. getUserAgent(): string;
  10474. /**
  10475. * The WebContents ID of this `webview`.
  10476. */
  10477. getWebContentsId(): number;
  10478. /**
  10479. * the current zoom factor.
  10480. */
  10481. getZoomFactor(): number;
  10482. /**
  10483. * the current zoom level.
  10484. */
  10485. getZoomLevel(): number;
  10486. /**
  10487. * Makes the guest page go back.
  10488. */
  10489. goBack(): void;
  10490. /**
  10491. * Makes the guest page go forward.
  10492. */
  10493. goForward(): void;
  10494. /**
  10495. * Navigates to the specified absolute index.
  10496. */
  10497. goToIndex(index: number): void;
  10498. /**
  10499. * Navigates to the specified offset from the "current entry".
  10500. */
  10501. goToOffset(offset: number): void;
  10502. /**
  10503. * A promise that resolves with a key for the inserted CSS that can later be used
  10504. * to remove the CSS via `<webview>.removeInsertedCSS(key)`.
  10505. *
  10506. * Injects CSS into the current web page and returns a unique key for the inserted
  10507. * stylesheet.
  10508. */
  10509. insertCSS(css: string): Promise<string>;
  10510. /**
  10511. * Inserts `text` to the focused element.
  10512. */
  10513. insertText(text: string): Promise<void>;
  10514. /**
  10515. * Starts inspecting element at position (`x`, `y`) of guest page.
  10516. */
  10517. inspectElement(x: number, y: number): void;
  10518. /**
  10519. * Opens the DevTools for the service worker context present in the guest page.
  10520. */
  10521. inspectServiceWorker(): void;
  10522. /**
  10523. * Opens the DevTools for the shared worker context present in the guest page.
  10524. */
  10525. inspectSharedWorker(): void;
  10526. /**
  10527. * Whether guest page has been muted.
  10528. */
  10529. isAudioMuted(): boolean;
  10530. /**
  10531. * Whether the renderer process has crashed.
  10532. */
  10533. isCrashed(): boolean;
  10534. /**
  10535. * Whether audio is currently playing.
  10536. */
  10537. isCurrentlyAudible(): boolean;
  10538. /**
  10539. * Whether DevTools window of guest page is focused.
  10540. */
  10541. isDevToolsFocused(): boolean;
  10542. /**
  10543. * Whether guest page has a DevTools window attached.
  10544. */
  10545. isDevToolsOpened(): boolean;
  10546. /**
  10547. * Whether guest page is still loading resources.
  10548. */
  10549. isLoading(): boolean;
  10550. /**
  10551. * Whether the main frame (and not just iframes or frames within it) is still
  10552. * loading.
  10553. */
  10554. isLoadingMainFrame(): boolean;
  10555. /**
  10556. * Whether the guest page is waiting for a first-response for the main resource of
  10557. * the page.
  10558. */
  10559. isWaitingForResponse(): boolean;
  10560. /**
  10561. * The promise will resolve when the page has finished loading (see
  10562. * `did-finish-load`), and rejects if the page fails to load (see `did-fail-load`).
  10563. *
  10564. * Loads the `url` in the webview, the `url` must contain the protocol prefix, e.g.
  10565. * the `http://` or `file://`.
  10566. */
  10567. loadURL(url: string, options?: LoadURLOptions): Promise<void>;
  10568. /**
  10569. * Opens a DevTools window for guest page.
  10570. */
  10571. openDevTools(): void;
  10572. /**
  10573. * Executes editing command `paste` in page.
  10574. */
  10575. paste(): void;
  10576. /**
  10577. * Executes editing command `pasteAndMatchStyle` in page.
  10578. */
  10579. pasteAndMatchStyle(): void;
  10580. /**
  10581. * Prints `webview`'s web page. Same as `webContents.print([options])`.
  10582. */
  10583. print(options?: WebviewTagPrintOptions): Promise<void>;
  10584. /**
  10585. * Resolves with the generated PDF data.
  10586. *
  10587. Prints `webview`'s web page as PDF, Same as `webContents.printToPDF(options)`.
  10588. */
  10589. printToPDF(options: PrintToPDFOptions): Promise<Uint8Array>;
  10590. /**
  10591. * Executes editing command `redo` in page.
  10592. */
  10593. redo(): void;
  10594. /**
  10595. * Reloads the guest page.
  10596. */
  10597. reload(): void;
  10598. /**
  10599. * Reloads the guest page and ignores cache.
  10600. */
  10601. reloadIgnoringCache(): void;
  10602. /**
  10603. * Resolves if the removal was successful.
  10604. *
  10605. * Removes the inserted CSS from the current web page. The stylesheet is identified
  10606. * by its key, which is returned from `<webview>.insertCSS(css)`.
  10607. */
  10608. removeInsertedCSS(key: string): Promise<void>;
  10609. /**
  10610. * Executes editing command `replace` in page.
  10611. */
  10612. replace(text: string): void;
  10613. /**
  10614. * Executes editing command `replaceMisspelling` in page.
  10615. */
  10616. replaceMisspelling(text: string): void;
  10617. /**
  10618. * Executes editing command `selectAll` in page.
  10619. */
  10620. selectAll(): void;
  10621. /**
  10622. * Send an asynchronous message to renderer process via `channel`, you can also
  10623. * send arbitrary arguments. The renderer process can handle the message by
  10624. * listening to the `channel` event with the `ipcRenderer` module.
  10625. *
  10626. See webContents.send for examples.
  10627. */
  10628. send(channel: string, ...args: any[]): Promise<void>;
  10629. /**
  10630. * Sends an input `event` to the page.
  10631. *
  10632. See webContents.sendInputEvent for detailed description of `event` object.
  10633. */
  10634. sendInputEvent(event: (MouseInputEvent) | (MouseWheelInputEvent) | (KeyboardInputEvent)): Promise<void>;
  10635. /**
  10636. * Set guest page muted.
  10637. */
  10638. setAudioMuted(muted: boolean): void;
  10639. /**
  10640. * Overrides the user agent for the guest page.
  10641. */
  10642. setUserAgent(userAgent: string): void;
  10643. /**
  10644. * Sets the maximum and minimum pinch-to-zoom level.
  10645. */
  10646. setVisualZoomLevelLimits(minimumLevel: number, maximumLevel: number): Promise<void>;
  10647. /**
  10648. * Changes the zoom factor to the specified factor. Zoom factor is zoom percent
  10649. * divided by 100, so 300% = 3.0.
  10650. */
  10651. setZoomFactor(factor: number): void;
  10652. /**
  10653. * Changes the zoom level to the specified level. The original size is 0 and each
  10654. * increment above or below represents zooming 20% larger or smaller to default
  10655. * limits of 300% and 50% of original size, respectively. The formula for this is
  10656. * `scale := 1.2 ^ level`.
  10657. */
  10658. setZoomLevel(level: number): void;
  10659. /**
  10660. * Shows pop-up dictionary that searches the selected word on the page.
  10661. *
  10662. * @platform darwin
  10663. */
  10664. showDefinitionForSelection(): void;
  10665. /**
  10666. * Stops any pending navigation.
  10667. */
  10668. stop(): void;
  10669. /**
  10670. * Stops any `findInPage` request for the `webview` with the provided `action`.
  10671. */
  10672. stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
  10673. /**
  10674. * Executes editing command `undo` in page.
  10675. */
  10676. undo(): void;
  10677. /**
  10678. * Executes editing command `unselect` in page.
  10679. */
  10680. unselect(): void;
  10681. /**
  10682. * A `Boolean`. When this attribute is present the guest page will be allowed to
  10683. * open new windows. Popups are disabled by default.
  10684. */
  10685. allowpopups: boolean;
  10686. /**
  10687. * A `String` which is a list of strings which specifies the blink features to be
  10688. * disabled separated by `,`. The full list of supported feature strings can be
  10689. * found in the RuntimeEnabledFeatures.json5 file.
  10690. */
  10691. disableblinkfeatures: string;
  10692. /**
  10693. * A `Boolean`. When this attribute is present the guest page will have web
  10694. * security disabled. Web security is enabled by default.
  10695. */
  10696. disablewebsecurity: boolean;
  10697. /**
  10698. * A `String` which is a list of strings which specifies the blink features to be
  10699. * enabled separated by `,`. The full list of supported feature strings can be
  10700. * found in the RuntimeEnabledFeatures.json5 file.
  10701. */
  10702. enableblinkfeatures: string;
  10703. /**
  10704. * A `Boolean`. When this attribute is `false` the guest page in `webview` will not
  10705. * have access to the `remote` module. The remote module is available by default.
  10706. */
  10707. enableremotemodule: boolean;
  10708. /**
  10709. * A `String` that sets the referrer URL for the guest page.
  10710. */
  10711. httpreferrer: string;
  10712. /**
  10713. * A `Boolean`. When this attribute is present the guest page in `webview` will
  10714. * have node integration and can use node APIs like `require` and `process` to
  10715. * access low level system resources. Node integration is disabled by default in
  10716. * the guest page.
  10717. */
  10718. nodeintegration: boolean;
  10719. /**
  10720. * A `Boolean` for the experimental option for enabling NodeJS support in
  10721. * sub-frames such as iframes inside the `webview`. All your preloads will load for
  10722. * every iframe, you can use `process.isMainFrame` to determine if you are in the
  10723. * main frame or not. This option is disabled by default in the guest page.
  10724. */
  10725. nodeintegrationinsubframes: boolean;
  10726. /**
  10727. * A `String` that sets the session used by the page. If `partition` starts with
  10728. * `persist:`, the page will use a persistent session available to all pages in the
  10729. * app with the same `partition`. if there is no `persist:` prefix, the page will
  10730. * use an in-memory session. By assigning the same `partition`, multiple pages can
  10731. * share the same session. If the `partition` is unset then default session of the
  10732. * app will be used.
  10733. *
  10734. * This value can only be modified before the first navigation, since the session
  10735. * of an active renderer process cannot change. Subsequent attempts to modify the
  10736. * value will fail with a DOM exception.
  10737. */
  10738. partition: string;
  10739. /**
  10740. * A `Boolean`. When this attribute is present the guest page in `webview` will be
  10741. * able to use browser plugins. Plugins are disabled by default.
  10742. */
  10743. plugins: boolean;
  10744. /**
  10745. * A `String` that specifies a script that will be loaded before other scripts run
  10746. * in the guest page. The protocol of script's URL must be either `file:` or
  10747. * `asar:`, because it will be loaded by `require` in guest page under the hood.
  10748. *
  10749. * When the guest page doesn't have node integration this script will still have
  10750. * access to all Node APIs, but global objects injected by Node will be deleted
  10751. * after this script has finished executing.
  10752. *
  10753. * **Note:** This option will appear as `preloadURL` (not `preload`) in the
  10754. * `webPreferences` specified to the `will-attach-webview` event.
  10755. */
  10756. preload: string;
  10757. /**
  10758. * A `String` representing the visible URL. Writing to this attribute initiates
  10759. * top-level navigation.
  10760. *
  10761. * Assigning `src` its own value will reload the current page.
  10762. *
  10763. * The `src` attribute can also accept data URLs, such as `data:text/plain,Hello,
  10764. * world!`.
  10765. */
  10766. src: string;
  10767. /**
  10768. * A `String` that sets the user agent for the guest page before the page is
  10769. * navigated to. Once the page is loaded, use the `setUserAgent` method to change
  10770. * the user agent.
  10771. */
  10772. useragent: string;
  10773. /**
  10774. * A `String` which is a comma separated list of strings which specifies the web
  10775. * preferences to be set on the webview. The full list of supported preference
  10776. * strings can be found in BrowserWindow.
  10777. *
  10778. * The string follows the same format as the features string in `window.open`. A
  10779. * name by itself is given a `true` boolean value. A preference can be set to
  10780. * another value by including an `=`, followed by the value. Special values `yes`
  10781. * and `1` are interpreted as `true`, while `no` and `0` are interpreted as
  10782. * `false`.
  10783. */
  10784. webpreferences: string;
  10785. }
  10786. interface AboutPanelOptionsOptions {
  10787. /**
  10788. * The app's name.
  10789. */
  10790. applicationName?: string;
  10791. /**
  10792. * The app's version.
  10793. */
  10794. applicationVersion?: string;
  10795. /**
  10796. * Copyright information.
  10797. */
  10798. copyright?: string;
  10799. /**
  10800. * The app's build version number.
  10801. *
  10802. * @platform darwin
  10803. */
  10804. version?: string;
  10805. /**
  10806. * Credit information.
  10807. *
  10808. * @platform darwin,win32
  10809. */
  10810. credits?: string;
  10811. /**
  10812. * List of app authors.
  10813. *
  10814. * @platform linux
  10815. */
  10816. authors?: string[];
  10817. /**
  10818. * The app's website.
  10819. *
  10820. * @platform linux
  10821. */
  10822. website?: string;
  10823. /**
  10824. * Path to the app's icon in a JPEG or PNG file format. On Linux, will be shown as
  10825. * 64x64 pixels while retaining aspect ratio.
  10826. *
  10827. * @platform linux,win32
  10828. */
  10829. iconPath?: string;
  10830. }
  10831. interface AddRepresentationOptions {
  10832. /**
  10833. * The scale factor to add the image representation for.
  10834. */
  10835. scaleFactor: number;
  10836. /**
  10837. * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
  10838. */
  10839. width?: number;
  10840. /**
  10841. * Defaults to 0. Required if a bitmap buffer is specified as `buffer`.
  10842. */
  10843. height?: number;
  10844. /**
  10845. * The buffer containing the raw image data.
  10846. */
  10847. buffer?: Buffer;
  10848. /**
  10849. * The data URL containing either a base 64 encoded PNG or JPEG image.
  10850. */
  10851. dataURL?: string;
  10852. }
  10853. interface AnimationSettings {
  10854. /**
  10855. * Returns true if rich animations should be rendered. Looks at session type (e.g.
  10856. * remote desktop) and accessibility settings to give guidance for heavy
  10857. * animations.
  10858. */
  10859. shouldRenderRichAnimation: boolean;
  10860. /**
  10861. * Determines on a per-platform basis whether scroll animations (e.g. produced by
  10862. * home/end key) should be enabled.
  10863. */
  10864. scrollAnimationsEnabledBySystem: boolean;
  10865. /**
  10866. * Determines whether the user desires reduced motion based on platform APIs.
  10867. */
  10868. prefersReducedMotion: boolean;
  10869. }
  10870. interface AppDetailsOptions {
  10871. /**
  10872. * Window's App User Model ID. It has to be set, otherwise the other options will
  10873. * have no effect.
  10874. */
  10875. appId?: string;
  10876. /**
  10877. * Window's Relaunch Icon.
  10878. */
  10879. appIconPath?: string;
  10880. /**
  10881. * Index of the icon in `appIconPath`. Ignored when `appIconPath` is not set.
  10882. * Default is `0`.
  10883. */
  10884. appIconIndex?: number;
  10885. /**
  10886. * Window's Relaunch Command.
  10887. */
  10888. relaunchCommand?: string;
  10889. /**
  10890. * Window's Relaunch Display Name.
  10891. */
  10892. relaunchDisplayName?: string;
  10893. }
  10894. interface ApplicationInfoForProtocolReturnValue {
  10895. /**
  10896. * the display icon of the app handling the protocol.
  10897. */
  10898. icon: NativeImage;
  10899. /**
  10900. * installation path of the app handling the protocol.
  10901. */
  10902. path: string;
  10903. /**
  10904. * display name of the app handling the protocol.
  10905. */
  10906. name: string;
  10907. }
  10908. interface AuthenticationResponseDetails {
  10909. url: string;
  10910. }
  10911. interface AuthInfo {
  10912. isProxy: boolean;
  10913. scheme: string;
  10914. host: string;
  10915. port: number;
  10916. realm: string;
  10917. }
  10918. interface AutoResizeOptions {
  10919. /**
  10920. * If `true`, the view's width will grow and shrink together with the window.
  10921. * `false` by default.
  10922. */
  10923. width?: boolean;
  10924. /**
  10925. * If `true`, the view's height will grow and shrink together with the window.
  10926. * `false` by default.
  10927. */
  10928. height?: boolean;
  10929. /**
  10930. * If `true`, the view's x position and width will grow and shrink proportionally
  10931. * with the window. `false` by default.
  10932. */
  10933. horizontal?: boolean;
  10934. /**
  10935. * If `true`, the view's y position and height will grow and shrink proportionally
  10936. * with the window. `false` by default.
  10937. */
  10938. vertical?: boolean;
  10939. }
  10940. interface BeforeSendResponse {
  10941. cancel?: boolean;
  10942. /**
  10943. * When provided, request will be made with these headers.
  10944. */
  10945. requestHeaders?: Record<string, (string) | (string[])>;
  10946. }
  10947. interface BitmapOptions {
  10948. /**
  10949. * Defaults to 1.0.
  10950. */
  10951. scaleFactor?: number;
  10952. }
  10953. interface BlinkMemoryInfo {
  10954. /**
  10955. * Size of all allocated objects in Kilobytes.
  10956. */
  10957. allocated: number;
  10958. /**
  10959. * Size of all marked objects in Kilobytes.
  10960. */
  10961. marked: number;
  10962. /**
  10963. * Total allocated space in Kilobytes.
  10964. */
  10965. total: number;
  10966. }
  10967. interface BrowserViewConstructorOptions {
  10968. /**
  10969. * See BrowserWindow.
  10970. */
  10971. webPreferences?: WebPreferences;
  10972. }
  10973. interface BrowserWindowConstructorOptions {
  10974. /**
  10975. * Window's width in pixels. Default is `800`.
  10976. */
  10977. width?: number;
  10978. /**
  10979. * Window's height in pixels. Default is `600`.
  10980. */
  10981. height?: number;
  10982. /**
  10983. * (**required** if y is used) Window's left offset from screen. Default is to
  10984. * center the window.
  10985. */
  10986. x?: number;
  10987. /**
  10988. * (**required** if x is used) Window's top offset from screen. Default is to
  10989. * center the window.
  10990. */
  10991. y?: number;
  10992. /**
  10993. * The `width` and `height` would be used as web page's size, which means the
  10994. * actual window's size will include window frame's size and be slightly larger.
  10995. * Default is `false`.
  10996. */
  10997. useContentSize?: boolean;
  10998. /**
  10999. * Show window in the center of the screen.
  11000. */
  11001. center?: boolean;
  11002. /**
  11003. * Window's minimum width. Default is `0`.
  11004. */
  11005. minWidth?: number;
  11006. /**
  11007. * Window's minimum height. Default is `0`.
  11008. */
  11009. minHeight?: number;
  11010. /**
  11011. * Window's maximum width. Default is no limit.
  11012. */
  11013. maxWidth?: number;
  11014. /**
  11015. * Window's maximum height. Default is no limit.
  11016. */
  11017. maxHeight?: number;
  11018. /**
  11019. * Whether window is resizable. Default is `true`.
  11020. */
  11021. resizable?: boolean;
  11022. /**
  11023. * Whether window is movable. This is not implemented on Linux. Default is `true`.
  11024. */
  11025. movable?: boolean;
  11026. /**
  11027. * Whether window is minimizable. This is not implemented on Linux. Default is
  11028. * `true`.
  11029. */
  11030. minimizable?: boolean;
  11031. /**
  11032. * Whether window is maximizable. This is not implemented on Linux. Default is
  11033. * `true`.
  11034. */
  11035. maximizable?: boolean;
  11036. /**
  11037. * Whether window is closable. This is not implemented on Linux. Default is `true`.
  11038. */
  11039. closable?: boolean;
  11040. /**
  11041. * Whether the window can be focused. Default is `true`. On Windows setting
  11042. * `focusable: false` also implies setting `skipTaskbar: true`. On Linux setting
  11043. * `focusable: false` makes the window stop interacting with wm, so the window will
  11044. * always stay on top in all workspaces.
  11045. */
  11046. focusable?: boolean;
  11047. /**
  11048. * Whether the window should always stay on top of other windows. Default is
  11049. * `false`.
  11050. */
  11051. alwaysOnTop?: boolean;
  11052. /**
  11053. * Whether the window should show in fullscreen. When explicitly set to `false` the
  11054. * fullscreen button will be hidden or disabled on macOS. Default is `false`.
  11055. */
  11056. fullscreen?: boolean;
  11057. /**
  11058. * Whether the window can be put into fullscreen mode. On macOS, also whether the
  11059. * maximize/zoom button should toggle full screen mode or maximize window. Default
  11060. * is `true`.
  11061. */
  11062. fullscreenable?: boolean;
  11063. /**
  11064. * Use pre-Lion fullscreen on macOS. Default is `false`.
  11065. */
  11066. simpleFullscreen?: boolean;
  11067. /**
  11068. * Whether to show the window in taskbar. Default is `false`.
  11069. */
  11070. skipTaskbar?: boolean;
  11071. /**
  11072. * Whether the window is in kiosk mode. Default is `false`.
  11073. */
  11074. kiosk?: boolean;
  11075. /**
  11076. * Default window title. Default is `"Electron"`. If the HTML tag `<title>` is
  11077. * defined in the HTML file loaded by `loadURL()`, this property will be ignored.
  11078. */
  11079. title?: string;
  11080. /**
  11081. * The window icon. On Windows it is recommended to use `ICO` icons to get best
  11082. * visual effects, you can also leave it undefined so the executable's icon will be
  11083. * used.
  11084. */
  11085. icon?: (NativeImage) | (string);
  11086. /**
  11087. * Whether window should be shown when created. Default is `true`.
  11088. */
  11089. show?: boolean;
  11090. /**
  11091. * Whether the renderer should be active when `show` is `false` and it has just
  11092. * been created. In order for `document.visibilityState` to work correctly on
  11093. * first load with `show: false` you should set this to `false`. Setting this to
  11094. * `false` will cause the `ready-to-show` event to not fire. Default is `true`.
  11095. */
  11096. paintWhenInitiallyHidden?: boolean;
  11097. /**
  11098. * Specify `false` to create a Frameless Window. Default is `true`.
  11099. */
  11100. frame?: boolean;
  11101. /**
  11102. * Specify parent window. Default is `null`.
  11103. */
  11104. parent?: BrowserWindow;
  11105. /**
  11106. * Whether this is a modal window. This only works when the window is a child
  11107. * window. Default is `false`.
  11108. */
  11109. modal?: boolean;
  11110. /**
  11111. * Whether the web view accepts a single mouse-down event that simultaneously
  11112. * activates the window. Default is `false`.
  11113. */
  11114. acceptFirstMouse?: boolean;
  11115. /**
  11116. * Whether to hide cursor when typing. Default is `false`.
  11117. */
  11118. disableAutoHideCursor?: boolean;
  11119. /**
  11120. * Auto hide the menu bar unless the `Alt` key is pressed. Default is `false`.
  11121. */
  11122. autoHideMenuBar?: boolean;
  11123. /**
  11124. * Enable the window to be resized larger than screen. Only relevant for macOS, as
  11125. * other OSes allow larger-than-screen windows by default. Default is `false`.
  11126. */
  11127. enableLargerThanScreen?: boolean;
  11128. /**
  11129. * Window's background color as a hexadecimal value, like `#66CD00` or `#FFF` or
  11130. * `#80FFFFFF` (alpha in #AARRGGBB format is supported if `transparent` is set to
  11131. * `true`). Default is `#FFF` (white).
  11132. */
  11133. backgroundColor?: string;
  11134. /**
  11135. * Whether window should have a shadow. Default is `true`.
  11136. */
  11137. hasShadow?: boolean;
  11138. /**
  11139. * Set the initial opacity of the window, between 0.0 (fully transparent) and 1.0
  11140. * (fully opaque). This is only implemented on Windows and macOS.
  11141. */
  11142. opacity?: number;
  11143. /**
  11144. * Forces using dark theme for the window, only works on some GTK+3 desktop
  11145. * environments. Default is `false`.
  11146. */
  11147. darkTheme?: boolean;
  11148. /**
  11149. * Makes the window transparent. Default is `false`. On Windows, does not work
  11150. * unless the window is frameless.
  11151. */
  11152. transparent?: boolean;
  11153. /**
  11154. * The type of window, default is normal window. See more about this below.
  11155. */
  11156. type?: string;
  11157. /**
  11158. * Specify how the material appearance should reflect window activity state on
  11159. * macOS. Must be used with the `vibrancy` property. Possible values are:
  11160. */
  11161. visualEffectState?: ('followWindow' | 'active' | 'inactive');
  11162. /**
  11163. * The style of window title bar. Default is `default`. Possible values are:
  11164. */
  11165. titleBarStyle?: ('default' | 'hidden' | 'hiddenInset' | 'customButtonsOnHover');
  11166. /**
  11167. * Set a custom position for the traffic light buttons. Can only be used with
  11168. * `titleBarStyle` set to `hidden`
  11169. */
  11170. trafficLightPosition?: Point;
  11171. /**
  11172. * Shows the title in the title bar in full screen mode on macOS for all
  11173. * `titleBarStyle` options. Default is `false`.
  11174. */
  11175. fullscreenWindowTitle?: boolean;
  11176. /**
  11177. * Use `WS_THICKFRAME` style for frameless windows on Windows, which adds standard
  11178. * window frame. Setting it to `false` will remove window shadow and window
  11179. * animations. Default is `true`.
  11180. */
  11181. thickFrame?: boolean;
  11182. /**
  11183. * Add a type of vibrancy effect to the window, only on macOS. Can be
  11184. * `appearance-based`, `light`, `dark`, `titlebar`, `selection`, `menu`, `popover`,
  11185. * `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`,
  11186. * `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. Please
  11187. * note that using `frame: false` in combination with a vibrancy value requires
  11188. * that you use a non-default `titleBarStyle` as well. Also note that
  11189. * `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` have been
  11190. * deprecated and will be removed in an upcoming version of macOS.
  11191. */
  11192. 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');
  11193. /**
  11194. * Controls the behavior on macOS when option-clicking the green stoplight button
  11195. * on the toolbar or by clicking the Window > Zoom menu item. If `true`, the window
  11196. * will grow to the preferred width of the web page when zoomed, `false` will cause
  11197. * it to zoom to the width of the screen. This will also affect the behavior when
  11198. * calling `maximize()` directly. Default is `false`.
  11199. */
  11200. zoomToPageWidth?: boolean;
  11201. /**
  11202. * Tab group name, allows opening the window as a native tab on macOS 10.12+.
  11203. * Windows with the same tabbing identifier will be grouped together. This also
  11204. * adds a native new tab button to your window's tab bar and allows your `app` and
  11205. * window to receive the `new-window-for-tab` event.
  11206. */
  11207. tabbingIdentifier?: string;
  11208. /**
  11209. * Settings of web page's features.
  11210. */
  11211. webPreferences?: WebPreferences;
  11212. }
  11213. interface CertificateTrustDialogOptions {
  11214. /**
  11215. * The certificate to trust/import.
  11216. */
  11217. certificate: Certificate;
  11218. /**
  11219. * The message to display to the user.
  11220. */
  11221. message: string;
  11222. }
  11223. interface ClearStorageDataOptions {
  11224. /**
  11225. * Should follow `window.location.origin`’s representation `scheme://host:port`.
  11226. */
  11227. origin?: string;
  11228. /**
  11229. * The types of storages to clear, can contain: `appcache`, `cookies`,
  11230. * `filesystem`, `indexdb`, `localstorage`, `shadercache`, `websql`,
  11231. * `serviceworkers`, `cachestorage`. If not specified, clear all storage types.
  11232. */
  11233. storages?: string[];
  11234. /**
  11235. * The types of quotas to clear, can contain: `temporary`, `persistent`,
  11236. * `syncable`. If not specified, clear all quotas.
  11237. */
  11238. quotas?: string[];
  11239. }
  11240. interface ClientRequestConstructorOptions {
  11241. /**
  11242. * The HTTP request method. Defaults to the GET method.
  11243. */
  11244. method?: string;
  11245. /**
  11246. * The request URL. Must be provided in the absolute form with the protocol scheme
  11247. * specified as http or https.
  11248. */
  11249. url?: string;
  11250. /**
  11251. * The `Session` instance with which the request is associated.
  11252. */
  11253. session?: Session;
  11254. /**
  11255. * The name of the `partition` with which the request is associated. Defaults to
  11256. * the empty string. The `session` option prevails on `partition`. Thus if a
  11257. * `session` is explicitly specified, `partition` is ignored.
  11258. */
  11259. partition?: string;
  11260. /**
  11261. * Whether to send cookies with this request from the provided session. This will
  11262. * make the `net` request's cookie behavior match a `fetch` request. Default is
  11263. * `false`.
  11264. */
  11265. useSessionCookies?: boolean;
  11266. /**
  11267. * The protocol scheme in the form 'scheme:'. Currently supported values are
  11268. * 'http:' or 'https:'. Defaults to 'http:'.
  11269. */
  11270. protocol?: string;
  11271. /**
  11272. * The server host provided as a concatenation of the hostname and the port number
  11273. * 'hostname:port'.
  11274. */
  11275. host?: string;
  11276. /**
  11277. * The server host name.
  11278. */
  11279. hostname?: string;
  11280. /**
  11281. * The server's listening port number.
  11282. */
  11283. port?: number;
  11284. /**
  11285. * The path part of the request URL.
  11286. */
  11287. path?: string;
  11288. /**
  11289. * The redirect mode for this request. Should be one of `follow`, `error` or
  11290. * `manual`. Defaults to `follow`. When mode is `error`, any redirection will be
  11291. * aborted. When mode is `manual` the redirection will be cancelled unless
  11292. * `request.followRedirect` is invoked synchronously during the `redirect` event.
  11293. */
  11294. redirect?: string;
  11295. }
  11296. interface Config {
  11297. /**
  11298. * The URL associated with the PAC file.
  11299. */
  11300. pacScript?: string;
  11301. /**
  11302. * Rules indicating which proxies to use.
  11303. */
  11304. proxyRules?: string;
  11305. /**
  11306. * Rules indicating which URLs should bypass the proxy settings.
  11307. */
  11308. proxyBypassRules?: string;
  11309. }
  11310. interface ConsoleMessageEvent extends Event {
  11311. /**
  11312. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  11313. * `error`.
  11314. */
  11315. level: number;
  11316. /**
  11317. * The actual console message
  11318. */
  11319. message: string;
  11320. /**
  11321. * The line number of the source that triggered this console message
  11322. */
  11323. line: number;
  11324. sourceId: string;
  11325. }
  11326. interface ContextMenuParams {
  11327. /**
  11328. * x coordinate.
  11329. */
  11330. x: number;
  11331. /**
  11332. * y coordinate.
  11333. */
  11334. y: number;
  11335. /**
  11336. * URL of the link that encloses the node the context menu was invoked on.
  11337. */
  11338. linkURL: string;
  11339. /**
  11340. * Text associated with the link. May be an empty string if the contents of the
  11341. * link are an image.
  11342. */
  11343. linkText: string;
  11344. /**
  11345. * URL of the top level page that the context menu was invoked on.
  11346. */
  11347. pageURL: string;
  11348. /**
  11349. * URL of the subframe that the context menu was invoked on.
  11350. */
  11351. frameURL: string;
  11352. /**
  11353. * Source URL for the element that the context menu was invoked on. Elements with
  11354. * source URLs are images, audio and video.
  11355. */
  11356. srcURL: string;
  11357. /**
  11358. * Type of the node the context menu was invoked on. Can be `none`, `image`,
  11359. * `audio`, `video`, `canvas`, `file` or `plugin`.
  11360. */
  11361. mediaType: ('none' | 'image' | 'audio' | 'video' | 'canvas' | 'file' | 'plugin');
  11362. /**
  11363. * Whether the context menu was invoked on an image which has non-empty contents.
  11364. */
  11365. hasImageContents: boolean;
  11366. /**
  11367. * Whether the context is editable.
  11368. */
  11369. isEditable: boolean;
  11370. /**
  11371. * Text of the selection that the context menu was invoked on.
  11372. */
  11373. selectionText: string;
  11374. /**
  11375. * Title or alt text of the selection that the context was invoked on.
  11376. */
  11377. titleText: string;
  11378. /**
  11379. * The misspelled word under the cursor, if any.
  11380. */
  11381. misspelledWord: string;
  11382. /**
  11383. * An array of suggested words to show the user to replace the `misspelledWord`.
  11384. * Only available if there is a misspelled word and spellchecker is enabled.
  11385. */
  11386. dictionarySuggestions: string[];
  11387. /**
  11388. * The character encoding of the frame on which the menu was invoked.
  11389. */
  11390. frameCharset: string;
  11391. /**
  11392. * If the context menu was invoked on an input field, the type of that field.
  11393. * Possible values are `none`, `plainText`, `password`, `other`.
  11394. */
  11395. inputFieldType: string;
  11396. /**
  11397. * Input source that invoked the context menu. Can be `none`, `mouse`, `keyboard`,
  11398. * `touch` or `touchMenu`.
  11399. */
  11400. menuSourceType: ('none' | 'mouse' | 'keyboard' | 'touch' | 'touchMenu');
  11401. /**
  11402. * The flags for the media element the context menu was invoked on.
  11403. */
  11404. mediaFlags: MediaFlags;
  11405. /**
  11406. * These flags indicate whether the renderer believes it is able to perform the
  11407. * corresponding action.
  11408. */
  11409. editFlags: EditFlags;
  11410. }
  11411. interface CookiesGetFilter {
  11412. /**
  11413. * Retrieves cookies which are associated with `url`. Empty implies retrieving
  11414. * cookies of all URLs.
  11415. */
  11416. url?: string;
  11417. /**
  11418. * Filters cookies by name.
  11419. */
  11420. name?: string;
  11421. /**
  11422. * Retrieves cookies whose domains match or are subdomains of `domains`.
  11423. */
  11424. domain?: string;
  11425. /**
  11426. * Retrieves cookies whose path matches `path`.
  11427. */
  11428. path?: string;
  11429. /**
  11430. * Filters cookies by their Secure property.
  11431. */
  11432. secure?: boolean;
  11433. /**
  11434. * Filters out session or persistent cookies.
  11435. */
  11436. session?: boolean;
  11437. }
  11438. interface CookiesSetDetails {
  11439. /**
  11440. * The URL to associate the cookie with. The promise will be rejected if the URL is
  11441. * invalid.
  11442. */
  11443. url: string;
  11444. /**
  11445. * The name of the cookie. Empty by default if omitted.
  11446. */
  11447. name?: string;
  11448. /**
  11449. * The value of the cookie. Empty by default if omitted.
  11450. */
  11451. value?: string;
  11452. /**
  11453. * The domain of the cookie; this will be normalized with a preceding dot so that
  11454. * it's also valid for subdomains. Empty by default if omitted.
  11455. */
  11456. domain?: string;
  11457. /**
  11458. * The path of the cookie. Empty by default if omitted.
  11459. */
  11460. path?: string;
  11461. /**
  11462. * Whether the cookie should be marked as Secure. Defaults to false.
  11463. */
  11464. secure?: boolean;
  11465. /**
  11466. * Whether the cookie should be marked as HTTP only. Defaults to false.
  11467. */
  11468. httpOnly?: boolean;
  11469. /**
  11470. * The expiration date of the cookie as the number of seconds since the UNIX epoch.
  11471. * If omitted then the cookie becomes a session cookie and will not be retained
  11472. * between sessions.
  11473. */
  11474. expirationDate?: number;
  11475. /**
  11476. * The Same Site policy to apply to this cookie. Can be `unspecified`,
  11477. * `no_restriction`, `lax` or `strict`. Default is `no_restriction`.
  11478. */
  11479. sameSite?: ('unspecified' | 'no_restriction' | 'lax' | 'strict');
  11480. }
  11481. interface CrashReporterStartOptions {
  11482. /**
  11483. * URL that crash reports will be sent to as POST.
  11484. */
  11485. submitURL: string;
  11486. /**
  11487. * Defaults to `app.name`.
  11488. */
  11489. productName?: string;
  11490. /**
  11491. * Deprecated alias for `{ globalExtra: { _companyName: ... } }`.
  11492. *
  11493. * @deprecated
  11494. */
  11495. companyName?: string;
  11496. /**
  11497. * Whether crash reports should be sent to the server. If false, crash reports will
  11498. * be collected and stored in the crashes directory, but not uploaded. Default is
  11499. * `true`.
  11500. */
  11501. uploadToServer?: boolean;
  11502. /**
  11503. * If true, crashes generated in the main process will not be forwarded to the
  11504. * system crash handler. Default is `false`.
  11505. */
  11506. ignoreSystemCrashHandler?: boolean;
  11507. /**
  11508. * If true, limit the number of crashes uploaded to 1/hour. Default is `false`.
  11509. *
  11510. * @platform darwin,win32
  11511. */
  11512. rateLimit?: boolean;
  11513. /**
  11514. * If true, crash reports will be compressed and uploaded with `Content-Encoding:
  11515. * gzip`. Default is `false`.
  11516. */
  11517. compress?: boolean;
  11518. /**
  11519. * Extra string key/value annotations that will be sent along with crash reports
  11520. * that are generated in the main process. Only string values are supported.
  11521. * Crashes generated in child processes will not contain these extra parameters to
  11522. * crash reports generated from child processes, call `addExtraParameter` from the
  11523. * child process.
  11524. */
  11525. extra?: Record<string, string>;
  11526. /**
  11527. * Extra string key/value annotations that will be sent along with any crash
  11528. * reports generated in any process. These annotations cannot be changed once the
  11529. * crash reporter has been started. If a key is present in both the global extra
  11530. * parameters and the process-specific extra parameters, then the global one will
  11531. * take precedence. By default, `productName` and the app version are included, as
  11532. * well as the Electron version.
  11533. */
  11534. globalExtra?: Record<string, string>;
  11535. }
  11536. interface CreateFromBitmapOptions {
  11537. width: number;
  11538. height: number;
  11539. /**
  11540. * Defaults to 1.0.
  11541. */
  11542. scaleFactor?: number;
  11543. }
  11544. interface CreateFromBufferOptions {
  11545. /**
  11546. * Required for bitmap buffers.
  11547. */
  11548. width?: number;
  11549. /**
  11550. * Required for bitmap buffers.
  11551. */
  11552. height?: number;
  11553. /**
  11554. * Defaults to 1.0.
  11555. */
  11556. scaleFactor?: number;
  11557. }
  11558. interface CreateInterruptedDownloadOptions {
  11559. /**
  11560. * Absolute path of the download.
  11561. */
  11562. path: string;
  11563. /**
  11564. * Complete URL chain for the download.
  11565. */
  11566. urlChain: string[];
  11567. mimeType?: string;
  11568. /**
  11569. * Start range for the download.
  11570. */
  11571. offset: number;
  11572. /**
  11573. * Total length of the download.
  11574. */
  11575. length: number;
  11576. /**
  11577. * Last-Modified header value.
  11578. */
  11579. lastModified?: string;
  11580. /**
  11581. * ETag header value.
  11582. */
  11583. eTag?: string;
  11584. /**
  11585. * Time when download was started in number of seconds since UNIX epoch.
  11586. */
  11587. startTime?: number;
  11588. }
  11589. interface Data {
  11590. text?: string;
  11591. html?: string;
  11592. image?: NativeImage;
  11593. rtf?: string;
  11594. /**
  11595. * The title of the URL at `text`.
  11596. */
  11597. bookmark?: string;
  11598. }
  11599. interface Details {
  11600. /**
  11601. * Process type. One of the following values:
  11602. */
  11603. type: ('Utility' | 'Zygote' | 'Sandbox helper' | 'GPU' | 'Pepper Plugin' | 'Pepper Plugin Broker' | 'Unknown');
  11604. /**
  11605. * The reason the child process is gone. Possible values:
  11606. */
  11607. reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
  11608. /**
  11609. * The exit code for the process (e.g. status from waitpid if on posix, from
  11610. * GetExitCodeProcess on Windows).
  11611. */
  11612. exitCode: number;
  11613. /**
  11614. * The name of the process. i.e. for plugins it might be Flash. Examples for
  11615. * utility: `Audio Service`, `Content Decryption Module Service`, `Network
  11616. * Service`, `Video Capture`, etc.
  11617. */
  11618. name?: string;
  11619. }
  11620. interface DidChangeThemeColorEvent extends Event {
  11621. themeColor: string;
  11622. }
  11623. interface DidFailLoadEvent extends Event {
  11624. errorCode: number;
  11625. errorDescription: string;
  11626. validatedURL: string;
  11627. isMainFrame: boolean;
  11628. }
  11629. interface DidFrameFinishLoadEvent extends Event {
  11630. isMainFrame: boolean;
  11631. }
  11632. interface DidNavigateEvent extends Event {
  11633. url: string;
  11634. }
  11635. interface DidNavigateInPageEvent extends Event {
  11636. isMainFrame: boolean;
  11637. url: string;
  11638. }
  11639. interface DisplayBalloonOptions {
  11640. /**
  11641. * Icon to use when `iconType` is `custom`.
  11642. */
  11643. icon?: (NativeImage) | (string);
  11644. /**
  11645. * Can be `none`, `info`, `warning`, `error` or `custom`. Default is `custom`.
  11646. */
  11647. iconType?: ('none' | 'info' | 'warning' | 'error' | 'custom');
  11648. title: string;
  11649. content: string;
  11650. /**
  11651. * The large version of the icon should be used. Default is `true`. Maps to
  11652. * `NIIF_LARGE_ICON`.
  11653. */
  11654. largeIcon?: boolean;
  11655. /**
  11656. * Do not play the associated sound. Default is `false`. Maps to `NIIF_NOSOUND`.
  11657. */
  11658. noSound?: boolean;
  11659. /**
  11660. * Do not display the balloon notification if the current user is in "quiet time".
  11661. * Default is `false`. Maps to `NIIF_RESPECT_QUIET_TIME`.
  11662. */
  11663. respectQuietTime?: boolean;
  11664. }
  11665. interface EnableNetworkEmulationOptions {
  11666. /**
  11667. * Whether to emulate network outage. Defaults to false.
  11668. */
  11669. offline?: boolean;
  11670. /**
  11671. * RTT in ms. Defaults to 0 which will disable latency throttling.
  11672. */
  11673. latency?: number;
  11674. /**
  11675. * Download rate in Bps. Defaults to 0 which will disable download throttling.
  11676. */
  11677. downloadThroughput?: number;
  11678. /**
  11679. * Upload rate in Bps. Defaults to 0 which will disable upload throttling.
  11680. */
  11681. uploadThroughput?: number;
  11682. }
  11683. interface FeedURLOptions {
  11684. url: string;
  11685. /**
  11686. * HTTP request headers.
  11687. *
  11688. * @platform darwin
  11689. */
  11690. headers?: Record<string, string>;
  11691. /**
  11692. * Can be `json` or `default`, see the Squirrel.Mac README for more information.
  11693. *
  11694. * @platform darwin
  11695. */
  11696. serverType?: ('json' | 'default');
  11697. }
  11698. interface FileIconOptions {
  11699. size: ('small' | 'normal' | 'large');
  11700. }
  11701. interface Filter {
  11702. /**
  11703. * Array of URL patterns that will be used to filter out the requests that do not
  11704. * match the URL patterns.
  11705. */
  11706. urls: string[];
  11707. }
  11708. interface FindInPageOptions {
  11709. /**
  11710. * Whether to search forward or backward, defaults to `true`.
  11711. */
  11712. forward?: boolean;
  11713. /**
  11714. * Whether the operation is first request or a follow up, defaults to `false`.
  11715. */
  11716. findNext?: boolean;
  11717. /**
  11718. * Whether search should be case-sensitive, defaults to `false`.
  11719. */
  11720. matchCase?: boolean;
  11721. /**
  11722. * Whether to look only at the start of words. defaults to `false`.
  11723. */
  11724. wordStart?: boolean;
  11725. /**
  11726. * When combined with `wordStart`, accepts a match in the middle of a word if the
  11727. * match begins with an uppercase letter followed by a lowercase or non-letter.
  11728. * Accepts several other intra-word matches, defaults to `false`.
  11729. */
  11730. medialCapitalAsWordStart?: boolean;
  11731. }
  11732. interface FocusOptions {
  11733. /**
  11734. * Make the receiver the active app even if another app is currently active.
  11735. *
  11736. * @platform darwin
  11737. */
  11738. steal: boolean;
  11739. }
  11740. interface FoundInPageEvent extends Event {
  11741. result: FoundInPageResult;
  11742. }
  11743. interface FromPartitionOptions {
  11744. /**
  11745. * Whether to enable cache.
  11746. */
  11747. cache: boolean;
  11748. }
  11749. interface HeadersReceivedResponse {
  11750. cancel?: boolean;
  11751. /**
  11752. * When provided, the server is assumed to have responded with these headers.
  11753. */
  11754. responseHeaders?: Record<string, (string) | (string[])>;
  11755. /**
  11756. * Should be provided when overriding `responseHeaders` to change header status
  11757. * otherwise original response header's status will be used.
  11758. */
  11759. statusLine?: string;
  11760. }
  11761. interface HeapStatistics {
  11762. totalHeapSize: number;
  11763. totalHeapSizeExecutable: number;
  11764. totalPhysicalSize: number;
  11765. totalAvailableSize: number;
  11766. usedHeapSize: number;
  11767. heapSizeLimit: number;
  11768. mallocedMemory: number;
  11769. peakMallocedMemory: number;
  11770. doesZapGarbage: boolean;
  11771. }
  11772. interface IgnoreMouseEventsOptions {
  11773. /**
  11774. * If true, forwards mouse move messages to Chromium, enabling mouse related events
  11775. * such as `mouseleave`. Only used when `ignore` is true. If `ignore` is false,
  11776. * forwarding is always disabled regardless of this value.
  11777. *
  11778. * @platform darwin,win32
  11779. */
  11780. forward?: boolean;
  11781. }
  11782. interface ImportCertificateOptions {
  11783. /**
  11784. * Path for the pkcs12 file.
  11785. */
  11786. certificate: string;
  11787. /**
  11788. * Passphrase for the certificate.
  11789. */
  11790. password: string;
  11791. }
  11792. interface Info {
  11793. /**
  11794. * Security origin for the isolated world.
  11795. */
  11796. securityOrigin?: string;
  11797. /**
  11798. * Content Security Policy for the isolated world.
  11799. */
  11800. csp?: string;
  11801. /**
  11802. * Name for isolated world. Useful in devtools.
  11803. */
  11804. name?: string;
  11805. }
  11806. interface Input {
  11807. /**
  11808. * Either `keyUp` or `keyDown`.
  11809. */
  11810. type: string;
  11811. /**
  11812. * Equivalent to KeyboardEvent.key.
  11813. */
  11814. key: string;
  11815. /**
  11816. * Equivalent to KeyboardEvent.code.
  11817. */
  11818. code: string;
  11819. /**
  11820. * Equivalent to KeyboardEvent.repeat.
  11821. */
  11822. isAutoRepeat: boolean;
  11823. /**
  11824. * Equivalent to KeyboardEvent.isComposing.
  11825. */
  11826. isComposing: boolean;
  11827. /**
  11828. * Equivalent to KeyboardEvent.shiftKey.
  11829. */
  11830. shift: boolean;
  11831. /**
  11832. * Equivalent to KeyboardEvent.controlKey.
  11833. */
  11834. control: boolean;
  11835. /**
  11836. * Equivalent to KeyboardEvent.altKey.
  11837. */
  11838. alt: boolean;
  11839. /**
  11840. * Equivalent to KeyboardEvent.metaKey.
  11841. */
  11842. meta: boolean;
  11843. }
  11844. interface InsertCSSOptions {
  11845. /**
  11846. * Can be either 'user' or 'author'; Specifying 'user' enables you to prevent
  11847. * websites from overriding the CSS you insert. Default is 'author'.
  11848. */
  11849. cssOrigin?: string;
  11850. }
  11851. interface IpcMessageEvent extends Event {
  11852. channel: string;
  11853. args: any[];
  11854. }
  11855. interface Item {
  11856. /**
  11857. * The path(s) to the file(s) being dragged.
  11858. */
  11859. file: (string[]) | (string);
  11860. /**
  11861. * The image must be non-empty on macOS.
  11862. */
  11863. icon: (NativeImage) | (string);
  11864. }
  11865. interface JumpListSettings {
  11866. /**
  11867. * The minimum number of items that will be shown in the Jump List (for a more
  11868. * detailed description of this value see the MSDN docs).
  11869. */
  11870. minItems: number;
  11871. /**
  11872. * Array of `JumpListItem` objects that correspond to items that the user has
  11873. * explicitly removed from custom categories in the Jump List. These items must not
  11874. * be re-added to the Jump List in the **next** call to `app.setJumpList()`,
  11875. * Windows will not display any custom category that contains any of the removed
  11876. * items.
  11877. */
  11878. removedItems: JumpListItem[];
  11879. }
  11880. interface LoadCommitEvent extends Event {
  11881. url: string;
  11882. isMainFrame: boolean;
  11883. }
  11884. interface LoadFileOptions {
  11885. /**
  11886. * Passed to `url.format()`.
  11887. */
  11888. query?: Record<string, string>;
  11889. /**
  11890. * Passed to `url.format()`.
  11891. */
  11892. search?: string;
  11893. /**
  11894. * Passed to `url.format()`.
  11895. */
  11896. hash?: string;
  11897. }
  11898. interface LoadURLOptions {
  11899. /**
  11900. * An HTTP Referrer url.
  11901. */
  11902. httpReferrer?: (string) | (Referrer);
  11903. /**
  11904. * A user agent originating the request.
  11905. */
  11906. userAgent?: string;
  11907. /**
  11908. * Extra headers separated by "\n"
  11909. */
  11910. extraHeaders?: string;
  11911. postData?: (UploadRawData[]) | (UploadFile[]) | (UploadBlob[]);
  11912. /**
  11913. * Base url (with trailing path separator) for files to be loaded by the data url.
  11914. * This is needed only if the specified `url` is a data url and needs to load other
  11915. * files.
  11916. */
  11917. baseURLForDataURL?: string;
  11918. }
  11919. interface LoginItemSettings {
  11920. /**
  11921. * `true` if the app is set to open at login.
  11922. */
  11923. openAtLogin: boolean;
  11924. /**
  11925. * `true` if the app is set to open as hidden at login. This setting is not
  11926. * available on MAS builds.
  11927. *
  11928. * @platform darwin
  11929. */
  11930. openAsHidden: boolean;
  11931. /**
  11932. * `true` if the app was opened at login automatically. This setting is not
  11933. * available on MAS builds.
  11934. *
  11935. * @platform darwin
  11936. */
  11937. wasOpenedAtLogin: boolean;
  11938. /**
  11939. * `true` if the app was opened as a hidden login item. This indicates that the app
  11940. * should not open any windows at startup. This setting is not available on MAS
  11941. * builds.
  11942. *
  11943. * @platform darwin
  11944. */
  11945. wasOpenedAsHidden: boolean;
  11946. /**
  11947. * `true` if the app was opened as a login item that should restore the state from
  11948. * the previous session. This indicates that the app should restore the windows
  11949. * that were open the last time the app was closed. This setting is not available
  11950. * on MAS builds.
  11951. *
  11952. * @platform darwin
  11953. */
  11954. restoreState: boolean;
  11955. /**
  11956. * `true` if app is set to open at login and its run key is not deactivated. This
  11957. * differs from `openAtLogin` as it ignores the `args` option, this property will
  11958. * be true if the given executable would be launched at login with **any**
  11959. * arguments.
  11960. *
  11961. * @platform win32
  11962. */
  11963. executableWillLaunchAtLogin: boolean;
  11964. launchItems: LaunchItems[];
  11965. }
  11966. interface LoginItemSettingsOptions {
  11967. /**
  11968. * The executable path to compare against. Defaults to `process.execPath`.
  11969. *
  11970. * @platform win32
  11971. */
  11972. path?: string;
  11973. /**
  11974. * The command-line arguments to compare against. Defaults to an empty array.
  11975. *
  11976. * @platform win32
  11977. */
  11978. args?: string[];
  11979. }
  11980. interface MenuItemConstructorOptions {
  11981. /**
  11982. * Will be called with `click(menuItem, browserWindow, event)` when the menu item
  11983. * is clicked.
  11984. */
  11985. click?: (menuItem: MenuItem, browserWindow: (BrowserWindow) | (undefined), event: KeyboardEvent) => void;
  11986. /**
  11987. * Can be `undo`, `redo`, `cut`, `copy`, `paste`, `pasteAndMatchStyle`, `delete`,
  11988. * `selectAll`, `reload`, `forceReload`, `toggleDevTools`, `resetZoom`, `zoomIn`,
  11989. * `zoomOut`, `togglefullscreen`, `window`, `minimize`, `close`, `help`, `about`,
  11990. * `services`, `hide`, `hideOthers`, `unhide`, `quit`, `startSpeaking`,
  11991. * `stopSpeaking`, `zoom`, `front`, `appMenu`, `fileMenu`, `editMenu`, `viewMenu`,
  11992. * `recentDocuments`, `toggleTabBar`, `selectNextTab`, `selectPreviousTab`,
  11993. * `mergeAllWindows`, `clearRecentDocuments`, `moveTabToNewWindow` or `windowMenu`
  11994. * - Define the action of the menu item, when specified the `click` property will
  11995. * be ignored. See roles.
  11996. */
  11997. 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');
  11998. /**
  11999. * Can be `normal`, `separator`, `submenu`, `checkbox` or `radio`.
  12000. */
  12001. type?: ('normal' | 'separator' | 'submenu' | 'checkbox' | 'radio');
  12002. label?: string;
  12003. sublabel?: string;
  12004. /**
  12005. * Hover text for this menu item.
  12006. *
  12007. * @platform darwin
  12008. */
  12009. toolTip?: string;
  12010. accelerator?: Accelerator;
  12011. icon?: (NativeImage) | (string);
  12012. /**
  12013. * If false, the menu item will be greyed out and unclickable.
  12014. */
  12015. enabled?: boolean;
  12016. /**
  12017. * default is `true`, and when `false` will prevent the accelerator from triggering
  12018. * the item if the item is not visible`.
  12019. *
  12020. * @platform darwin
  12021. */
  12022. acceleratorWorksWhenHidden?: boolean;
  12023. /**
  12024. * If false, the menu item will be entirely hidden.
  12025. */
  12026. visible?: boolean;
  12027. /**
  12028. * Should only be specified for `checkbox` or `radio` type menu items.
  12029. */
  12030. checked?: boolean;
  12031. /**
  12032. * If false, the accelerator won't be registered with the system, but it will still
  12033. * be displayed. Defaults to true.
  12034. *
  12035. * @platform linux,win32
  12036. */
  12037. registerAccelerator?: boolean;
  12038. /**
  12039. * Should be specified for `submenu` type menu items. If `submenu` is specified,
  12040. * the `type: 'submenu'` can be omitted. If the value is not a `Menu` then it will
  12041. * be automatically converted to one using `Menu.buildFromTemplate`.
  12042. */
  12043. submenu?: (MenuItemConstructorOptions[]) | (Menu);
  12044. /**
  12045. * Unique within a single menu. If defined then it can be used as a reference to
  12046. * this item by the position attribute.
  12047. */
  12048. id?: string;
  12049. /**
  12050. * Inserts this item before the item with the specified label. If the referenced
  12051. * item doesn't exist the item will be inserted at the end of the menu. Also
  12052. * implies that the menu item in question should be placed in the same “group” as
  12053. * the item.
  12054. */
  12055. before?: string[];
  12056. /**
  12057. * Inserts this item after the item with the specified label. If the referenced
  12058. * item doesn't exist the item will be inserted at the end of the menu.
  12059. */
  12060. after?: string[];
  12061. /**
  12062. * Provides a means for a single context menu to declare the placement of their
  12063. * containing group before the containing group of the item with the specified
  12064. * label.
  12065. */
  12066. beforeGroupContaining?: string[];
  12067. /**
  12068. * Provides a means for a single context menu to declare the placement of their
  12069. * containing group after the containing group of the item with the specified
  12070. * label.
  12071. */
  12072. afterGroupContaining?: string[];
  12073. }
  12074. interface MessageBoxOptions {
  12075. /**
  12076. * Can be `"none"`, `"info"`, `"error"`, `"question"` or `"warning"`. On Windows,
  12077. * `"question"` displays the same icon as `"info"`, unless you set an icon using
  12078. * the `"icon"` option. On macOS, both `"warning"` and `"error"` display the same
  12079. * warning icon.
  12080. */
  12081. type?: string;
  12082. /**
  12083. * Array of texts for buttons. On Windows, an empty array will result in one button
  12084. * labeled "OK".
  12085. */
  12086. buttons?: string[];
  12087. /**
  12088. * Index of the button in the buttons array which will be selected by default when
  12089. * the message box opens.
  12090. */
  12091. defaultId?: number;
  12092. /**
  12093. * Title of the message box, some platforms will not show it.
  12094. */
  12095. title?: string;
  12096. /**
  12097. * Content of the message box.
  12098. */
  12099. message: string;
  12100. /**
  12101. * Extra information of the message.
  12102. */
  12103. detail?: string;
  12104. /**
  12105. * If provided, the message box will include a checkbox with the given label.
  12106. */
  12107. checkboxLabel?: string;
  12108. /**
  12109. * Initial checked state of the checkbox. `false` by default.
  12110. */
  12111. checkboxChecked?: boolean;
  12112. icon?: NativeImage;
  12113. /**
  12114. * The index of the button to be used to cancel the dialog, via the `Esc` key. By
  12115. * default this is assigned to the first button with "cancel" or "no" as the label.
  12116. * If no such labeled buttons exist and this option is not set, `0` will be used as
  12117. * the return value.
  12118. */
  12119. cancelId?: number;
  12120. /**
  12121. * On Windows Electron will try to figure out which one of the `buttons` are common
  12122. * buttons (like "Cancel" or "Yes"), and show the others as command links in the
  12123. * dialog. This can make the dialog appear in the style of modern Windows apps. If
  12124. * you don't like this behavior, you can set `noLink` to `true`.
  12125. */
  12126. noLink?: boolean;
  12127. /**
  12128. * Normalize the keyboard access keys across platforms. Default is `false`.
  12129. * Enabling this assumes `&` is used in the button labels for the placement of the
  12130. * keyboard shortcut access key and labels will be converted so they work correctly
  12131. * on each platform, `&` characters are removed on macOS, converted to `_` on
  12132. * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
  12133. * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
  12134. * via `Alt-W` on Windows and Linux.
  12135. */
  12136. normalizeAccessKeys?: boolean;
  12137. }
  12138. interface MessageBoxReturnValue {
  12139. /**
  12140. * The index of the clicked button.
  12141. */
  12142. response: number;
  12143. /**
  12144. * The checked state of the checkbox if `checkboxLabel` was set. Otherwise `false`.
  12145. */
  12146. checkboxChecked: boolean;
  12147. }
  12148. interface MessageBoxSyncOptions {
  12149. /**
  12150. * Can be `"none"`, `"info"`, `"error"`, `"question"` or `"warning"`. On Windows,
  12151. * `"question"` displays the same icon as `"info"`, unless you set an icon using
  12152. * the `"icon"` option. On macOS, both `"warning"` and `"error"` display the same
  12153. * warning icon.
  12154. */
  12155. type?: string;
  12156. /**
  12157. * Array of texts for buttons. On Windows, an empty array will result in one button
  12158. * labeled "OK".
  12159. */
  12160. buttons?: string[];
  12161. /**
  12162. * Index of the button in the buttons array which will be selected by default when
  12163. * the message box opens.
  12164. */
  12165. defaultId?: number;
  12166. /**
  12167. * Title of the message box, some platforms will not show it.
  12168. */
  12169. title?: string;
  12170. /**
  12171. * Content of the message box.
  12172. */
  12173. message: string;
  12174. /**
  12175. * Extra information of the message.
  12176. */
  12177. detail?: string;
  12178. /**
  12179. * If provided, the message box will include a checkbox with the given label.
  12180. */
  12181. checkboxLabel?: string;
  12182. /**
  12183. * Initial checked state of the checkbox. `false` by default.
  12184. */
  12185. checkboxChecked?: boolean;
  12186. icon?: (NativeImage) | (string);
  12187. /**
  12188. * The index of the button to be used to cancel the dialog, via the `Esc` key. By
  12189. * default this is assigned to the first button with "cancel" or "no" as the label.
  12190. * If no such labeled buttons exist and this option is not set, `0` will be used as
  12191. * the return value.
  12192. */
  12193. cancelId?: number;
  12194. /**
  12195. * On Windows Electron will try to figure out which one of the `buttons` are common
  12196. * buttons (like "Cancel" or "Yes"), and show the others as command links in the
  12197. * dialog. This can make the dialog appear in the style of modern Windows apps. If
  12198. * you don't like this behavior, you can set `noLink` to `true`.
  12199. */
  12200. noLink?: boolean;
  12201. /**
  12202. * Normalize the keyboard access keys across platforms. Default is `false`.
  12203. * Enabling this assumes `&` is used in the button labels for the placement of the
  12204. * keyboard shortcut access key and labels will be converted so they work correctly
  12205. * on each platform, `&` characters are removed on macOS, converted to `_` on
  12206. * Linux, and left untouched on Windows. For example, a button label of `Vie&w`
  12207. * will be converted to `Vie_w` on Linux and `View` on macOS and can be selected
  12208. * via `Alt-W` on Windows and Linux.
  12209. */
  12210. normalizeAccessKeys?: boolean;
  12211. }
  12212. interface MessageDetails {
  12213. /**
  12214. * The actual console message
  12215. */
  12216. message: string;
  12217. /**
  12218. * The version ID of the service worker that sent the log message
  12219. */
  12220. versionId: number;
  12221. /**
  12222. * The type of source for this message. Can be `javascript`, `xml`, `network`,
  12223. * `console-api`, `storage`, `app-cache`, `rendering`, `security`, `deprecation`,
  12224. * `worker`, `violation`, `intervention`, `recommendation` or `other`.
  12225. */
  12226. source: ('javascript' | 'xml' | 'network' | 'console-api' | 'storage' | 'app-cache' | 'rendering' | 'security' | 'deprecation' | 'worker' | 'violation' | 'intervention' | 'recommendation' | 'other');
  12227. /**
  12228. * The log level, from 0 to 3. In order it matches `verbose`, `info`, `warning` and
  12229. * `error`.
  12230. */
  12231. level: number;
  12232. /**
  12233. * The URL the message came from
  12234. */
  12235. sourceUrl: string;
  12236. /**
  12237. * The line number of the source that triggered this console message
  12238. */
  12239. lineNumber: number;
  12240. }
  12241. interface MessageEvent {
  12242. data: any;
  12243. ports: MessagePortMain[];
  12244. }
  12245. interface MoveToApplicationsFolderOptions {
  12246. /**
  12247. * A handler for potential conflict in move failure.
  12248. */
  12249. conflictHandler?: (conflictType: 'exists' | 'existsAndRunning') => boolean;
  12250. }
  12251. interface NewWindowEvent extends Event {
  12252. url: string;
  12253. frameName: string;
  12254. /**
  12255. * Can be `default`, `foreground-tab`, `background-tab`, `new-window`,
  12256. * `save-to-disk` and `other`.
  12257. */
  12258. disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other');
  12259. /**
  12260. * The options which should be used for creating the new `BrowserWindow`.
  12261. */
  12262. options: BrowserWindowConstructorOptions;
  12263. }
  12264. interface NotificationConstructorOptions {
  12265. /**
  12266. * A title for the notification, which will be shown at the top of the notification
  12267. * window when it is shown.
  12268. */
  12269. title: string;
  12270. /**
  12271. * A subtitle for the notification, which will be displayed below the title.
  12272. *
  12273. * @platform darwin
  12274. */
  12275. subtitle?: string;
  12276. /**
  12277. * The body text of the notification, which will be displayed below the title or
  12278. * subtitle.
  12279. */
  12280. body: string;
  12281. /**
  12282. * Whether or not to emit an OS notification noise when showing the notification.
  12283. */
  12284. silent?: boolean;
  12285. /**
  12286. * An icon to use in the notification.
  12287. */
  12288. icon?: (string) | (NativeImage);
  12289. /**
  12290. * Whether or not to add an inline reply option to the notification.
  12291. *
  12292. * @platform darwin
  12293. */
  12294. hasReply?: boolean;
  12295. /**
  12296. * The timeout duration of the notification. Can be 'default' or 'never'.
  12297. *
  12298. * @platform linux,win32
  12299. */
  12300. timeoutType?: ('default' | 'never');
  12301. /**
  12302. * The placeholder to write in the inline reply input field.
  12303. *
  12304. * @platform darwin
  12305. */
  12306. replyPlaceholder?: string;
  12307. /**
  12308. * The name of the sound file to play when the notification is shown.
  12309. *
  12310. * @platform darwin
  12311. */
  12312. sound?: string;
  12313. /**
  12314. * The urgency level of the notification. Can be 'normal', 'critical', or 'low'.
  12315. *
  12316. * @platform linux
  12317. */
  12318. urgency?: ('normal' | 'critical' | 'low');
  12319. /**
  12320. * Actions to add to the notification. Please read the available actions and
  12321. * limitations in the `NotificationAction` documentation.
  12322. *
  12323. * @platform darwin
  12324. */
  12325. actions?: NotificationAction[];
  12326. /**
  12327. * A custom title for the close button of an alert. An empty string will cause the
  12328. * default localized text to be used.
  12329. *
  12330. * @platform darwin
  12331. */
  12332. closeButtonText?: string;
  12333. }
  12334. interface OnBeforeRedirectListenerDetails {
  12335. id: number;
  12336. url: string;
  12337. method: string;
  12338. webContentsId?: number;
  12339. resourceType: string;
  12340. referrer: string;
  12341. timestamp: number;
  12342. redirectURL: string;
  12343. statusCode: number;
  12344. statusLine: string;
  12345. /**
  12346. * The server IP address that the request was actually sent to.
  12347. */
  12348. ip?: string;
  12349. fromCache: boolean;
  12350. responseHeaders?: Record<string, string[]>;
  12351. }
  12352. interface OnBeforeRequestListenerDetails {
  12353. id: number;
  12354. url: string;
  12355. method: string;
  12356. webContentsId?: number;
  12357. resourceType: string;
  12358. referrer: string;
  12359. timestamp: number;
  12360. uploadData: UploadData[];
  12361. }
  12362. interface OnBeforeSendHeadersListenerDetails {
  12363. id: number;
  12364. url: string;
  12365. method: string;
  12366. webContentsId?: number;
  12367. resourceType: string;
  12368. referrer: string;
  12369. timestamp: number;
  12370. requestHeaders: Record<string, string>;
  12371. }
  12372. interface OnCompletedListenerDetails {
  12373. id: number;
  12374. url: string;
  12375. method: string;
  12376. webContentsId?: number;
  12377. resourceType: string;
  12378. referrer: string;
  12379. timestamp: number;
  12380. responseHeaders?: Record<string, string[]>;
  12381. fromCache: boolean;
  12382. statusCode: number;
  12383. statusLine: string;
  12384. error: string;
  12385. }
  12386. interface OnErrorOccurredListenerDetails {
  12387. id: number;
  12388. url: string;
  12389. method: string;
  12390. webContentsId?: number;
  12391. resourceType: string;
  12392. referrer: string;
  12393. timestamp: number;
  12394. fromCache: boolean;
  12395. /**
  12396. * The error description.
  12397. */
  12398. error: string;
  12399. }
  12400. interface OnHeadersReceivedListenerDetails {
  12401. id: number;
  12402. url: string;
  12403. method: string;
  12404. webContentsId?: number;
  12405. resourceType: string;
  12406. referrer: string;
  12407. timestamp: number;
  12408. statusLine: string;
  12409. statusCode: number;
  12410. requestHeaders: Record<string, string>;
  12411. responseHeaders?: Record<string, string[]>;
  12412. }
  12413. interface OnResponseStartedListenerDetails {
  12414. id: number;
  12415. url: string;
  12416. method: string;
  12417. webContentsId?: number;
  12418. resourceType: string;
  12419. referrer: string;
  12420. timestamp: number;
  12421. responseHeaders?: Record<string, string[]>;
  12422. /**
  12423. * Indicates whether the response was fetched from disk cache.
  12424. */
  12425. fromCache: boolean;
  12426. statusCode: number;
  12427. statusLine: string;
  12428. }
  12429. interface OnSendHeadersListenerDetails {
  12430. id: number;
  12431. url: string;
  12432. method: string;
  12433. webContentsId?: number;
  12434. resourceType: string;
  12435. referrer: string;
  12436. timestamp: number;
  12437. requestHeaders: Record<string, string>;
  12438. }
  12439. interface OpenDevToolsOptions {
  12440. /**
  12441. * Opens the devtools with specified dock state, can be `right`, `bottom`,
  12442. * `undocked`, `detach`. Defaults to last used dock state. In `undocked` mode it's
  12443. * possible to dock back. In `detach` mode it's not.
  12444. */
  12445. mode: ('right' | 'bottom' | 'undocked' | 'detach');
  12446. /**
  12447. * Whether to bring the opened devtools window to the foreground. The default is
  12448. * `true`.
  12449. */
  12450. activate?: boolean;
  12451. }
  12452. interface OpenDialogOptions {
  12453. title?: string;
  12454. defaultPath?: string;
  12455. /**
  12456. * Custom label for the confirmation button, when left empty the default label will
  12457. * be used.
  12458. */
  12459. buttonLabel?: string;
  12460. filters?: FileFilter[];
  12461. /**
  12462. * Contains which features the dialog should use. The following values are
  12463. * supported:
  12464. */
  12465. properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
  12466. /**
  12467. * Message to display above input boxes.
  12468. *
  12469. * @platform darwin
  12470. */
  12471. message?: string;
  12472. /**
  12473. * Create security scoped bookmarks when packaged for the Mac App Store.
  12474. *
  12475. * @platform darwin,mas
  12476. */
  12477. securityScopedBookmarks?: boolean;
  12478. }
  12479. interface OpenDialogReturnValue {
  12480. /**
  12481. * whether or not the dialog was canceled.
  12482. */
  12483. canceled: boolean;
  12484. /**
  12485. * An array of file paths chosen by the user. If the dialog is cancelled this will
  12486. * be an empty array.
  12487. */
  12488. filePaths: string[];
  12489. /**
  12490. * An array matching the `filePaths` array of base64 encoded strings which contains
  12491. * security scoped bookmark data. `securityScopedBookmarks` must be enabled for
  12492. * this to be populated. (For return values, see table here.)
  12493. *
  12494. * @platform darwin,mas
  12495. */
  12496. bookmarks?: string[];
  12497. }
  12498. interface OpenDialogSyncOptions {
  12499. title?: string;
  12500. defaultPath?: string;
  12501. /**
  12502. * Custom label for the confirmation button, when left empty the default label will
  12503. * be used.
  12504. */
  12505. buttonLabel?: string;
  12506. filters?: FileFilter[];
  12507. /**
  12508. * Contains which features the dialog should use. The following values are
  12509. * supported:
  12510. */
  12511. properties?: Array<'openFile' | 'openDirectory' | 'multiSelections' | 'showHiddenFiles' | 'createDirectory' | 'promptToCreate' | 'noResolveAliases' | 'treatPackageAsDirectory' | 'dontAddToRecent'>;
  12512. /**
  12513. * Message to display above input boxes.
  12514. *
  12515. * @platform darwin
  12516. */
  12517. message?: string;
  12518. /**
  12519. * Create security scoped bookmarks when packaged for the Mac App Store.
  12520. *
  12521. * @platform darwin,mas
  12522. */
  12523. securityScopedBookmarks?: boolean;
  12524. }
  12525. interface OpenExternalOptions {
  12526. /**
  12527. * `true` to bring the opened application to the foreground. The default is `true`.
  12528. *
  12529. * @platform darwin
  12530. */
  12531. activate?: boolean;
  12532. /**
  12533. * The working directory.
  12534. *
  12535. * @platform win32
  12536. */
  12537. workingDirectory?: string;
  12538. }
  12539. interface Options {
  12540. }
  12541. interface PageFaviconUpdatedEvent extends Event {
  12542. /**
  12543. * Array of URLs.
  12544. */
  12545. favicons: string[];
  12546. }
  12547. interface PageTitleUpdatedEvent extends Event {
  12548. title: string;
  12549. explicitSet: boolean;
  12550. }
  12551. interface Parameters {
  12552. /**
  12553. * Specify the screen type to emulate (default: `desktop`):
  12554. */
  12555. screenPosition: ('desktop' | 'mobile');
  12556. /**
  12557. * Set the emulated screen size (screenPosition == mobile).
  12558. */
  12559. screenSize: Size;
  12560. /**
  12561. * Position the view on the screen (screenPosition == mobile) (default: `{ x: 0, y:
  12562. * 0 }`).
  12563. */
  12564. viewPosition: Point;
  12565. /**
  12566. * Set the device scale factor (if zero defaults to original device scale factor)
  12567. * (default: `0`).
  12568. */
  12569. deviceScaleFactor: number;
  12570. /**
  12571. * Set the emulated view size (empty means no override)
  12572. */
  12573. viewSize: Size;
  12574. /**
  12575. * Scale of emulated view inside available space (not in fit to view mode)
  12576. * (default: `1`).
  12577. */
  12578. scale: number;
  12579. }
  12580. interface Payment {
  12581. /**
  12582. * The identifier of the purchased product.
  12583. */
  12584. productIdentifier: string;
  12585. /**
  12586. * The quantity purchased.
  12587. */
  12588. quantity: number;
  12589. }
  12590. interface PermissionCheckHandlerHandlerDetails {
  12591. /**
  12592. * The security origin of the `media` check.
  12593. */
  12594. securityOrigin: string;
  12595. /**
  12596. * The type of media access being requested, can be `video`, `audio` or `unknown`
  12597. */
  12598. mediaType: ('video' | 'audio' | 'unknown');
  12599. /**
  12600. * The last URL the requesting frame loaded
  12601. */
  12602. requestingUrl: string;
  12603. /**
  12604. * Whether the frame making the request is the main frame
  12605. */
  12606. isMainFrame: boolean;
  12607. }
  12608. interface PermissionRequestHandlerHandlerDetails {
  12609. /**
  12610. * The url of the `openExternal` request.
  12611. */
  12612. externalURL?: string;
  12613. /**
  12614. * The types of media access being requested, elements can be `video` or `audio`
  12615. */
  12616. mediaTypes?: Array<'video' | 'audio'>;
  12617. /**
  12618. * The last URL the requesting frame loaded
  12619. */
  12620. requestingUrl: string;
  12621. /**
  12622. * Whether the frame making the request is the main frame
  12623. */
  12624. isMainFrame: boolean;
  12625. }
  12626. interface PluginCrashedEvent extends Event {
  12627. name: string;
  12628. version: string;
  12629. }
  12630. interface PopupOptions {
  12631. /**
  12632. * Default is the focused window.
  12633. */
  12634. window?: BrowserWindow;
  12635. /**
  12636. * Default is the current mouse cursor position. Must be declared if `y` is
  12637. * declared.
  12638. */
  12639. x?: number;
  12640. /**
  12641. * Default is the current mouse cursor position. Must be declared if `x` is
  12642. * declared.
  12643. */
  12644. y?: number;
  12645. /**
  12646. * The index of the menu item to be positioned under the mouse cursor at the
  12647. * specified coordinates. Default is -1.
  12648. *
  12649. * @platform darwin
  12650. */
  12651. positioningItem?: number;
  12652. /**
  12653. * Called when menu is closed.
  12654. */
  12655. callback?: () => void;
  12656. }
  12657. interface PreconnectOptions {
  12658. /**
  12659. * URL for preconnect. Only the origin is relevant for opening the socket.
  12660. */
  12661. url: string;
  12662. /**
  12663. * number of sockets to preconnect. Must be between 1 and 6. Defaults to 1.
  12664. */
  12665. numSockets?: number;
  12666. }
  12667. interface PrintToPDFOptions {
  12668. /**
  12669. * the header and footer for the PDF.
  12670. */
  12671. headerFooter?: Record<string, string>;
  12672. /**
  12673. * `true` for landscape, `false` for portrait.
  12674. */
  12675. landscape?: boolean;
  12676. /**
  12677. * Specifies the type of margins to use. Uses 0 for default margin, 1 for no
  12678. * margin, and 2 for minimum margin. and `width` in microns.
  12679. */
  12680. marginsType?: number;
  12681. /**
  12682. * The scale factor of the web page. Can range from 0 to 100.
  12683. */
  12684. scaleFactor?: number;
  12685. /**
  12686. * The page range to print.
  12687. */
  12688. pageRanges?: Record<string, number>;
  12689. /**
  12690. * Specify page size of the generated PDF. Can be `A3`, `A4`, `A5`, `Legal`,
  12691. * `Letter`, `Tabloid` or an Object containing `height`
  12692. */
  12693. pageSize?: (string) | (Size);
  12694. /**
  12695. * Whether to print CSS backgrounds.
  12696. */
  12697. printBackground?: boolean;
  12698. /**
  12699. * Whether to print selection only.
  12700. */
  12701. printSelectionOnly?: boolean;
  12702. }
  12703. interface Privileges {
  12704. /**
  12705. * Default false.
  12706. */
  12707. standard?: boolean;
  12708. /**
  12709. * Default false.
  12710. */
  12711. secure?: boolean;
  12712. /**
  12713. * Default false.
  12714. */
  12715. bypassCSP?: boolean;
  12716. /**
  12717. * Default false.
  12718. */
  12719. allowServiceWorkers?: boolean;
  12720. /**
  12721. * Default false.
  12722. */
  12723. supportFetchAPI?: boolean;
  12724. /**
  12725. * Default false.
  12726. */
  12727. corsEnabled?: boolean;
  12728. /**
  12729. * Default false.
  12730. */
  12731. stream?: boolean;
  12732. }
  12733. interface ProgressBarOptions {
  12734. /**
  12735. * Mode for the progress bar. Can be `none`, `normal`, `indeterminate`, `error` or
  12736. * `paused`.
  12737. *
  12738. * @platform win32
  12739. */
  12740. mode: ('none' | 'normal' | 'indeterminate' | 'error' | 'paused');
  12741. }
  12742. interface Provider {
  12743. spellCheck: (words: string[], callback: (misspeltWords: string[]) => void) => void;
  12744. }
  12745. interface ReadBookmark {
  12746. title: string;
  12747. url: string;
  12748. }
  12749. interface RelaunchOptions {
  12750. args?: string[];
  12751. execPath?: string;
  12752. }
  12753. interface RenderProcessGoneDetails {
  12754. /**
  12755. * The reason the render process is gone. Possible values:
  12756. */
  12757. reason: ('clean-exit' | 'abnormal-exit' | 'killed' | 'crashed' | 'oom' | 'launch-failed' | 'integrity-failure');
  12758. }
  12759. interface Request {
  12760. hostname: string;
  12761. certificate: Certificate;
  12762. validatedCertificate: Certificate;
  12763. /**
  12764. * Verification result from chromium.
  12765. */
  12766. verificationResult: string;
  12767. /**
  12768. * Error code.
  12769. */
  12770. errorCode: number;
  12771. }
  12772. interface ResizeOptions {
  12773. /**
  12774. * Defaults to the image's width.
  12775. */
  12776. width?: number;
  12777. /**
  12778. * Defaults to the image's height.
  12779. */
  12780. height?: number;
  12781. /**
  12782. * The desired quality of the resize image. Possible values are `good`, `better`,
  12783. * or `best`. The default is `best`. These values express a desired quality/speed
  12784. * tradeoff. They are translated into an algorithm-specific method that depends on
  12785. * the capabilities (CPU, GPU) of the underlying platform. It is possible for all
  12786. * three methods to be mapped to the same algorithm on a given platform.
  12787. */
  12788. quality?: string;
  12789. }
  12790. interface ResourceUsage {
  12791. images: MemoryUsageDetails;
  12792. scripts: MemoryUsageDetails;
  12793. cssStyleSheets: MemoryUsageDetails;
  12794. xslStyleSheets: MemoryUsageDetails;
  12795. fonts: MemoryUsageDetails;
  12796. other: MemoryUsageDetails;
  12797. }
  12798. interface Response {
  12799. cancel?: boolean;
  12800. /**
  12801. * The original request is prevented from being sent or completed and is instead
  12802. * redirected to the given URL.
  12803. */
  12804. redirectURL?: string;
  12805. }
  12806. interface Result {
  12807. requestId: number;
  12808. /**
  12809. * Position of the active match.
  12810. */
  12811. activeMatchOrdinal: number;
  12812. /**
  12813. * Number of Matches.
  12814. */
  12815. matches: number;
  12816. /**
  12817. * Coordinates of first match region.
  12818. */
  12819. selectionArea: Rectangle;
  12820. finalUpdate: boolean;
  12821. }
  12822. interface SaveDialogOptions {
  12823. title?: string;
  12824. /**
  12825. * Absolute directory path, absolute file path, or file name to use by default.
  12826. */
  12827. defaultPath?: string;
  12828. /**
  12829. * Custom label for the confirmation button, when left empty the default label will
  12830. * be used.
  12831. */
  12832. buttonLabel?: string;
  12833. filters?: FileFilter[];
  12834. /**
  12835. * Message to display above text fields.
  12836. *
  12837. * @platform darwin
  12838. */
  12839. message?: string;
  12840. /**
  12841. * Custom label for the text displayed in front of the filename text field.
  12842. *
  12843. * @platform darwin
  12844. */
  12845. nameFieldLabel?: string;
  12846. /**
  12847. * Show the tags input box, defaults to `true`.
  12848. *
  12849. * @platform darwin
  12850. */
  12851. showsTagField?: boolean;
  12852. properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
  12853. /**
  12854. * Create a security scoped bookmark when packaged for the Mac App Store. If this
  12855. * option is enabled and the file doesn't already exist a blank file will be
  12856. * created at the chosen path.
  12857. *
  12858. * @platform darwin,mas
  12859. */
  12860. securityScopedBookmarks?: boolean;
  12861. }
  12862. interface SaveDialogReturnValue {
  12863. /**
  12864. * whether or not the dialog was canceled.
  12865. */
  12866. canceled: boolean;
  12867. /**
  12868. * If the dialog is canceled, this will be `undefined`.
  12869. */
  12870. filePath?: string;
  12871. /**
  12872. * Base64 encoded string which contains the security scoped bookmark data for the
  12873. * saved file. `securityScopedBookmarks` must be enabled for this to be present.
  12874. * (For return values, see table here.)
  12875. *
  12876. * @platform darwin,mas
  12877. */
  12878. bookmark?: string;
  12879. }
  12880. interface SaveDialogSyncOptions {
  12881. title?: string;
  12882. /**
  12883. * Absolute directory path, absolute file path, or file name to use by default.
  12884. */
  12885. defaultPath?: string;
  12886. /**
  12887. * Custom label for the confirmation button, when left empty the default label will
  12888. * be used.
  12889. */
  12890. buttonLabel?: string;
  12891. filters?: FileFilter[];
  12892. /**
  12893. * Message to display above text fields.
  12894. *
  12895. * @platform darwin
  12896. */
  12897. message?: string;
  12898. /**
  12899. * Custom label for the text displayed in front of the filename text field.
  12900. *
  12901. * @platform darwin
  12902. */
  12903. nameFieldLabel?: string;
  12904. /**
  12905. * Show the tags input box, defaults to `true`.
  12906. *
  12907. * @platform darwin
  12908. */
  12909. showsTagField?: boolean;
  12910. properties?: Array<'showHiddenFiles' | 'createDirectory' | 'treatPackageAsDirectory' | 'showOverwriteConfirmation' | 'dontAddToRecent'>;
  12911. /**
  12912. * Create a security scoped bookmark when packaged for the Mac App Store. If this
  12913. * option is enabled and the file doesn't already exist a blank file will be
  12914. * created at the chosen path.
  12915. *
  12916. * @platform darwin,mas
  12917. */
  12918. securityScopedBookmarks?: boolean;
  12919. }
  12920. interface Settings {
  12921. /**
  12922. * `true` to open the app at login, `false` to remove the app as a login item.
  12923. * Defaults to `false`.
  12924. */
  12925. openAtLogin?: boolean;
  12926. /**
  12927. * `true` to open the app as hidden. Defaults to `false`. The user can edit this
  12928. * setting from the System Preferences so
  12929. * `app.getLoginItemSettings().wasOpenedAsHidden` should be checked when the app is
  12930. * opened to know the current value. This setting is not available on MAS builds.
  12931. *
  12932. * @platform darwin
  12933. */
  12934. openAsHidden?: boolean;
  12935. /**
  12936. * The executable to launch at login. Defaults to `process.execPath`.
  12937. *
  12938. * @platform win32
  12939. */
  12940. path?: string;
  12941. /**
  12942. * The command-line arguments to pass to the executable. Defaults to an empty
  12943. * array. Take care to wrap paths in quotes.
  12944. *
  12945. * @platform win32
  12946. */
  12947. args?: string[];
  12948. /**
  12949. * `true` will change the startup approved registry key and `enable / disable` the
  12950. * App in Task Manager and Windows Settings. Defaults to `true`.
  12951. *
  12952. * @platform win32
  12953. */
  12954. enabled?: boolean;
  12955. /**
  12956. * value name to write into registry. Defaults to the app's AppUserModelId(). Set
  12957. * the app's login item settings.
  12958. *
  12959. * @platform win32
  12960. */
  12961. name?: string;
  12962. }
  12963. interface SourcesOptions {
  12964. /**
  12965. * An array of Strings that lists the types of desktop sources to be captured,
  12966. * available types are `screen` and `window`.
  12967. */
  12968. types: string[];
  12969. /**
  12970. * The size that the media source thumbnail should be scaled to. Default is `150` x
  12971. * `150`. Set width or height to 0 when you do not need the thumbnails. This will
  12972. * save the processing time required for capturing the content of each window and
  12973. * screen.
  12974. */
  12975. thumbnailSize?: Size;
  12976. /**
  12977. * Set to true to enable fetching window icons. The default value is false. When
  12978. * false the appIcon property of the sources return null. Same if a source has the
  12979. * type screen.
  12980. */
  12981. fetchWindowIcons?: boolean;
  12982. }
  12983. interface StartLoggingOptions {
  12984. /**
  12985. * What kinds of data should be captured. By default, only metadata about requests
  12986. * will be captured. Setting this to `includeSensitive` will include cookies and
  12987. * authentication data. Setting it to `everything` will include all bytes
  12988. * transferred on sockets. Can be `default`, `includeSensitive` or `everything`.
  12989. */
  12990. captureMode?: ('default' | 'includeSensitive' | 'everything');
  12991. /**
  12992. * When the log grows beyond this size, logging will automatically stop. Defaults
  12993. * to unlimited.
  12994. */
  12995. maxFileSize?: number;
  12996. }
  12997. interface SystemMemoryInfo {
  12998. /**
  12999. * The total amount of physical memory in Kilobytes available to the system.
  13000. */
  13001. total: number;
  13002. /**
  13003. * The total amount of memory not being used by applications or disk cache.
  13004. */
  13005. free: number;
  13006. /**
  13007. * The total amount of swap memory in Kilobytes available to the system.
  13008. *
  13009. * @platform win32,linux
  13010. */
  13011. swapTotal: number;
  13012. /**
  13013. * The free amount of swap memory in Kilobytes available to the system.
  13014. *
  13015. * @platform win32,linux
  13016. */
  13017. swapFree: number;
  13018. }
  13019. interface TitleOptions {
  13020. /**
  13021. * The font family variant to display, can be `monospaced` or `monospacedDigit`.
  13022. * `monospaced` is available in macOS 10.15+ and `monospacedDigit` is available in
  13023. * macOS 10.11+. When left blank, the title uses the default system font.
  13024. */
  13025. fontType?: ('monospaced' | 'monospacedDigit');
  13026. }
  13027. interface ToBitmapOptions {
  13028. /**
  13029. * Defaults to 1.0.
  13030. */
  13031. scaleFactor?: number;
  13032. }
  13033. interface ToDataURLOptions {
  13034. /**
  13035. * Defaults to 1.0.
  13036. */
  13037. scaleFactor?: number;
  13038. }
  13039. interface ToPNGOptions {
  13040. /**
  13041. * Defaults to 1.0.
  13042. */
  13043. scaleFactor?: number;
  13044. }
  13045. interface TouchBarButtonConstructorOptions {
  13046. /**
  13047. * Button text.
  13048. */
  13049. label?: string;
  13050. /**
  13051. * A short description of the button for use by screenreaders like VoiceOver.
  13052. */
  13053. accessibilityLabel?: string;
  13054. /**
  13055. * Button background color in hex format, i.e `#ABCDEF`.
  13056. */
  13057. backgroundColor?: string;
  13058. /**
  13059. * Button icon.
  13060. */
  13061. icon?: (NativeImage) | (string);
  13062. /**
  13063. * Can be `left`, `right` or `overlay`. Defaults to `overlay`.
  13064. */
  13065. iconPosition?: ('left' | 'right' | 'overlay');
  13066. /**
  13067. * Function to call when the button is clicked.
  13068. */
  13069. click?: () => void;
  13070. /**
  13071. * Whether the button is in an enabled state. Default is `true`.
  13072. */
  13073. enabled?: boolean;
  13074. }
  13075. interface TouchBarColorPickerConstructorOptions {
  13076. /**
  13077. * Array of hex color strings to appear as possible colors to select.
  13078. */
  13079. availableColors?: string[];
  13080. /**
  13081. * The selected hex color in the picker, i.e `#ABCDEF`.
  13082. */
  13083. selectedColor?: string;
  13084. /**
  13085. * Function to call when a color is selected.
  13086. */
  13087. change?: (color: string) => void;
  13088. }
  13089. interface TouchBarConstructorOptions {
  13090. items?: Array<(TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer)>;
  13091. escapeItem?: (TouchBarButton) | (TouchBarColorPicker) | (TouchBarGroup) | (TouchBarLabel) | (TouchBarPopover) | (TouchBarScrubber) | (TouchBarSegmentedControl) | (TouchBarSlider) | (TouchBarSpacer) | (null);
  13092. }
  13093. interface TouchBarGroupConstructorOptions {
  13094. /**
  13095. * Items to display as a group.
  13096. */
  13097. items: TouchBar;
  13098. }
  13099. interface TouchBarLabelConstructorOptions {
  13100. /**
  13101. * Text to display.
  13102. */
  13103. label?: string;
  13104. /**
  13105. * A short description of the button for use by screenreaders like VoiceOver.
  13106. */
  13107. accessibilityLabel?: string;
  13108. /**
  13109. * Hex color of text, i.e `#ABCDEF`.
  13110. */
  13111. textColor?: string;
  13112. }
  13113. interface TouchBarPopoverConstructorOptions {
  13114. /**
  13115. * Popover button text.
  13116. */
  13117. label?: string;
  13118. /**
  13119. * Popover button icon.
  13120. */
  13121. icon?: NativeImage;
  13122. /**
  13123. * Items to display in the popover.
  13124. */
  13125. items: TouchBar;
  13126. /**
  13127. * `true` to display a close button on the left of the popover, `false` to not show
  13128. * it. Default is `true`.
  13129. */
  13130. showCloseButton?: boolean;
  13131. }
  13132. interface TouchBarScrubberConstructorOptions {
  13133. /**
  13134. * An array of items to place in this scrubber.
  13135. */
  13136. items: ScrubberItem[];
  13137. /**
  13138. * Called when the user taps an item that was not the last tapped item.
  13139. */
  13140. select?: (selectedIndex: number) => void;
  13141. /**
  13142. * Called when the user taps any item.
  13143. */
  13144. highlight?: (highlightedIndex: number) => void;
  13145. /**
  13146. * Selected item style. Can be `background`, `outline` or `none`. Defaults to
  13147. * `none`.
  13148. */
  13149. selectedStyle?: ('background' | 'outline' | 'none');
  13150. /**
  13151. * Selected overlay item style. Can be `background`, `outline` or `none`. Defaults
  13152. * to `none`.
  13153. */
  13154. overlayStyle?: ('background' | 'outline' | 'none');
  13155. /**
  13156. * Defaults to `false`.
  13157. */
  13158. showArrowButtons?: boolean;
  13159. /**
  13160. * Can be `fixed` or `free`. The default is `free`.
  13161. */
  13162. mode?: ('fixed' | 'free');
  13163. /**
  13164. * Defaults to `true`.
  13165. */
  13166. continuous?: boolean;
  13167. }
  13168. interface TouchBarSegmentedControlConstructorOptions {
  13169. /**
  13170. * Style of the segments:
  13171. */
  13172. segmentStyle?: ('automatic' | 'rounded' | 'textured-rounded' | 'round-rect' | 'textured-square' | 'capsule' | 'small-square' | 'separated');
  13173. /**
  13174. * The selection mode of the control:
  13175. */
  13176. mode?: ('single' | 'multiple' | 'buttons');
  13177. /**
  13178. * An array of segments to place in this control.
  13179. */
  13180. segments: SegmentedControlSegment[];
  13181. /**
  13182. * The index of the currently selected segment, will update automatically with user
  13183. * interaction. When the mode is `multiple` it will be the last selected item.
  13184. */
  13185. selectedIndex?: number;
  13186. /**
  13187. * Called when the user selects a new segment.
  13188. */
  13189. change?: (selectedIndex: number, isSelected: boolean) => void;
  13190. }
  13191. interface TouchBarSliderConstructorOptions {
  13192. /**
  13193. * Label text.
  13194. */
  13195. label?: string;
  13196. /**
  13197. * Selected value.
  13198. */
  13199. value?: number;
  13200. /**
  13201. * Minimum value.
  13202. */
  13203. minValue?: number;
  13204. /**
  13205. * Maximum value.
  13206. */
  13207. maxValue?: number;
  13208. /**
  13209. * Function to call when the slider is changed.
  13210. */
  13211. change?: (newValue: number) => void;
  13212. }
  13213. interface TouchBarSpacerConstructorOptions {
  13214. /**
  13215. * Size of spacer, possible values are:
  13216. */
  13217. size?: ('small' | 'large' | 'flexible');
  13218. }
  13219. interface TraceBufferUsageReturnValue {
  13220. value: number;
  13221. percentage: number;
  13222. }
  13223. interface UpdateTargetUrlEvent extends Event {
  13224. url: string;
  13225. }
  13226. interface UploadProgress {
  13227. /**
  13228. * Whether the request is currently active. If this is false no other properties
  13229. * will be set
  13230. */
  13231. active: boolean;
  13232. /**
  13233. * Whether the upload has started. If this is false both `current` and `total` will
  13234. * be set to 0.
  13235. */
  13236. started: boolean;
  13237. /**
  13238. * The number of bytes that have been uploaded so far
  13239. */
  13240. current: number;
  13241. /**
  13242. * The number of bytes that will be uploaded this request
  13243. */
  13244. total: number;
  13245. }
  13246. interface VisibleOnAllWorkspacesOptions {
  13247. /**
  13248. * Sets whether the window should be visible above fullscreen windows
  13249. *
  13250. * @platform darwin
  13251. */
  13252. visibleOnFullScreen?: boolean;
  13253. }
  13254. interface WebContentsPrintOptions {
  13255. /**
  13256. * Don't ask user for print settings. Default is `false`.
  13257. */
  13258. silent?: boolean;
  13259. /**
  13260. * Prints the background color and image of the web page. Default is `false`.
  13261. */
  13262. printBackground?: boolean;
  13263. /**
  13264. * Set the printer device name to use. Must be the system-defined name and not the
  13265. * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
  13266. */
  13267. deviceName?: string;
  13268. /**
  13269. * Set whether the printed web page will be in color or grayscale. Default is
  13270. * `true`.
  13271. */
  13272. color?: boolean;
  13273. margins?: Margins;
  13274. /**
  13275. * Whether the web page should be printed in landscape mode. Default is `false`.
  13276. */
  13277. landscape?: boolean;
  13278. /**
  13279. * The scale factor of the web page.
  13280. */
  13281. scaleFactor?: number;
  13282. /**
  13283. * The number of pages to print per page sheet.
  13284. */
  13285. pagesPerSheet?: number;
  13286. /**
  13287. * Whether the web page should be collated.
  13288. */
  13289. collate?: boolean;
  13290. /**
  13291. * The number of copies of the web page to print.
  13292. */
  13293. copies?: number;
  13294. /**
  13295. * The page range to print. On macOS, only one range is honored.
  13296. */
  13297. pageRanges?: PageRanges[];
  13298. /**
  13299. * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
  13300. * `longEdge`.
  13301. */
  13302. duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
  13303. dpi?: Record<string, number>;
  13304. /**
  13305. * String to be printed as page header.
  13306. */
  13307. header?: string;
  13308. /**
  13309. * String to be printed as page footer.
  13310. */
  13311. footer?: string;
  13312. /**
  13313. * Specify page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`,
  13314. * `Letter`, `Tabloid` or an Object containing `height`.
  13315. */
  13316. pageSize?: (string) | (Size);
  13317. }
  13318. interface WebviewTagPrintOptions {
  13319. /**
  13320. * Don't ask user for print settings. Default is `false`.
  13321. */
  13322. silent?: boolean;
  13323. /**
  13324. * Prints the background color and image of the web page. Default is `false`.
  13325. */
  13326. printBackground?: boolean;
  13327. /**
  13328. * Set the printer device name to use. Must be the system-defined name and not the
  13329. * 'friendly' name, e.g 'Brother_QL_820NWB' and not 'Brother QL-820NWB'.
  13330. */
  13331. deviceName?: string;
  13332. /**
  13333. * Set whether the printed web page will be in color or grayscale. Default is
  13334. * `true`.
  13335. */
  13336. color?: boolean;
  13337. margins?: Margins;
  13338. /**
  13339. * Whether the web page should be printed in landscape mode. Default is `false`.
  13340. */
  13341. landscape?: boolean;
  13342. /**
  13343. * The scale factor of the web page.
  13344. */
  13345. scaleFactor?: number;
  13346. /**
  13347. * The number of pages to print per page sheet.
  13348. */
  13349. pagesPerSheet?: number;
  13350. /**
  13351. * Whether the web page should be collated.
  13352. */
  13353. collate?: boolean;
  13354. /**
  13355. * The number of copies of the web page to print.
  13356. */
  13357. copies?: number;
  13358. /**
  13359. * The page range to print.
  13360. */
  13361. pageRanges?: PageRanges[];
  13362. /**
  13363. * Set the duplex mode of the printed web page. Can be `simplex`, `shortEdge`, or
  13364. * `longEdge`.
  13365. */
  13366. duplexMode?: ('simplex' | 'shortEdge' | 'longEdge');
  13367. dpi?: Record<string, number>;
  13368. /**
  13369. * String to be printed as page header.
  13370. */
  13371. header?: string;
  13372. /**
  13373. * String to be printed as page footer.
  13374. */
  13375. footer?: string;
  13376. /**
  13377. * Specify page size of the printed document. Can be `A3`, `A4`, `A5`, `Legal`,
  13378. * `Letter`, `Tabloid` or an Object containing `height`.
  13379. */
  13380. pageSize?: (string) | (Size);
  13381. }
  13382. interface WillNavigateEvent extends Event {
  13383. url: string;
  13384. }
  13385. interface EditFlags {
  13386. /**
  13387. * Whether the renderer believes it can undo.
  13388. */
  13389. canUndo: boolean;
  13390. /**
  13391. * Whether the renderer believes it can redo.
  13392. */
  13393. canRedo: boolean;
  13394. /**
  13395. * Whether the renderer believes it can cut.
  13396. */
  13397. canCut: boolean;
  13398. /**
  13399. * Whether the renderer believes it can copy
  13400. */
  13401. canCopy: boolean;
  13402. /**
  13403. * Whether the renderer believes it can paste.
  13404. */
  13405. canPaste: boolean;
  13406. /**
  13407. * Whether the renderer believes it can delete.
  13408. */
  13409. canDelete: boolean;
  13410. /**
  13411. * Whether the renderer believes it can select all.
  13412. */
  13413. canSelectAll: boolean;
  13414. }
  13415. interface FoundInPageResult {
  13416. requestId: number;
  13417. /**
  13418. * Position of the active match.
  13419. */
  13420. activeMatchOrdinal: number;
  13421. /**
  13422. * Number of Matches.
  13423. */
  13424. matches: number;
  13425. /**
  13426. * Coordinates of first match region.
  13427. */
  13428. selectionArea: Rectangle;
  13429. finalUpdate: boolean;
  13430. }
  13431. interface LaunchItems {
  13432. /**
  13433. * name value of a registry entry.
  13434. *
  13435. * @platform win32
  13436. */
  13437. name: string;
  13438. /**
  13439. * The executable to an app that corresponds to a registry entry.
  13440. *
  13441. * @platform win32
  13442. */
  13443. path: string;
  13444. /**
  13445. * the command-line arguments to pass to the executable.
  13446. *
  13447. * @platform win32
  13448. */
  13449. args: string[];
  13450. /**
  13451. * one of `user` or `machine`. Indicates whether the registry entry is under
  13452. * `HKEY_CURRENT USER` or `HKEY_LOCAL_MACHINE`.
  13453. *
  13454. * @platform win32
  13455. */
  13456. scope: string;
  13457. /**
  13458. * `true` if the app registry key is startup approved and therefore shows as
  13459. * `enabled` in Task Manager and Windows settings.
  13460. *
  13461. * @platform win32
  13462. */
  13463. enabled: boolean;
  13464. }
  13465. interface Margins {
  13466. /**
  13467. * Can be `default`, `none`, `printableArea`, or `custom`. If `custom` is chosen,
  13468. * you will also need to specify `top`, `bottom`, `left`, and `right`.
  13469. */
  13470. marginType?: ('default' | 'none' | 'printableArea' | 'custom');
  13471. /**
  13472. * The top margin of the printed web page, in pixels.
  13473. */
  13474. top?: number;
  13475. /**
  13476. * The bottom margin of the printed web page, in pixels.
  13477. */
  13478. bottom?: number;
  13479. /**
  13480. * The left margin of the printed web page, in pixels.
  13481. */
  13482. left?: number;
  13483. /**
  13484. * The right margin of the printed web page, in pixels.
  13485. */
  13486. right?: number;
  13487. }
  13488. interface MediaFlags {
  13489. /**
  13490. * Whether the media element has crashed.
  13491. */
  13492. inError: boolean;
  13493. /**
  13494. * Whether the media element is paused.
  13495. */
  13496. isPaused: boolean;
  13497. /**
  13498. * Whether the media element is muted.
  13499. */
  13500. isMuted: boolean;
  13501. /**
  13502. * Whether the media element has audio.
  13503. */
  13504. hasAudio: boolean;
  13505. /**
  13506. * Whether the media element is looping.
  13507. */
  13508. isLooping: boolean;
  13509. /**
  13510. * Whether the media element's controls are visible.
  13511. */
  13512. isControlsVisible: boolean;
  13513. /**
  13514. * Whether the media element's controls are toggleable.
  13515. */
  13516. canToggleControls: boolean;
  13517. /**
  13518. * Whether the media element can be rotated.
  13519. */
  13520. canRotate: boolean;
  13521. }
  13522. interface PageRanges {
  13523. /**
  13524. * Index of the first page to print (0-based).
  13525. */
  13526. from: number;
  13527. /**
  13528. * Index of the last page to print (inclusive) (0-based).
  13529. */
  13530. to: number;
  13531. }
  13532. interface WebPreferences {
  13533. /**
  13534. * Whether to enable DevTools. If it is set to `false`, can not use
  13535. * `BrowserWindow.webContents.openDevTools()` to open DevTools. Default is `true`.
  13536. */
  13537. devTools?: boolean;
  13538. /**
  13539. * Whether node integration is enabled. Default is `false`.
  13540. */
  13541. nodeIntegration?: boolean;
  13542. /**
  13543. * Whether node integration is enabled in web workers. Default is `false`. More
  13544. * about this can be found in Multithreading.
  13545. */
  13546. nodeIntegrationInWorker?: boolean;
  13547. /**
  13548. * Experimental option for enabling Node.js support in sub-frames such as iframes
  13549. * and child windows. All your preloads will load for every iframe, you can use
  13550. * `process.isMainFrame` to determine if you are in the main frame or not.
  13551. */
  13552. nodeIntegrationInSubFrames?: boolean;
  13553. /**
  13554. * Specifies a script that will be loaded before other scripts run in the page.
  13555. * This script will always have access to node APIs no matter whether node
  13556. * integration is turned on or off. The value should be the absolute file path to
  13557. * the script. When node integration is turned off, the preload script can
  13558. * reintroduce Node global symbols back to the global scope. See example here.
  13559. */
  13560. preload?: string;
  13561. /**
  13562. * If set, this will sandbox the renderer associated with the window, making it
  13563. * compatible with the Chromium OS-level sandbox and disabling the Node.js engine.
  13564. * This is not the same as the `nodeIntegration` option and the APIs available to
  13565. * the preload script are more limited. Read more about the option here.
  13566. */
  13567. sandbox?: boolean;
  13568. /**
  13569. * Whether to enable the `remote` module. Default is `false`.
  13570. */
  13571. enableRemoteModule?: boolean;
  13572. /**
  13573. * Sets the session used by the page. Instead of passing the Session object
  13574. * directly, you can also choose to use the `partition` option instead, which
  13575. * accepts a partition string. When both `session` and `partition` are provided,
  13576. * `session` will be preferred. Default is the default session.
  13577. */
  13578. session?: Session;
  13579. /**
  13580. * Sets the session used by the page according to the session's partition string.
  13581. * If `partition` starts with `persist:`, the page will use a persistent session
  13582. * available to all pages in the app with the same `partition`. If there is no
  13583. * `persist:` prefix, the page will use an in-memory session. By assigning the same
  13584. * `partition`, multiple pages can share the same session. Default is the default
  13585. * session.
  13586. */
  13587. partition?: string;
  13588. /**
  13589. * When specified, web pages with the same `affinity` will run in the same renderer
  13590. * process. Note that due to reusing the renderer process, certain `webPreferences`
  13591. * options will also be shared between the web pages even when you specified
  13592. * different values for them, including but not limited to `preload`, `sandbox` and
  13593. * `nodeIntegration`. So it is suggested to use exact same `webPreferences` for web
  13594. * pages with the same `affinity`. _Deprecated_
  13595. */
  13596. affinity?: string;
  13597. /**
  13598. * The default zoom factor of the page, `3.0` represents `300%`. Default is `1.0`.
  13599. */
  13600. zoomFactor?: number;
  13601. /**
  13602. * Enables JavaScript support. Default is `true`.
  13603. */
  13604. javascript?: boolean;
  13605. /**
  13606. * When `false`, it will disable the same-origin policy (usually using testing
  13607. * websites by people), and set `allowRunningInsecureContent` to `true` if this
  13608. * options has not been set by user. Default is `true`.
  13609. */
  13610. webSecurity?: boolean;
  13611. /**
  13612. * Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is
  13613. * `false`.
  13614. */
  13615. allowRunningInsecureContent?: boolean;
  13616. /**
  13617. * Enables image support. Default is `true`.
  13618. */
  13619. images?: boolean;
  13620. /**
  13621. * Make TextArea elements resizable. Default is `true`.
  13622. */
  13623. textAreasAreResizable?: boolean;
  13624. /**
  13625. * Enables WebGL support. Default is `true`.
  13626. */
  13627. webgl?: boolean;
  13628. /**
  13629. * Whether plugins should be enabled. Default is `false`.
  13630. */
  13631. plugins?: boolean;
  13632. /**
  13633. * Enables Chromium's experimental features. Default is `false`.
  13634. */
  13635. experimentalFeatures?: boolean;
  13636. /**
  13637. * Enables scroll bounce (rubber banding) effect on macOS. Default is `false`.
  13638. */
  13639. scrollBounce?: boolean;
  13640. /**
  13641. * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
  13642. * to enable. The full list of supported feature strings can be found in the
  13643. * RuntimeEnabledFeatures.json5 file.
  13644. */
  13645. enableBlinkFeatures?: string;
  13646. /**
  13647. * A list of feature strings separated by `,`, like `CSSVariables,KeyboardEventKey`
  13648. * to disable. The full list of supported feature strings can be found in the
  13649. * RuntimeEnabledFeatures.json5 file.
  13650. */
  13651. disableBlinkFeatures?: string;
  13652. /**
  13653. * Sets the default font for the font-family.
  13654. */
  13655. defaultFontFamily?: DefaultFontFamily;
  13656. /**
  13657. * Defaults to `16`.
  13658. */
  13659. defaultFontSize?: number;
  13660. /**
  13661. * Defaults to `13`.
  13662. */
  13663. defaultMonospaceFontSize?: number;
  13664. /**
  13665. * Defaults to `0`.
  13666. */
  13667. minimumFontSize?: number;
  13668. /**
  13669. * Defaults to `ISO-8859-1`.
  13670. */
  13671. defaultEncoding?: string;
  13672. /**
  13673. * Whether to throttle animations and timers when the page becomes background. This
  13674. * also affects the Page Visibility API. Defaults to `true`.
  13675. */
  13676. backgroundThrottling?: boolean;
  13677. /**
  13678. * Whether to enable offscreen rendering for the browser window. Defaults to
  13679. * `false`. See the offscreen rendering tutorial for more details.
  13680. */
  13681. offscreen?: boolean;
  13682. /**
  13683. * Whether to run Electron APIs and the specified `preload` script in a separate
  13684. * JavaScript context. Defaults to `false`. The context that the `preload` script
  13685. * runs in will still have full access to the `document` and `window` globals but
  13686. * it will use its own set of JavaScript builtins (`Array`, `Object`, `JSON`, etc.)
  13687. * and will be isolated from any changes made to the global environment by the
  13688. * loaded page. The Electron API will only be available in the `preload` script and
  13689. * not the loaded page. This option should be used when loading potentially
  13690. * untrusted remote content to ensure the loaded content cannot tamper with the
  13691. * `preload` script and any Electron APIs being used. This option uses the same
  13692. * technique used by Chrome Content Scripts. You can access this context in the dev
  13693. * tools by selecting the 'Electron Isolated Context' entry in the combo box at the
  13694. * top of the Console tab.
  13695. */
  13696. contextIsolation?: boolean;
  13697. /**
  13698. * If true, values returned from `webFrame.executeJavaScript` will be sanitized to
  13699. * ensure JS values can't unsafely cross between worlds when using
  13700. * `contextIsolation`. The default is `false`. In Electron 12, the default will be
  13701. * changed to `true`. _Deprecated_
  13702. */
  13703. worldSafeExecuteJavaScript?: boolean;
  13704. /**
  13705. * Whether to use native `window.open()`. Defaults to `false`. Child windows will
  13706. * always have node integration disabled unless `nodeIntegrationInSubFrames` is
  13707. * true. **Note:** This option is currently experimental.
  13708. */
  13709. nativeWindowOpen?: boolean;
  13710. /**
  13711. * Whether to enable the `<webview>` tag. Defaults to `false`. **Note:** The
  13712. * `preload` script configured for the `<webview>` will have node integration
  13713. * enabled when it is executed so you should ensure remote/untrusted content is not
  13714. * able to create a `<webview>` tag with a possibly malicious `preload` script. You
  13715. * can use the `will-attach-webview` event on webContents to strip away the
  13716. * `preload` script and to validate or alter the `<webview>`'s initial settings.
  13717. */
  13718. webviewTag?: boolean;
  13719. /**
  13720. * A list of strings that will be appended to `process.argv` in the renderer
  13721. * process of this app. Useful for passing small bits of data down to renderer
  13722. * process preload scripts.
  13723. */
  13724. additionalArguments?: string[];
  13725. /**
  13726. * Whether to enable browser style consecutive dialog protection. Default is
  13727. * `false`.
  13728. */
  13729. safeDialogs?: boolean;
  13730. /**
  13731. * The message to display when consecutive dialog protection is triggered. If not
  13732. * defined the default message would be used, note that currently the default
  13733. * message is in English and not localized.
  13734. */
  13735. safeDialogsMessage?: string;
  13736. /**
  13737. * Whether to disable dialogs completely. Overrides `safeDialogs`. Default is
  13738. * `false`.
  13739. */
  13740. disableDialogs?: boolean;
  13741. /**
  13742. * Whether dragging and dropping a file or link onto the page causes a navigation.
  13743. * Default is `false`.
  13744. */
  13745. navigateOnDragDrop?: boolean;
  13746. /**
  13747. * Autoplay policy to apply to content in the window, can be
  13748. * `no-user-gesture-required`, `user-gesture-required`,
  13749. * `document-user-activation-required`. Defaults to `no-user-gesture-required`.
  13750. */
  13751. autoplayPolicy?: ('no-user-gesture-required' | 'user-gesture-required' | 'document-user-activation-required');
  13752. /**
  13753. * Whether to prevent the window from resizing when entering HTML Fullscreen.
  13754. * Default is `false`.
  13755. */
  13756. disableHtmlFullscreenWindowResize?: boolean;
  13757. /**
  13758. * An alternative title string provided only to accessibility tools such as screen
  13759. * readers. This string is not directly visible to users.
  13760. */
  13761. accessibleTitle?: string;
  13762. /**
  13763. * Whether to enable the builtin spellchecker. Default is `true`.
  13764. */
  13765. spellcheck?: boolean;
  13766. /**
  13767. * Whether to enable the WebSQL api. Default is `true`.
  13768. */
  13769. enableWebSQL?: boolean;
  13770. /**
  13771. * Enforces the v8 code caching policy used by blink. Accepted values are
  13772. */
  13773. v8CacheOptions?: ('none' | 'code' | 'bypassHeatCheck' | 'bypassHeatCheckAndEagerCompile');
  13774. }
  13775. interface DefaultFontFamily {
  13776. /**
  13777. * Defaults to `Times New Roman`.
  13778. */
  13779. standard?: string;
  13780. /**
  13781. * Defaults to `Times New Roman`.
  13782. */
  13783. serif?: string;
  13784. /**
  13785. * Defaults to `Arial`.
  13786. */
  13787. sansSerif?: string;
  13788. /**
  13789. * Defaults to `Courier New`.
  13790. */
  13791. monospace?: string;
  13792. /**
  13793. * Defaults to `Script`.
  13794. */
  13795. cursive?: string;
  13796. /**
  13797. * Defaults to `Impact`.
  13798. */
  13799. fantasy?: string;
  13800. }
  13801. interface RemoteMainInterface {
  13802. app: App;
  13803. autoUpdater: AutoUpdater;
  13804. BrowserView: typeof BrowserView;
  13805. BrowserWindow: typeof BrowserWindow;
  13806. ClientRequest: typeof ClientRequest;
  13807. clipboard: Clipboard;
  13808. CommandLine: typeof CommandLine;
  13809. contentTracing: ContentTracing;
  13810. Cookies: typeof Cookies;
  13811. crashReporter: CrashReporter;
  13812. Debugger: typeof Debugger;
  13813. desktopCapturer: DesktopCapturer;
  13814. dialog: Dialog;
  13815. Dock: typeof Dock;
  13816. DownloadItem: typeof DownloadItem;
  13817. globalShortcut: GlobalShortcut;
  13818. inAppPurchase: InAppPurchase;
  13819. IncomingMessage: typeof IncomingMessage;
  13820. ipcMain: IpcMain;
  13821. Menu: typeof Menu;
  13822. MenuItem: typeof MenuItem;
  13823. MessageChannelMain: typeof MessageChannelMain;
  13824. MessagePortMain: typeof MessagePortMain;
  13825. nativeImage: typeof NativeImage;
  13826. nativeTheme: NativeTheme;
  13827. net: Net;
  13828. netLog: NetLog;
  13829. Notification: typeof Notification;
  13830. powerMonitor: PowerMonitor;
  13831. powerSaveBlocker: PowerSaveBlocker;
  13832. protocol: Protocol;
  13833. screen: Screen;
  13834. ServiceWorkers: typeof ServiceWorkers;
  13835. session: typeof Session;
  13836. shell: Shell;
  13837. systemPreferences: SystemPreferences;
  13838. TouchBar: typeof TouchBar;
  13839. TouchBarButton: typeof TouchBarButton;
  13840. TouchBarColorPicker: typeof TouchBarColorPicker;
  13841. TouchBarGroup: typeof TouchBarGroup;
  13842. TouchBarLabel: typeof TouchBarLabel;
  13843. TouchBarOtherItemsProxy: typeof TouchBarOtherItemsProxy;
  13844. TouchBarPopover: typeof TouchBarPopover;
  13845. TouchBarScrubber: typeof TouchBarScrubber;
  13846. TouchBarSegmentedControl: typeof TouchBarSegmentedControl;
  13847. TouchBarSlider: typeof TouchBarSlider;
  13848. TouchBarSpacer: typeof TouchBarSpacer;
  13849. Tray: typeof Tray;
  13850. webContents: typeof WebContents;
  13851. WebRequest: typeof WebRequest;
  13852. }
  13853. namespace Common {
  13854. const clipboard: Clipboard;
  13855. const crashReporter: CrashReporter;
  13856. const desktopCapturer: DesktopCapturer;
  13857. class NativeImage extends Electron.NativeImage {}
  13858. type nativeImage = NativeImage;
  13859. const nativeImage: typeof NativeImage;
  13860. const shell: Shell;
  13861. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  13862. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  13863. type AnimationSettings = Electron.AnimationSettings;
  13864. type AppDetailsOptions = Electron.AppDetailsOptions;
  13865. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  13866. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  13867. type AuthInfo = Electron.AuthInfo;
  13868. type AutoResizeOptions = Electron.AutoResizeOptions;
  13869. type BeforeSendResponse = Electron.BeforeSendResponse;
  13870. type BitmapOptions = Electron.BitmapOptions;
  13871. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  13872. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  13873. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  13874. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  13875. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  13876. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  13877. type Config = Electron.Config;
  13878. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  13879. type ContextMenuParams = Electron.ContextMenuParams;
  13880. type CookiesGetFilter = Electron.CookiesGetFilter;
  13881. type CookiesSetDetails = Electron.CookiesSetDetails;
  13882. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  13883. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  13884. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  13885. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  13886. type Data = Electron.Data;
  13887. type Details = Electron.Details;
  13888. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  13889. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  13890. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  13891. type DidNavigateEvent = Electron.DidNavigateEvent;
  13892. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  13893. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  13894. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  13895. type FeedURLOptions = Electron.FeedURLOptions;
  13896. type FileIconOptions = Electron.FileIconOptions;
  13897. type Filter = Electron.Filter;
  13898. type FindInPageOptions = Electron.FindInPageOptions;
  13899. type FocusOptions = Electron.FocusOptions;
  13900. type FoundInPageEvent = Electron.FoundInPageEvent;
  13901. type FromPartitionOptions = Electron.FromPartitionOptions;
  13902. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  13903. type HeapStatistics = Electron.HeapStatistics;
  13904. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  13905. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  13906. type Info = Electron.Info;
  13907. type Input = Electron.Input;
  13908. type InsertCSSOptions = Electron.InsertCSSOptions;
  13909. type IpcMessageEvent = Electron.IpcMessageEvent;
  13910. type Item = Electron.Item;
  13911. type JumpListSettings = Electron.JumpListSettings;
  13912. type LoadCommitEvent = Electron.LoadCommitEvent;
  13913. type LoadFileOptions = Electron.LoadFileOptions;
  13914. type LoadURLOptions = Electron.LoadURLOptions;
  13915. type LoginItemSettings = Electron.LoginItemSettings;
  13916. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  13917. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  13918. type MessageBoxOptions = Electron.MessageBoxOptions;
  13919. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  13920. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  13921. type MessageDetails = Electron.MessageDetails;
  13922. type MessageEvent = Electron.MessageEvent;
  13923. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  13924. type NewWindowEvent = Electron.NewWindowEvent;
  13925. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  13926. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  13927. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  13928. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  13929. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  13930. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  13931. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  13932. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  13933. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  13934. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  13935. type OpenDialogOptions = Electron.OpenDialogOptions;
  13936. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  13937. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  13938. type OpenExternalOptions = Electron.OpenExternalOptions;
  13939. type Options = Electron.Options;
  13940. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  13941. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  13942. type Parameters = Electron.Parameters;
  13943. type Payment = Electron.Payment;
  13944. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  13945. type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
  13946. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  13947. type PopupOptions = Electron.PopupOptions;
  13948. type PreconnectOptions = Electron.PreconnectOptions;
  13949. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  13950. type Privileges = Electron.Privileges;
  13951. type ProgressBarOptions = Electron.ProgressBarOptions;
  13952. type Provider = Electron.Provider;
  13953. type ReadBookmark = Electron.ReadBookmark;
  13954. type RelaunchOptions = Electron.RelaunchOptions;
  13955. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  13956. type Request = Electron.Request;
  13957. type ResizeOptions = Electron.ResizeOptions;
  13958. type ResourceUsage = Electron.ResourceUsage;
  13959. type Response = Electron.Response;
  13960. type Result = Electron.Result;
  13961. type SaveDialogOptions = Electron.SaveDialogOptions;
  13962. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  13963. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  13964. type Settings = Electron.Settings;
  13965. type SourcesOptions = Electron.SourcesOptions;
  13966. type StartLoggingOptions = Electron.StartLoggingOptions;
  13967. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  13968. type TitleOptions = Electron.TitleOptions;
  13969. type ToBitmapOptions = Electron.ToBitmapOptions;
  13970. type ToDataURLOptions = Electron.ToDataURLOptions;
  13971. type ToPNGOptions = Electron.ToPNGOptions;
  13972. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  13973. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  13974. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  13975. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  13976. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  13977. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  13978. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  13979. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  13980. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  13981. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  13982. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  13983. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  13984. type UploadProgress = Electron.UploadProgress;
  13985. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  13986. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  13987. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  13988. type WillNavigateEvent = Electron.WillNavigateEvent;
  13989. type EditFlags = Electron.EditFlags;
  13990. type FoundInPageResult = Electron.FoundInPageResult;
  13991. type LaunchItems = Electron.LaunchItems;
  13992. type Margins = Electron.Margins;
  13993. type MediaFlags = Electron.MediaFlags;
  13994. type PageRanges = Electron.PageRanges;
  13995. type WebPreferences = Electron.WebPreferences;
  13996. type DefaultFontFamily = Electron.DefaultFontFamily;
  13997. type BluetoothDevice = Electron.BluetoothDevice;
  13998. type Certificate = Electron.Certificate;
  13999. type CertificatePrincipal = Electron.CertificatePrincipal;
  14000. type Cookie = Electron.Cookie;
  14001. type CPUUsage = Electron.CPUUsage;
  14002. type CrashReport = Electron.CrashReport;
  14003. type CustomScheme = Electron.CustomScheme;
  14004. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  14005. type Display = Electron.Display;
  14006. type Event = Electron.Event;
  14007. type Extension = Electron.Extension;
  14008. type ExtensionInfo = Electron.ExtensionInfo;
  14009. type FileFilter = Electron.FileFilter;
  14010. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  14011. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  14012. type InputEvent = Electron.InputEvent;
  14013. type IOCounters = Electron.IOCounters;
  14014. type IpcMainEvent = Electron.IpcMainEvent;
  14015. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  14016. type IpcRendererEvent = Electron.IpcRendererEvent;
  14017. type JumpListCategory = Electron.JumpListCategory;
  14018. type JumpListItem = Electron.JumpListItem;
  14019. type KeyboardEvent = Electron.KeyboardEvent;
  14020. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  14021. type MemoryInfo = Electron.MemoryInfo;
  14022. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  14023. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  14024. type MouseInputEvent = Electron.MouseInputEvent;
  14025. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  14026. type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
  14027. type NotificationAction = Electron.NotificationAction;
  14028. type Point = Electron.Point;
  14029. type PostBody = Electron.PostBody;
  14030. type PostData = Electron.PostData;
  14031. type PrinterInfo = Electron.PrinterInfo;
  14032. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  14033. type ProcessMetric = Electron.ProcessMetric;
  14034. type Product = Electron.Product;
  14035. type ProtocolRequest = Electron.ProtocolRequest;
  14036. type ProtocolResponse = Electron.ProtocolResponse;
  14037. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  14038. type Rectangle = Electron.Rectangle;
  14039. type Referrer = Electron.Referrer;
  14040. type ScrubberItem = Electron.ScrubberItem;
  14041. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  14042. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  14043. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  14044. type ShortcutDetails = Electron.ShortcutDetails;
  14045. type Size = Electron.Size;
  14046. type Task = Electron.Task;
  14047. type ThumbarButton = Electron.ThumbarButton;
  14048. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  14049. type TraceConfig = Electron.TraceConfig;
  14050. type Transaction = Electron.Transaction;
  14051. type UploadBlob = Electron.UploadBlob;
  14052. type UploadData = Electron.UploadData;
  14053. type UploadFile = Electron.UploadFile;
  14054. type UploadRawData = Electron.UploadRawData;
  14055. type WebSource = Electron.WebSource;
  14056. }
  14057. namespace Main {
  14058. const app: App;
  14059. const autoUpdater: AutoUpdater;
  14060. class BrowserView extends Electron.BrowserView {}
  14061. class BrowserWindow extends Electron.BrowserWindow {}
  14062. class ClientRequest extends Electron.ClientRequest {}
  14063. class CommandLine extends Electron.CommandLine {}
  14064. const contentTracing: ContentTracing;
  14065. class Cookies extends Electron.Cookies {}
  14066. class Debugger extends Electron.Debugger {}
  14067. const dialog: Dialog;
  14068. class Dock extends Electron.Dock {}
  14069. class DownloadItem extends Electron.DownloadItem {}
  14070. const globalShortcut: GlobalShortcut;
  14071. const inAppPurchase: InAppPurchase;
  14072. class IncomingMessage extends Electron.IncomingMessage {}
  14073. const ipcMain: IpcMain;
  14074. class Menu extends Electron.Menu {}
  14075. class MenuItem extends Electron.MenuItem {}
  14076. class MessageChannelMain extends Electron.MessageChannelMain {}
  14077. class MessagePortMain extends Electron.MessagePortMain {}
  14078. const nativeTheme: NativeTheme;
  14079. const net: Net;
  14080. const netLog: NetLog;
  14081. class Notification extends Electron.Notification {}
  14082. const powerMonitor: PowerMonitor;
  14083. const powerSaveBlocker: PowerSaveBlocker;
  14084. const protocol: Protocol;
  14085. const screen: Screen;
  14086. class ServiceWorkers extends Electron.ServiceWorkers {}
  14087. class Session extends Electron.Session {}
  14088. type session = Session;
  14089. const session: typeof Session;
  14090. const systemPreferences: SystemPreferences;
  14091. class TouchBar extends Electron.TouchBar {}
  14092. class TouchBarButton extends Electron.TouchBarButton {}
  14093. class TouchBarColorPicker extends Electron.TouchBarColorPicker {}
  14094. class TouchBarGroup extends Electron.TouchBarGroup {}
  14095. class TouchBarLabel extends Electron.TouchBarLabel {}
  14096. class TouchBarOtherItemsProxy extends Electron.TouchBarOtherItemsProxy {}
  14097. class TouchBarPopover extends Electron.TouchBarPopover {}
  14098. class TouchBarScrubber extends Electron.TouchBarScrubber {}
  14099. class TouchBarSegmentedControl extends Electron.TouchBarSegmentedControl {}
  14100. class TouchBarSlider extends Electron.TouchBarSlider {}
  14101. class TouchBarSpacer extends Electron.TouchBarSpacer {}
  14102. class Tray extends Electron.Tray {}
  14103. class WebContents extends Electron.WebContents {}
  14104. type webContents = WebContents;
  14105. const webContents: typeof WebContents;
  14106. class WebRequest extends Electron.WebRequest {}
  14107. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  14108. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  14109. type AnimationSettings = Electron.AnimationSettings;
  14110. type AppDetailsOptions = Electron.AppDetailsOptions;
  14111. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  14112. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  14113. type AuthInfo = Electron.AuthInfo;
  14114. type AutoResizeOptions = Electron.AutoResizeOptions;
  14115. type BeforeSendResponse = Electron.BeforeSendResponse;
  14116. type BitmapOptions = Electron.BitmapOptions;
  14117. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  14118. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  14119. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  14120. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  14121. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  14122. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  14123. type Config = Electron.Config;
  14124. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  14125. type ContextMenuParams = Electron.ContextMenuParams;
  14126. type CookiesGetFilter = Electron.CookiesGetFilter;
  14127. type CookiesSetDetails = Electron.CookiesSetDetails;
  14128. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  14129. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  14130. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  14131. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  14132. type Data = Electron.Data;
  14133. type Details = Electron.Details;
  14134. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  14135. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  14136. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  14137. type DidNavigateEvent = Electron.DidNavigateEvent;
  14138. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  14139. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  14140. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  14141. type FeedURLOptions = Electron.FeedURLOptions;
  14142. type FileIconOptions = Electron.FileIconOptions;
  14143. type Filter = Electron.Filter;
  14144. type FindInPageOptions = Electron.FindInPageOptions;
  14145. type FocusOptions = Electron.FocusOptions;
  14146. type FoundInPageEvent = Electron.FoundInPageEvent;
  14147. type FromPartitionOptions = Electron.FromPartitionOptions;
  14148. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  14149. type HeapStatistics = Electron.HeapStatistics;
  14150. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  14151. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  14152. type Info = Electron.Info;
  14153. type Input = Electron.Input;
  14154. type InsertCSSOptions = Electron.InsertCSSOptions;
  14155. type IpcMessageEvent = Electron.IpcMessageEvent;
  14156. type Item = Electron.Item;
  14157. type JumpListSettings = Electron.JumpListSettings;
  14158. type LoadCommitEvent = Electron.LoadCommitEvent;
  14159. type LoadFileOptions = Electron.LoadFileOptions;
  14160. type LoadURLOptions = Electron.LoadURLOptions;
  14161. type LoginItemSettings = Electron.LoginItemSettings;
  14162. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  14163. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  14164. type MessageBoxOptions = Electron.MessageBoxOptions;
  14165. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  14166. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  14167. type MessageDetails = Electron.MessageDetails;
  14168. type MessageEvent = Electron.MessageEvent;
  14169. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  14170. type NewWindowEvent = Electron.NewWindowEvent;
  14171. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  14172. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  14173. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  14174. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  14175. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  14176. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  14177. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  14178. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  14179. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  14180. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  14181. type OpenDialogOptions = Electron.OpenDialogOptions;
  14182. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  14183. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  14184. type OpenExternalOptions = Electron.OpenExternalOptions;
  14185. type Options = Electron.Options;
  14186. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  14187. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  14188. type Parameters = Electron.Parameters;
  14189. type Payment = Electron.Payment;
  14190. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  14191. type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
  14192. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  14193. type PopupOptions = Electron.PopupOptions;
  14194. type PreconnectOptions = Electron.PreconnectOptions;
  14195. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  14196. type Privileges = Electron.Privileges;
  14197. type ProgressBarOptions = Electron.ProgressBarOptions;
  14198. type Provider = Electron.Provider;
  14199. type ReadBookmark = Electron.ReadBookmark;
  14200. type RelaunchOptions = Electron.RelaunchOptions;
  14201. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  14202. type Request = Electron.Request;
  14203. type ResizeOptions = Electron.ResizeOptions;
  14204. type ResourceUsage = Electron.ResourceUsage;
  14205. type Response = Electron.Response;
  14206. type Result = Electron.Result;
  14207. type SaveDialogOptions = Electron.SaveDialogOptions;
  14208. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  14209. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  14210. type Settings = Electron.Settings;
  14211. type SourcesOptions = Electron.SourcesOptions;
  14212. type StartLoggingOptions = Electron.StartLoggingOptions;
  14213. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  14214. type TitleOptions = Electron.TitleOptions;
  14215. type ToBitmapOptions = Electron.ToBitmapOptions;
  14216. type ToDataURLOptions = Electron.ToDataURLOptions;
  14217. type ToPNGOptions = Electron.ToPNGOptions;
  14218. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  14219. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  14220. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  14221. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  14222. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  14223. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  14224. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  14225. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  14226. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  14227. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  14228. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  14229. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  14230. type UploadProgress = Electron.UploadProgress;
  14231. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  14232. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  14233. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  14234. type WillNavigateEvent = Electron.WillNavigateEvent;
  14235. type EditFlags = Electron.EditFlags;
  14236. type FoundInPageResult = Electron.FoundInPageResult;
  14237. type LaunchItems = Electron.LaunchItems;
  14238. type Margins = Electron.Margins;
  14239. type MediaFlags = Electron.MediaFlags;
  14240. type PageRanges = Electron.PageRanges;
  14241. type WebPreferences = Electron.WebPreferences;
  14242. type DefaultFontFamily = Electron.DefaultFontFamily;
  14243. type BluetoothDevice = Electron.BluetoothDevice;
  14244. type Certificate = Electron.Certificate;
  14245. type CertificatePrincipal = Electron.CertificatePrincipal;
  14246. type Cookie = Electron.Cookie;
  14247. type CPUUsage = Electron.CPUUsage;
  14248. type CrashReport = Electron.CrashReport;
  14249. type CustomScheme = Electron.CustomScheme;
  14250. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  14251. type Display = Electron.Display;
  14252. type Event = Electron.Event;
  14253. type Extension = Electron.Extension;
  14254. type ExtensionInfo = Electron.ExtensionInfo;
  14255. type FileFilter = Electron.FileFilter;
  14256. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  14257. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  14258. type InputEvent = Electron.InputEvent;
  14259. type IOCounters = Electron.IOCounters;
  14260. type IpcMainEvent = Electron.IpcMainEvent;
  14261. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  14262. type IpcRendererEvent = Electron.IpcRendererEvent;
  14263. type JumpListCategory = Electron.JumpListCategory;
  14264. type JumpListItem = Electron.JumpListItem;
  14265. type KeyboardEvent = Electron.KeyboardEvent;
  14266. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  14267. type MemoryInfo = Electron.MemoryInfo;
  14268. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  14269. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  14270. type MouseInputEvent = Electron.MouseInputEvent;
  14271. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  14272. type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
  14273. type NotificationAction = Electron.NotificationAction;
  14274. type Point = Electron.Point;
  14275. type PostBody = Electron.PostBody;
  14276. type PostData = Electron.PostData;
  14277. type PrinterInfo = Electron.PrinterInfo;
  14278. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  14279. type ProcessMetric = Electron.ProcessMetric;
  14280. type Product = Electron.Product;
  14281. type ProtocolRequest = Electron.ProtocolRequest;
  14282. type ProtocolResponse = Electron.ProtocolResponse;
  14283. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  14284. type Rectangle = Electron.Rectangle;
  14285. type Referrer = Electron.Referrer;
  14286. type ScrubberItem = Electron.ScrubberItem;
  14287. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  14288. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  14289. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  14290. type ShortcutDetails = Electron.ShortcutDetails;
  14291. type Size = Electron.Size;
  14292. type Task = Electron.Task;
  14293. type ThumbarButton = Electron.ThumbarButton;
  14294. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  14295. type TraceConfig = Electron.TraceConfig;
  14296. type Transaction = Electron.Transaction;
  14297. type UploadBlob = Electron.UploadBlob;
  14298. type UploadData = Electron.UploadData;
  14299. type UploadFile = Electron.UploadFile;
  14300. type UploadRawData = Electron.UploadRawData;
  14301. type WebSource = Electron.WebSource;
  14302. }
  14303. namespace Renderer {
  14304. class BrowserWindowProxy extends Electron.BrowserWindowProxy {}
  14305. const contextBridge: ContextBridge;
  14306. const ipcRenderer: IpcRenderer;
  14307. const remote: Remote;
  14308. const webFrame: WebFrame;
  14309. const webviewTag: WebviewTag;
  14310. type AboutPanelOptionsOptions = Electron.AboutPanelOptionsOptions;
  14311. type AddRepresentationOptions = Electron.AddRepresentationOptions;
  14312. type AnimationSettings = Electron.AnimationSettings;
  14313. type AppDetailsOptions = Electron.AppDetailsOptions;
  14314. type ApplicationInfoForProtocolReturnValue = Electron.ApplicationInfoForProtocolReturnValue;
  14315. type AuthenticationResponseDetails = Electron.AuthenticationResponseDetails;
  14316. type AuthInfo = Electron.AuthInfo;
  14317. type AutoResizeOptions = Electron.AutoResizeOptions;
  14318. type BeforeSendResponse = Electron.BeforeSendResponse;
  14319. type BitmapOptions = Electron.BitmapOptions;
  14320. type BlinkMemoryInfo = Electron.BlinkMemoryInfo;
  14321. type BrowserViewConstructorOptions = Electron.BrowserViewConstructorOptions;
  14322. type BrowserWindowConstructorOptions = Electron.BrowserWindowConstructorOptions;
  14323. type CertificateTrustDialogOptions = Electron.CertificateTrustDialogOptions;
  14324. type ClearStorageDataOptions = Electron.ClearStorageDataOptions;
  14325. type ClientRequestConstructorOptions = Electron.ClientRequestConstructorOptions;
  14326. type Config = Electron.Config;
  14327. type ConsoleMessageEvent = Electron.ConsoleMessageEvent;
  14328. type ContextMenuParams = Electron.ContextMenuParams;
  14329. type CookiesGetFilter = Electron.CookiesGetFilter;
  14330. type CookiesSetDetails = Electron.CookiesSetDetails;
  14331. type CrashReporterStartOptions = Electron.CrashReporterStartOptions;
  14332. type CreateFromBitmapOptions = Electron.CreateFromBitmapOptions;
  14333. type CreateFromBufferOptions = Electron.CreateFromBufferOptions;
  14334. type CreateInterruptedDownloadOptions = Electron.CreateInterruptedDownloadOptions;
  14335. type Data = Electron.Data;
  14336. type Details = Electron.Details;
  14337. type DidChangeThemeColorEvent = Electron.DidChangeThemeColorEvent;
  14338. type DidFailLoadEvent = Electron.DidFailLoadEvent;
  14339. type DidFrameFinishLoadEvent = Electron.DidFrameFinishLoadEvent;
  14340. type DidNavigateEvent = Electron.DidNavigateEvent;
  14341. type DidNavigateInPageEvent = Electron.DidNavigateInPageEvent;
  14342. type DisplayBalloonOptions = Electron.DisplayBalloonOptions;
  14343. type EnableNetworkEmulationOptions = Electron.EnableNetworkEmulationOptions;
  14344. type FeedURLOptions = Electron.FeedURLOptions;
  14345. type FileIconOptions = Electron.FileIconOptions;
  14346. type Filter = Electron.Filter;
  14347. type FindInPageOptions = Electron.FindInPageOptions;
  14348. type FocusOptions = Electron.FocusOptions;
  14349. type FoundInPageEvent = Electron.FoundInPageEvent;
  14350. type FromPartitionOptions = Electron.FromPartitionOptions;
  14351. type HeadersReceivedResponse = Electron.HeadersReceivedResponse;
  14352. type HeapStatistics = Electron.HeapStatistics;
  14353. type IgnoreMouseEventsOptions = Electron.IgnoreMouseEventsOptions;
  14354. type ImportCertificateOptions = Electron.ImportCertificateOptions;
  14355. type Info = Electron.Info;
  14356. type Input = Electron.Input;
  14357. type InsertCSSOptions = Electron.InsertCSSOptions;
  14358. type IpcMessageEvent = Electron.IpcMessageEvent;
  14359. type Item = Electron.Item;
  14360. type JumpListSettings = Electron.JumpListSettings;
  14361. type LoadCommitEvent = Electron.LoadCommitEvent;
  14362. type LoadFileOptions = Electron.LoadFileOptions;
  14363. type LoadURLOptions = Electron.LoadURLOptions;
  14364. type LoginItemSettings = Electron.LoginItemSettings;
  14365. type LoginItemSettingsOptions = Electron.LoginItemSettingsOptions;
  14366. type MenuItemConstructorOptions = Electron.MenuItemConstructorOptions;
  14367. type MessageBoxOptions = Electron.MessageBoxOptions;
  14368. type MessageBoxReturnValue = Electron.MessageBoxReturnValue;
  14369. type MessageBoxSyncOptions = Electron.MessageBoxSyncOptions;
  14370. type MessageDetails = Electron.MessageDetails;
  14371. type MessageEvent = Electron.MessageEvent;
  14372. type MoveToApplicationsFolderOptions = Electron.MoveToApplicationsFolderOptions;
  14373. type NewWindowEvent = Electron.NewWindowEvent;
  14374. type NotificationConstructorOptions = Electron.NotificationConstructorOptions;
  14375. type OnBeforeRedirectListenerDetails = Electron.OnBeforeRedirectListenerDetails;
  14376. type OnBeforeRequestListenerDetails = Electron.OnBeforeRequestListenerDetails;
  14377. type OnBeforeSendHeadersListenerDetails = Electron.OnBeforeSendHeadersListenerDetails;
  14378. type OnCompletedListenerDetails = Electron.OnCompletedListenerDetails;
  14379. type OnErrorOccurredListenerDetails = Electron.OnErrorOccurredListenerDetails;
  14380. type OnHeadersReceivedListenerDetails = Electron.OnHeadersReceivedListenerDetails;
  14381. type OnResponseStartedListenerDetails = Electron.OnResponseStartedListenerDetails;
  14382. type OnSendHeadersListenerDetails = Electron.OnSendHeadersListenerDetails;
  14383. type OpenDevToolsOptions = Electron.OpenDevToolsOptions;
  14384. type OpenDialogOptions = Electron.OpenDialogOptions;
  14385. type OpenDialogReturnValue = Electron.OpenDialogReturnValue;
  14386. type OpenDialogSyncOptions = Electron.OpenDialogSyncOptions;
  14387. type OpenExternalOptions = Electron.OpenExternalOptions;
  14388. type Options = Electron.Options;
  14389. type PageFaviconUpdatedEvent = Electron.PageFaviconUpdatedEvent;
  14390. type PageTitleUpdatedEvent = Electron.PageTitleUpdatedEvent;
  14391. type Parameters = Electron.Parameters;
  14392. type Payment = Electron.Payment;
  14393. type PermissionCheckHandlerHandlerDetails = Electron.PermissionCheckHandlerHandlerDetails;
  14394. type PermissionRequestHandlerHandlerDetails = Electron.PermissionRequestHandlerHandlerDetails;
  14395. type PluginCrashedEvent = Electron.PluginCrashedEvent;
  14396. type PopupOptions = Electron.PopupOptions;
  14397. type PreconnectOptions = Electron.PreconnectOptions;
  14398. type PrintToPDFOptions = Electron.PrintToPDFOptions;
  14399. type Privileges = Electron.Privileges;
  14400. type ProgressBarOptions = Electron.ProgressBarOptions;
  14401. type Provider = Electron.Provider;
  14402. type ReadBookmark = Electron.ReadBookmark;
  14403. type RelaunchOptions = Electron.RelaunchOptions;
  14404. type RenderProcessGoneDetails = Electron.RenderProcessGoneDetails;
  14405. type Request = Electron.Request;
  14406. type ResizeOptions = Electron.ResizeOptions;
  14407. type ResourceUsage = Electron.ResourceUsage;
  14408. type Response = Electron.Response;
  14409. type Result = Electron.Result;
  14410. type SaveDialogOptions = Electron.SaveDialogOptions;
  14411. type SaveDialogReturnValue = Electron.SaveDialogReturnValue;
  14412. type SaveDialogSyncOptions = Electron.SaveDialogSyncOptions;
  14413. type Settings = Electron.Settings;
  14414. type SourcesOptions = Electron.SourcesOptions;
  14415. type StartLoggingOptions = Electron.StartLoggingOptions;
  14416. type SystemMemoryInfo = Electron.SystemMemoryInfo;
  14417. type TitleOptions = Electron.TitleOptions;
  14418. type ToBitmapOptions = Electron.ToBitmapOptions;
  14419. type ToDataURLOptions = Electron.ToDataURLOptions;
  14420. type ToPNGOptions = Electron.ToPNGOptions;
  14421. type TouchBarButtonConstructorOptions = Electron.TouchBarButtonConstructorOptions;
  14422. type TouchBarColorPickerConstructorOptions = Electron.TouchBarColorPickerConstructorOptions;
  14423. type TouchBarConstructorOptions = Electron.TouchBarConstructorOptions;
  14424. type TouchBarGroupConstructorOptions = Electron.TouchBarGroupConstructorOptions;
  14425. type TouchBarLabelConstructorOptions = Electron.TouchBarLabelConstructorOptions;
  14426. type TouchBarPopoverConstructorOptions = Electron.TouchBarPopoverConstructorOptions;
  14427. type TouchBarScrubberConstructorOptions = Electron.TouchBarScrubberConstructorOptions;
  14428. type TouchBarSegmentedControlConstructorOptions = Electron.TouchBarSegmentedControlConstructorOptions;
  14429. type TouchBarSliderConstructorOptions = Electron.TouchBarSliderConstructorOptions;
  14430. type TouchBarSpacerConstructorOptions = Electron.TouchBarSpacerConstructorOptions;
  14431. type TraceBufferUsageReturnValue = Electron.TraceBufferUsageReturnValue;
  14432. type UpdateTargetUrlEvent = Electron.UpdateTargetUrlEvent;
  14433. type UploadProgress = Electron.UploadProgress;
  14434. type VisibleOnAllWorkspacesOptions = Electron.VisibleOnAllWorkspacesOptions;
  14435. type WebContentsPrintOptions = Electron.WebContentsPrintOptions;
  14436. type WebviewTagPrintOptions = Electron.WebviewTagPrintOptions;
  14437. type WillNavigateEvent = Electron.WillNavigateEvent;
  14438. type EditFlags = Electron.EditFlags;
  14439. type FoundInPageResult = Electron.FoundInPageResult;
  14440. type LaunchItems = Electron.LaunchItems;
  14441. type Margins = Electron.Margins;
  14442. type MediaFlags = Electron.MediaFlags;
  14443. type PageRanges = Electron.PageRanges;
  14444. type WebPreferences = Electron.WebPreferences;
  14445. type DefaultFontFamily = Electron.DefaultFontFamily;
  14446. type BluetoothDevice = Electron.BluetoothDevice;
  14447. type Certificate = Electron.Certificate;
  14448. type CertificatePrincipal = Electron.CertificatePrincipal;
  14449. type Cookie = Electron.Cookie;
  14450. type CPUUsage = Electron.CPUUsage;
  14451. type CrashReport = Electron.CrashReport;
  14452. type CustomScheme = Electron.CustomScheme;
  14453. type DesktopCapturerSource = Electron.DesktopCapturerSource;
  14454. type Display = Electron.Display;
  14455. type Event = Electron.Event;
  14456. type Extension = Electron.Extension;
  14457. type ExtensionInfo = Electron.ExtensionInfo;
  14458. type FileFilter = Electron.FileFilter;
  14459. type FilePathWithHeaders = Electron.FilePathWithHeaders;
  14460. type GPUFeatureStatus = Electron.GPUFeatureStatus;
  14461. type InputEvent = Electron.InputEvent;
  14462. type IOCounters = Electron.IOCounters;
  14463. type IpcMainEvent = Electron.IpcMainEvent;
  14464. type IpcMainInvokeEvent = Electron.IpcMainInvokeEvent;
  14465. type IpcRendererEvent = Electron.IpcRendererEvent;
  14466. type JumpListCategory = Electron.JumpListCategory;
  14467. type JumpListItem = Electron.JumpListItem;
  14468. type KeyboardEvent = Electron.KeyboardEvent;
  14469. type KeyboardInputEvent = Electron.KeyboardInputEvent;
  14470. type MemoryInfo = Electron.MemoryInfo;
  14471. type MemoryUsageDetails = Electron.MemoryUsageDetails;
  14472. type MimeTypedBuffer = Electron.MimeTypedBuffer;
  14473. type MouseInputEvent = Electron.MouseInputEvent;
  14474. type MouseWheelInputEvent = Electron.MouseWheelInputEvent;
  14475. type NewWindowWebContentsEvent = Electron.NewWindowWebContentsEvent;
  14476. type NotificationAction = Electron.NotificationAction;
  14477. type Point = Electron.Point;
  14478. type PostBody = Electron.PostBody;
  14479. type PostData = Electron.PostData;
  14480. type PrinterInfo = Electron.PrinterInfo;
  14481. type ProcessMemoryInfo = Electron.ProcessMemoryInfo;
  14482. type ProcessMetric = Electron.ProcessMetric;
  14483. type Product = Electron.Product;
  14484. type ProtocolRequest = Electron.ProtocolRequest;
  14485. type ProtocolResponse = Electron.ProtocolResponse;
  14486. type ProtocolResponseUploadData = Electron.ProtocolResponseUploadData;
  14487. type Rectangle = Electron.Rectangle;
  14488. type Referrer = Electron.Referrer;
  14489. type ScrubberItem = Electron.ScrubberItem;
  14490. type SegmentedControlSegment = Electron.SegmentedControlSegment;
  14491. type ServiceWorkerInfo = Electron.ServiceWorkerInfo;
  14492. type SharedWorkerInfo = Electron.SharedWorkerInfo;
  14493. type ShortcutDetails = Electron.ShortcutDetails;
  14494. type Size = Electron.Size;
  14495. type Task = Electron.Task;
  14496. type ThumbarButton = Electron.ThumbarButton;
  14497. type TraceCategoriesAndOptions = Electron.TraceCategoriesAndOptions;
  14498. type TraceConfig = Electron.TraceConfig;
  14499. type Transaction = Electron.Transaction;
  14500. type UploadBlob = Electron.UploadBlob;
  14501. type UploadData = Electron.UploadData;
  14502. type UploadFile = Electron.UploadFile;
  14503. type UploadRawData = Electron.UploadRawData;
  14504. type WebSource = Electron.WebSource;
  14505. }
  14506. const app: App;
  14507. const autoUpdater: AutoUpdater;
  14508. const clipboard: Clipboard;
  14509. const contentTracing: ContentTracing;
  14510. const contextBridge: ContextBridge;
  14511. const crashReporter: CrashReporter;
  14512. const desktopCapturer: DesktopCapturer;
  14513. const dialog: Dialog;
  14514. const globalShortcut: GlobalShortcut;
  14515. const inAppPurchase: InAppPurchase;
  14516. const ipcMain: IpcMain;
  14517. const ipcRenderer: IpcRenderer;
  14518. type nativeImage = NativeImage;
  14519. const nativeImage: typeof NativeImage;
  14520. const nativeTheme: NativeTheme;
  14521. const net: Net;
  14522. const netLog: NetLog;
  14523. const powerMonitor: PowerMonitor;
  14524. const powerSaveBlocker: PowerSaveBlocker;
  14525. const protocol: Protocol;
  14526. const remote: Remote;
  14527. const screen: Screen;
  14528. type session = Session;
  14529. const session: typeof Session;
  14530. const shell: Shell;
  14531. const systemPreferences: SystemPreferences;
  14532. type webContents = WebContents;
  14533. const webContents: typeof WebContents;
  14534. const webFrame: WebFrame;
  14535. const webviewTag: WebviewTag;
  14536. }
  14537. declare module 'electron' {
  14538. export = Electron;
  14539. }
  14540. declare module 'electron/main' {
  14541. export = Electron.Main
  14542. }
  14543. declare module 'electron/common' {
  14544. export = Electron.Common
  14545. }
  14546. declare module 'electron/renderer' {
  14547. export = Electron.Renderer
  14548. }
  14549. interface NodeRequireFunction {
  14550. (moduleName: 'electron'): typeof Electron;
  14551. }
  14552. interface File {
  14553. /**
  14554. * The real path to the file on the users filesystem
  14555. */
  14556. path: string;
  14557. }
  14558. declare module 'original-fs' {
  14559. import * as fs from 'fs';
  14560. export = fs;
  14561. }
  14562. interface Document {
  14563. createElement(tagName: 'webview'): Electron.WebviewTag;
  14564. }
  14565. declare namespace NodeJS {
  14566. interface Process extends NodeJS.EventEmitter {
  14567. // Docs: https://electronjs.org/docs/api/process
  14568. /**
  14569. * Emitted when Electron has loaded its internal initialization script and is
  14570. * beginning to load the web page or the main script.
  14571. *
  14572. * It can be used by the preload script to add removed Node global symbols back to
  14573. * the global scope when node integration is turned off:
  14574. */
  14575. on(event: 'loaded', listener: Function): this;
  14576. once(event: 'loaded', listener: Function): this;
  14577. addListener(event: 'loaded', listener: Function): this;
  14578. removeListener(event: 'loaded', listener: Function): this;
  14579. /**
  14580. * Causes the main thread of the current process crash.
  14581. */
  14582. crash(): void;
  14583. /**
  14584. * * `allocated` Integer - Size of all allocated objects in Kilobytes.
  14585. * * `marked` Integer - Size of all marked objects in Kilobytes.
  14586. * * `total` Integer - Total allocated space in Kilobytes.
  14587. *
  14588. * Returns an object with Blink memory information. It can be useful for debugging
  14589. * rendering / DOM related memory issues. Note that all values are reported in
  14590. * Kilobytes.
  14591. */
  14592. getBlinkMemoryInfo(): Electron.BlinkMemoryInfo;
  14593. getCPUUsage(): Electron.CPUUsage;
  14594. /**
  14595. * The number of milliseconds since epoch, or `null` if the information is
  14596. * unavailable
  14597. *
  14598. * Indicates the creation time of the application. The time is represented as
  14599. * number of milliseconds since epoch. It returns null if it is unable to get the
  14600. * process creation time.
  14601. */
  14602. getCreationTime(): (number) | (null);
  14603. /**
  14604. * * `totalHeapSize` Integer
  14605. * * `totalHeapSizeExecutable` Integer
  14606. * * `totalPhysicalSize` Integer
  14607. * * `totalAvailableSize` Integer
  14608. * * `usedHeapSize` Integer
  14609. * * `heapSizeLimit` Integer
  14610. * * `mallocedMemory` Integer
  14611. * * `peakMallocedMemory` Integer
  14612. * * `doesZapGarbage` Boolean
  14613. *
  14614. * Returns an object with V8 heap statistics. Note that all statistics are reported
  14615. * in Kilobytes.
  14616. */
  14617. getHeapStatistics(): Electron.HeapStatistics;
  14618. getIOCounters(): Electron.IOCounters;
  14619. /**
  14620. * Resolves with a ProcessMemoryInfo
  14621. *
  14622. * Returns an object giving memory usage statistics about the current process. Note
  14623. * that all statistics are reported in Kilobytes. This api should be called after
  14624. * app ready.
  14625. *
  14626. * Chromium does not provide `residentSet` value for macOS. This is because macOS
  14627. * performs in-memory compression of pages that haven't been recently used. As a
  14628. * result the resident set size value is not what one would expect. `private`
  14629. * memory is more representative of the actual pre-compression memory usage of the
  14630. * process on macOS.
  14631. */
  14632. getProcessMemoryInfo(): Promise<Electron.ProcessMemoryInfo>;
  14633. /**
  14634. * * `total` Integer - The total amount of physical memory in Kilobytes available
  14635. * to the system.
  14636. * * `free` Integer - The total amount of memory not being used by applications or
  14637. * disk cache.
  14638. * * `swapTotal` Integer _Windows_ _Linux_ - The total amount of swap memory in
  14639. * Kilobytes available to the system.
  14640. * * `swapFree` Integer _Windows_ _Linux_ - The free amount of swap memory in
  14641. * Kilobytes available to the system.
  14642. *
  14643. * Returns an object giving memory usage statistics about the entire system. Note
  14644. * that all statistics are reported in Kilobytes.
  14645. */
  14646. getSystemMemoryInfo(): Electron.SystemMemoryInfo;
  14647. /**
  14648. * The version of the host operating system.
  14649. *
  14650. * Example:
  14651. *
  14652. * **Note:** It returns the actual operating system version instead of kernel
  14653. * version on macOS unlike `os.release()`.
  14654. */
  14655. getSystemVersion(): string;
  14656. /**
  14657. * Causes the main thread of the current process hang.
  14658. */
  14659. hang(): void;
  14660. /**
  14661. * Sets the file descriptor soft limit to `maxDescriptors` or the OS hard limit,
  14662. * whichever is lower for the current process.
  14663. *
  14664. * @platform darwin,linux
  14665. */
  14666. setFdLimit(maxDescriptors: number): void;
  14667. /**
  14668. * Indicates whether the snapshot has been created successfully.
  14669. *
  14670. Takes a V8 heap snapshot and saves it to `filePath`.
  14671. */
  14672. takeHeapSnapshot(filePath: string): boolean;
  14673. /**
  14674. * A `String` representing Chrome's version string.
  14675. *
  14676. */
  14677. readonly chrome: string;
  14678. /**
  14679. * A `Boolean`. When app is started by being passed as parameter to the default
  14680. * app, this property is `true` in the main process, otherwise it is `undefined`.
  14681. *
  14682. */
  14683. readonly defaultApp: boolean;
  14684. /**
  14685. * A `String` representing Electron's version string.
  14686. *
  14687. */
  14688. readonly electron: string;
  14689. /**
  14690. * A `Boolean`, `true` when the current renderer context is the "main" renderer
  14691. * frame. If you want the ID of the current frame you should use
  14692. * `webFrame.routingId`.
  14693. *
  14694. */
  14695. readonly isMainFrame: boolean;
  14696. /**
  14697. * A `Boolean`. For Mac App Store build, this property is `true`, for other builds
  14698. * it is `undefined`.
  14699. *
  14700. */
  14701. readonly mas: boolean;
  14702. /**
  14703. * A `Boolean` that controls ASAR support inside your application. Setting this to
  14704. * `true` will disable the support for `asar` archives in Node's built-in modules.
  14705. */
  14706. noAsar: boolean;
  14707. /**
  14708. * A `Boolean` that controls whether or not deprecation warnings are printed to
  14709. * `stderr`. Setting this to `true` will silence deprecation warnings. This
  14710. * property is used instead of the `--no-deprecation` command line flag.
  14711. */
  14712. noDeprecation: boolean;
  14713. /**
  14714. * A `String` representing the path to the resources directory.
  14715. *
  14716. */
  14717. readonly resourcesPath: string;
  14718. /**
  14719. * A `Boolean`. When the renderer process is sandboxed, this property is `true`,
  14720. * otherwise it is `undefined`.
  14721. *
  14722. */
  14723. readonly sandboxed: boolean;
  14724. /**
  14725. * A `Boolean` that controls whether or not deprecation warnings will be thrown as
  14726. * exceptions. Setting this to `true` will throw errors for deprecations. This
  14727. * property is used instead of the `--throw-deprecation` command line flag.
  14728. */
  14729. throwDeprecation: boolean;
  14730. /**
  14731. * A `Boolean` that controls whether or not deprecations printed to `stderr`
  14732. * include their stack trace. Setting this to `true` will print stack traces for
  14733. * deprecations. This property is instead of the `--trace-deprecation` command line
  14734. * flag.
  14735. */
  14736. traceDeprecation: boolean;
  14737. /**
  14738. * A `Boolean` that controls whether or not process warnings printed to `stderr`
  14739. * include their stack trace. Setting this to `true` will print stack traces for
  14740. * process warnings (including deprecations). This property is instead of the
  14741. * `--trace-warnings` command line flag.
  14742. */
  14743. traceProcessWarnings: boolean;
  14744. /**
  14745. * A `String` representing the current process's type, can be:
  14746. *
  14747. * * `browser` - The main process
  14748. * * `renderer` - A renderer process
  14749. * `worker` - In a web worker
  14750. *
  14751. */
  14752. readonly type: ('browser' | 'renderer' | 'worker');
  14753. /**
  14754. * A `Boolean`. If the app is running as a Windows Store app (appx), this property
  14755. * is `true`, for otherwise it is `undefined`.
  14756. *
  14757. */
  14758. readonly windowsStore: boolean;
  14759. }
  14760. interface ProcessVersions {
  14761. readonly electron: string;
  14762. readonly chrome: string;
  14763. }
  14764. }