misc.d.ts 254 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364
  1. // tslint:disable:jsdoc-format
  2. // tslint:disable:no-irregular-whitespace
  3. declare namespace JQuery {
  4. type TypeOrArray<T> = T | T[];
  5. type Node = Element | Text | Comment | Document | DocumentFragment;
  6. /**
  7. * A string is designated htmlString in jQuery documentation when it is used to represent one or more DOM elements, typically to be created and inserted in the document. When passed as an argument of the jQuery() function, the string is identified as HTML if it starts with <tag ... >) and is parsed as such until the final > character. Prior to jQuery 1.9, a string was considered to be HTML if it contained <tag ... > anywhere within the string.
  8. */
  9. type htmlString = string;
  10. /**
  11. * A selector is used in jQuery to select DOM elements from a DOM document. That document is, in most cases, the DOM document present in all browsers, but can also be an XML document received via Ajax.
  12. */
  13. type Selector = string;
  14. /**
  15. * The PlainObject type is a JavaScript object containing zero or more key-value pairs. The plain object is, in other words, an Object object. It is designated "plain" in jQuery documentation to distinguish it from other kinds of JavaScript objects: for example, null, user-defined arrays, and host objects such as document, all of which have a typeof value of "object."
  16. *
  17. * **Note**: The type declaration of PlainObject is imprecise. It includes host objects and user-defined arrays which do not match jQuery's definition.
  18. */
  19. interface PlainObject<T = any> {
  20. [key: string]: T;
  21. }
  22. interface Selectors extends Sizzle.Selectors {
  23. /**
  24. * @deprecated ​ Deprecated since 3.0. Use \`{@link Selectors#pseudos }\`.
  25. *
  26. * **Cause**: The standard way to add new custom selectors through jQuery is `jQuery.expr.pseudos`. These two other aliases are deprecated, although they still work as of jQuery 3.0.
  27. *
  28. * **Solution**: Rename any of the older usage to `jQuery.expr.pseudos`. The functionality is identical.
  29. */
  30. ":": Sizzle.Selectors.PseudoFunctions;
  31. /**
  32. * @deprecated ​ Deprecated since 3.0. Use \`{@link Selectors#pseudos }\`.
  33. *
  34. * **Cause**: The standard way to add new custom selectors through jQuery is `jQuery.expr.pseudos`. These two other aliases are deprecated, although they still work as of jQuery 3.0.
  35. *
  36. * **Solution**: Rename any of the older usage to `jQuery.expr.pseudos`. The functionality is identical.
  37. */
  38. filter: Sizzle.Selectors.FilterFunctions;
  39. }
  40. // region Ajax
  41. // #region Ajax
  42. interface AjaxSettings<TContext = any> extends Ajax.AjaxSettingsBase<TContext> {
  43. /**
  44. * A string containing the URL to which the request is sent.
  45. */
  46. url?: string | undefined;
  47. }
  48. interface UrlAjaxSettings<TContext = any> extends Ajax.AjaxSettingsBase<TContext> {
  49. /**
  50. * A string containing the URL to which the request is sent.
  51. */
  52. url: string;
  53. }
  54. namespace Ajax {
  55. type SuccessTextStatus = "success" | "notmodified" | "nocontent";
  56. type ErrorTextStatus = "timeout" | "error" | "abort" | "parsererror";
  57. type TextStatus = SuccessTextStatus | ErrorTextStatus;
  58. type SuccessCallback<TContext> = (
  59. this: TContext,
  60. data: any,
  61. textStatus: SuccessTextStatus,
  62. jqXHR: jqXHR,
  63. ) => void;
  64. type ErrorCallback<TContext> = (
  65. this: TContext,
  66. jqXHR: jqXHR,
  67. textStatus: ErrorTextStatus,
  68. errorThrown: string,
  69. ) => void;
  70. type CompleteCallback<TContext> = (this: TContext, jqXHR: jqXHR, textStatus: TextStatus) => void;
  71. /**
  72. * @see \`{@link https://api.jquery.com/jquery.ajax/#jQuery-ajax-settings }\`
  73. */
  74. interface AjaxSettingsBase<TContext> {
  75. /**
  76. * A set of key/value pairs that map a given dataType to its MIME type, which gets sent in the Accept request header. This header tells the server what kind of response it will accept in return.
  77. */
  78. accepts?: PlainObject<string> | undefined;
  79. /**
  80. * By default, all requests are sent asynchronously (i.e. this is set to true by default). If you need synchronous requests, set this option to false. Cross-domain requests and dataType: "jsonp" requests do not support synchronous operation. Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active. As of jQuery 1.8, the use of async: false with jqXHR ($.Deferred) is deprecated; you must use the success/error/complete callback options instead of the corresponding methods of the jqXHR object such as jqXHR.done().
  81. */
  82. async?: boolean | undefined;
  83. /**
  84. * A pre-request callback function that can be used to modify the jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object before it is sent. Use this to set custom headers, etc. The jqXHR and settings objects are passed as arguments. This is an Ajax Event. Returning false in the beforeSend function will cancel the request. As of jQuery 1.5, the beforeSend option will be called regardless of the type of request.
  85. */
  86. // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
  87. beforeSend?(this: TContext, jqXHR: jqXHR, settings: this): false | void;
  88. /**
  89. * If set to false, it will force requested pages not to be cached by the browser. Note: Setting cache to false will only work correctly with HEAD and GET requests. It works by appending "_={timestamp}" to the GET parameters. The parameter is not needed for other types of requests, except in IE8 when a POST is made to a URL that has already been requested by a GET.
  90. */
  91. cache?: boolean | undefined;
  92. /**
  93. * A function to be called when the request finishes (after success and error callbacks are executed). The function gets passed two arguments: The jqXHR (in jQuery 1.4.x, XMLHTTPRequest) object and a string categorizing the status of the request ("success", "notmodified", "nocontent", "error", "timeout", "abort", or "parsererror"). As of jQuery 1.5, the complete setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event.
  94. */
  95. complete?: TypeOrArray<CompleteCallback<TContext>> | undefined;
  96. /**
  97. * An object of string/regular-expression pairs that determine how jQuery will parse the response, given its content type.
  98. */
  99. contents?: PlainObject<RegExp> | undefined;
  100. /**
  101. * When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; charset=UTF-8", which is fine for most cases. If you explicitly pass in a content-type to $.ajax(), then it is always sent to the server (even if no data is sent). As of jQuery 1.6 you can pass false to tell jQuery to not set any content type header. Note: The W3C XMLHttpRequest specification dictates that the charset is always UTF-8; specifying another charset will not force the browser to change the encoding. Note: For cross-domain requests, setting the content type to anything other than application/x-www-form-urlencoded, multipart/form-data, or text/plain will trigger the browser to send a preflight OPTIONS request to the server.
  102. */
  103. contentType?: string | false | undefined;
  104. /**
  105. * This object will be the context of all Ajax-related callbacks. By default, the context is an object that represents the Ajax settings used in the call ($.ajaxSettings merged with the settings passed to $.ajax).
  106. */
  107. context?: TContext | undefined;
  108. /**
  109. * An object containing dataType-to-dataType converters. Each converter's value is a function that returns the transformed value of the response.
  110. */
  111. converters?: PlainObject<((value: any) => any) | true> | undefined;
  112. /**
  113. * If you wish to force a crossDomain request (such as JSONP) on the same domain, set the value of crossDomain to true. This allows, for example, server-side redirection to another domain.
  114. */
  115. crossDomain?: boolean | undefined;
  116. /**
  117. * Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below).
  118. */
  119. data?: PlainObject | string | undefined;
  120. /**
  121. * A function to be used to handle the raw response data of XMLHttpRequest. This is a pre-filtering function to sanitize the response. You should return the sanitized data. The function accepts two arguments: The raw data returned from the server and the 'dataType' parameter.
  122. */
  123. dataFilter?(data: string, type: string): any;
  124. /**
  125. * The type of data that you're expecting back from the server. If none is specified, jQuery will try to infer it based on the MIME type of the response (an XML MIME type will yield XML, in 1.4 JSON will yield a JavaScript object, in 1.4 script will execute the script, and anything else will be returned as a string). The available types (and the result passed as the first argument to your success callback) are:
  126. *
  127. * "xml": Returns a XML document that can be processed via jQuery.
  128. *
  129. * "html": Returns HTML as plain text; included script tags are evaluated when inserted in the DOM.
  130. *
  131. * "script": Evaluates the response as JavaScript and returns it as plain text. Disables caching by appending a query string parameter, _=[TIMESTAMP], to the URL unless the cache option is set to true. Note: This will turn POSTs into GETs for remote-domain requests.
  132. *
  133. * "json": Evaluates the response as JSON and returns a JavaScript object. Cross-domain "json" requests are converted to "jsonp" unless the request includes jsonp: false in its request options. The JSON data is parsed in a strict manner; any malformed JSON is rejected and a parse error is thrown. As of jQuery 1.9, an empty response is also rejected; the server should return a response of null or {} instead. (See json.org for more information on proper JSON formatting.)
  134. *
  135. * "jsonp": Loads in a JSON block using JSONP. Adds an extra "?callback=?" to the end of your URL to specify the callback. Disables caching by appending a query string parameter, "_=[TIMESTAMP]", to the URL unless the cache option is set to true.
  136. *
  137. * "text": A plain text string.
  138. *
  139. * multiple, space-separated values: As of jQuery 1.5, jQuery can convert a dataType from what it received in the Content-Type header to what you require. For example, if you want a text response to be treated as XML, use "text xml" for the dataType. You can also make a JSONP request, have it received as text, and interpreted by jQuery as XML: "jsonp text xml". Similarly, a shorthand string such as "jsonp xml" will first attempt to convert from jsonp to xml, and, failing that, convert from jsonp to text, and then from text to xml.
  140. */
  141. dataType?: "xml" | "html" | "script" | "json" | "jsonp" | "text" | string | undefined;
  142. /**
  143. * The MIME type of content that is used to submit the form to the server. Possible values are:
  144. *
  145. * "application/x-www-form-urlencoded": The initial default type.
  146. *
  147. * "multipart/form-data": The type that allows file <input> element(s) to upload file data.
  148. *
  149. * "text/plain": A type introduced in HTML5.
  150. */
  151. enctype?: "application/x-www-form-urlencoded" | "multipart/form-data" | "text/plain" | undefined;
  152. /**
  153. * A function to be called if the request fails. The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred. Possible values for the second argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." As of jQuery 1.5, the error setting can accept an array of functions. Each function will be called in turn. Note: This handler is not called for cross-domain script and cross-domain JSONP requests. This is an Ajax Event.
  154. */
  155. error?: TypeOrArray<ErrorCallback<TContext>> | undefined;
  156. /**
  157. * Whether to trigger global Ajax event handlers for this request. The default is true. Set to false to prevent the global handlers like ajaxStart or ajaxStop from being triggered. This can be used to control various Ajax Events.
  158. */
  159. global?: boolean | undefined;
  160. /**
  161. * An object of additional header key/value pairs to send along with requests using the XMLHttpRequest transport. The header X-Requested-With: XMLHttpRequest is always added, but its default XMLHttpRequest value can be changed here. Values in the headers setting can also be overwritten from within the beforeSend function.
  162. */
  163. headers?: PlainObject<string | null | undefined> | undefined;
  164. /**
  165. * Allow the request to be successful only if the response has changed since the last request. This is done by checking the Last-Modified header. Default value is false, ignoring the header. In jQuery 1.4 this technique also checks the 'etag' specified by the server to catch unmodified data.
  166. */
  167. ifModified?: boolean | undefined;
  168. /**
  169. * Allow the current environment to be recognized as "local," (e.g. the filesystem), even if jQuery does not recognize it as such by default. The following protocols are currently recognized as local: file, *-extension, and widget. If the isLocal setting needs modification, it is recommended to do so once in the $.ajaxSetup() method.
  170. */
  171. isLocal?: boolean | undefined;
  172. /**
  173. * Override the callback function name in a JSONP request. This value will be used instead of 'callback' in the 'callback=?' part of the query string in the url. So {jsonp:'onJSONPLoad'} would result in 'onJSONPLoad=?' passed to the server. As of jQuery 1.5, setting the jsonp option to false prevents jQuery from adding the "?callback" string to the URL or attempting to use "=?" for transformation. In this case, you should also explicitly set the jsonpCallback setting. For example, { jsonp: false, jsonpCallback: "callbackName" }. If you don't trust the target of your Ajax requests, consider setting the jsonp property to false for security reasons.
  174. */
  175. jsonp?: string | false | undefined;
  176. /**
  177. * Specify the callback function name for a JSONP request. This value will be used instead of the random name automatically generated by jQuery. It is preferable to let jQuery generate a unique name as it'll make it easier to manage the requests and provide callbacks and error handling. You may want to specify the callback when you want to enable better browser caching of GET requests. As of jQuery 1.5, you can also use a function for this setting, in which case the value of jsonpCallback is set to the return value of that function.
  178. */
  179. jsonpCallback?: string | ((this: TContext) => string) | undefined;
  180. /**
  181. * The HTTP method to use for the request (e.g. "POST", "GET", "PUT").
  182. */
  183. method?: string | undefined;
  184. /**
  185. * A mime type to override the XHR mime type.
  186. */
  187. mimeType?: string | undefined;
  188. /**
  189. * A password to be used with XMLHttpRequest in response to an HTTP access authentication request.
  190. */
  191. password?: string | undefined;
  192. /**
  193. * By default, data passed in to the data option as an object (technically, anything other than a string) will be processed and transformed into a query string, fitting to the default content-type "application/x-www-form-urlencoded". If you want to send a DOMDocument, or other non-processed data, set this option to false.
  194. */
  195. processData?: boolean | undefined;
  196. /**
  197. * Only applies when the "script" transport is used (e.g., cross-domain requests with "jsonp" or "script" dataType and "GET" type). Sets the charset attribute on the script tag used in the request. Used when the character set on the local page is not the same as the one on the remote script.
  198. */
  199. scriptCharset?: string | undefined;
  200. /**
  201. * An object of numeric HTTP codes and functions to be called when the response has the corresponding code.
  202. *
  203. * If the request is successful, the status code functions take the same parameters as the success callback; if it results in an error (including 3xx redirect), they take the same parameters as the error callback.
  204. */
  205. statusCode?: StatusCodeCallbacks<TContext> | undefined;
  206. /**
  207. * A function to be called if the request succeeds. The function gets passed three arguments: The data returned from the server, formatted according to the dataType parameter or the dataFilter callback function, if specified; a string describing the status; and the jqXHR (in jQuery 1.4.x, XMLHttpRequest) object. As of jQuery 1.5, the success setting can accept an array of functions. Each function will be called in turn. This is an Ajax Event.
  208. */
  209. success?: TypeOrArray<SuccessCallback<TContext>> | undefined;
  210. /**
  211. * Set a timeout (in milliseconds) for the request. A value of 0 means there will be no timeout. This will override any global timeout set with $.ajaxSetup(). The timeout period starts at the point the $.ajax call is made; if several other requests are in progress and the browser has no connections available, it is possible for a request to time out before it can be sent. In jQuery 1.4.x and below, the XMLHttpRequest object will be in an invalid state if the request times out; accessing any object members may throw an exception. In Firefox 3.0+ only, script and JSONP requests cannot be cancelled by a timeout; the script will run even if it arrives after the timeout period.
  212. */
  213. timeout?: number | undefined;
  214. /**
  215. * Set this to true if you wish to use the traditional style of param serialization.
  216. */
  217. traditional?: boolean | undefined;
  218. /**
  219. * An alias for method. You should use type if you're using versions of jQuery prior to 1.9.0.
  220. */
  221. type?: string | undefined;
  222. /**
  223. * A username to be used with XMLHttpRequest in response to an HTTP access authentication request.
  224. */
  225. username?: string | undefined;
  226. // ActiveXObject requires "lib": ["scripthost"] which consumers would also require
  227. /**
  228. * Callback for creating the XMLHttpRequest object. Defaults to the ActiveXObject when available (IE), the XMLHttpRequest otherwise. Override to provide your own implementation for XMLHttpRequest or enhancements to the factory.
  229. */
  230. xhr?(): XMLHttpRequest;
  231. /**
  232. * An object of fieldName-fieldValue pairs to set on the native XHR object.
  233. *
  234. * In jQuery 1.5, the withCredentials property was not propagated to the native XHR and thus CORS requests requiring it would ignore this flag. For this reason, we recommend using jQuery 1.5.1+ should you require the use of it.
  235. */
  236. xhrFields?: XHRFields | undefined;
  237. }
  238. // region StatusCodeCallbacks
  239. // #region StatusCodeCallbacks
  240. type StatusCodeCallbacks<TContext> = {
  241. // region Success Status Codes
  242. // #region Success Status Codes
  243. // jQuery treats 2xx and 304 status codes as a success
  244. 200?: SuccessCallback<TContext> | undefined;
  245. 201?: SuccessCallback<TContext> | undefined;
  246. 202?: SuccessCallback<TContext> | undefined;
  247. 203?: SuccessCallback<TContext> | undefined;
  248. 204?: SuccessCallback<TContext> | undefined;
  249. 205?: SuccessCallback<TContext> | undefined;
  250. 206?: SuccessCallback<TContext> | undefined;
  251. 207?: SuccessCallback<TContext> | undefined;
  252. 208?: SuccessCallback<TContext> | undefined;
  253. 209?: SuccessCallback<TContext> | undefined;
  254. 210?: SuccessCallback<TContext> | undefined;
  255. 211?: SuccessCallback<TContext> | undefined;
  256. 212?: SuccessCallback<TContext> | undefined;
  257. 213?: SuccessCallback<TContext> | undefined;
  258. 214?: SuccessCallback<TContext> | undefined;
  259. 215?: SuccessCallback<TContext> | undefined;
  260. 216?: SuccessCallback<TContext> | undefined;
  261. 217?: SuccessCallback<TContext> | undefined;
  262. 218?: SuccessCallback<TContext> | undefined;
  263. 219?: SuccessCallback<TContext> | undefined;
  264. 220?: SuccessCallback<TContext> | undefined;
  265. 221?: SuccessCallback<TContext> | undefined;
  266. 222?: SuccessCallback<TContext> | undefined;
  267. 223?: SuccessCallback<TContext> | undefined;
  268. 224?: SuccessCallback<TContext> | undefined;
  269. 225?: SuccessCallback<TContext> | undefined;
  270. 226?: SuccessCallback<TContext> | undefined;
  271. 227?: SuccessCallback<TContext> | undefined;
  272. 228?: SuccessCallback<TContext> | undefined;
  273. 229?: SuccessCallback<TContext> | undefined;
  274. 230?: SuccessCallback<TContext> | undefined;
  275. 231?: SuccessCallback<TContext> | undefined;
  276. 232?: SuccessCallback<TContext> | undefined;
  277. 233?: SuccessCallback<TContext> | undefined;
  278. 234?: SuccessCallback<TContext> | undefined;
  279. 235?: SuccessCallback<TContext> | undefined;
  280. 236?: SuccessCallback<TContext> | undefined;
  281. 237?: SuccessCallback<TContext> | undefined;
  282. 238?: SuccessCallback<TContext> | undefined;
  283. 239?: SuccessCallback<TContext> | undefined;
  284. 240?: SuccessCallback<TContext> | undefined;
  285. 241?: SuccessCallback<TContext> | undefined;
  286. 242?: SuccessCallback<TContext> | undefined;
  287. 243?: SuccessCallback<TContext> | undefined;
  288. 244?: SuccessCallback<TContext> | undefined;
  289. 245?: SuccessCallback<TContext> | undefined;
  290. 246?: SuccessCallback<TContext> | undefined;
  291. 247?: SuccessCallback<TContext> | undefined;
  292. 248?: SuccessCallback<TContext> | undefined;
  293. 249?: SuccessCallback<TContext> | undefined;
  294. 250?: SuccessCallback<TContext> | undefined;
  295. 251?: SuccessCallback<TContext> | undefined;
  296. 252?: SuccessCallback<TContext> | undefined;
  297. 253?: SuccessCallback<TContext> | undefined;
  298. 254?: SuccessCallback<TContext> | undefined;
  299. 255?: SuccessCallback<TContext> | undefined;
  300. 256?: SuccessCallback<TContext> | undefined;
  301. 257?: SuccessCallback<TContext> | undefined;
  302. 258?: SuccessCallback<TContext> | undefined;
  303. 259?: SuccessCallback<TContext> | undefined;
  304. 260?: SuccessCallback<TContext> | undefined;
  305. 261?: SuccessCallback<TContext> | undefined;
  306. 262?: SuccessCallback<TContext> | undefined;
  307. 263?: SuccessCallback<TContext> | undefined;
  308. 264?: SuccessCallback<TContext> | undefined;
  309. 265?: SuccessCallback<TContext> | undefined;
  310. 266?: SuccessCallback<TContext> | undefined;
  311. 267?: SuccessCallback<TContext> | undefined;
  312. 268?: SuccessCallback<TContext> | undefined;
  313. 269?: SuccessCallback<TContext> | undefined;
  314. 270?: SuccessCallback<TContext> | undefined;
  315. 271?: SuccessCallback<TContext> | undefined;
  316. 272?: SuccessCallback<TContext> | undefined;
  317. 273?: SuccessCallback<TContext> | undefined;
  318. 274?: SuccessCallback<TContext> | undefined;
  319. 275?: SuccessCallback<TContext> | undefined;
  320. 276?: SuccessCallback<TContext> | undefined;
  321. 277?: SuccessCallback<TContext> | undefined;
  322. 278?: SuccessCallback<TContext> | undefined;
  323. 279?: SuccessCallback<TContext> | undefined;
  324. 280?: SuccessCallback<TContext> | undefined;
  325. 281?: SuccessCallback<TContext> | undefined;
  326. 282?: SuccessCallback<TContext> | undefined;
  327. 283?: SuccessCallback<TContext> | undefined;
  328. 284?: SuccessCallback<TContext> | undefined;
  329. 285?: SuccessCallback<TContext> | undefined;
  330. 286?: SuccessCallback<TContext> | undefined;
  331. 287?: SuccessCallback<TContext> | undefined;
  332. 288?: SuccessCallback<TContext> | undefined;
  333. 289?: SuccessCallback<TContext> | undefined;
  334. 290?: SuccessCallback<TContext> | undefined;
  335. 291?: SuccessCallback<TContext> | undefined;
  336. 292?: SuccessCallback<TContext> | undefined;
  337. 293?: SuccessCallback<TContext> | undefined;
  338. 294?: SuccessCallback<TContext> | undefined;
  339. 295?: SuccessCallback<TContext> | undefined;
  340. 296?: SuccessCallback<TContext> | undefined;
  341. 297?: SuccessCallback<TContext> | undefined;
  342. 298?: SuccessCallback<TContext> | undefined;
  343. 299?: SuccessCallback<TContext> | undefined;
  344. 304?: SuccessCallback<TContext> | undefined;
  345. // #endregion
  346. // region Error Status Codes
  347. // #region Error Status Codes
  348. 300?: ErrorCallback<TContext> | undefined;
  349. 301?: ErrorCallback<TContext> | undefined;
  350. 302?: ErrorCallback<TContext> | undefined;
  351. 303?: ErrorCallback<TContext> | undefined;
  352. 305?: ErrorCallback<TContext> | undefined;
  353. 306?: ErrorCallback<TContext> | undefined;
  354. 307?: ErrorCallback<TContext> | undefined;
  355. 308?: ErrorCallback<TContext> | undefined;
  356. 309?: ErrorCallback<TContext> | undefined;
  357. 310?: ErrorCallback<TContext> | undefined;
  358. 311?: ErrorCallback<TContext> | undefined;
  359. 312?: ErrorCallback<TContext> | undefined;
  360. 313?: ErrorCallback<TContext> | undefined;
  361. 314?: ErrorCallback<TContext> | undefined;
  362. 315?: ErrorCallback<TContext> | undefined;
  363. 316?: ErrorCallback<TContext> | undefined;
  364. 317?: ErrorCallback<TContext> | undefined;
  365. 318?: ErrorCallback<TContext> | undefined;
  366. 319?: ErrorCallback<TContext> | undefined;
  367. 320?: ErrorCallback<TContext> | undefined;
  368. 321?: ErrorCallback<TContext> | undefined;
  369. 322?: ErrorCallback<TContext> | undefined;
  370. 323?: ErrorCallback<TContext> | undefined;
  371. 324?: ErrorCallback<TContext> | undefined;
  372. 325?: ErrorCallback<TContext> | undefined;
  373. 326?: ErrorCallback<TContext> | undefined;
  374. 327?: ErrorCallback<TContext> | undefined;
  375. 328?: ErrorCallback<TContext> | undefined;
  376. 329?: ErrorCallback<TContext> | undefined;
  377. 330?: ErrorCallback<TContext> | undefined;
  378. 331?: ErrorCallback<TContext> | undefined;
  379. 332?: ErrorCallback<TContext> | undefined;
  380. 333?: ErrorCallback<TContext> | undefined;
  381. 334?: ErrorCallback<TContext> | undefined;
  382. 335?: ErrorCallback<TContext> | undefined;
  383. 336?: ErrorCallback<TContext> | undefined;
  384. 337?: ErrorCallback<TContext> | undefined;
  385. 338?: ErrorCallback<TContext> | undefined;
  386. 339?: ErrorCallback<TContext> | undefined;
  387. 340?: ErrorCallback<TContext> | undefined;
  388. 341?: ErrorCallback<TContext> | undefined;
  389. 342?: ErrorCallback<TContext> | undefined;
  390. 343?: ErrorCallback<TContext> | undefined;
  391. 344?: ErrorCallback<TContext> | undefined;
  392. 345?: ErrorCallback<TContext> | undefined;
  393. 346?: ErrorCallback<TContext> | undefined;
  394. 347?: ErrorCallback<TContext> | undefined;
  395. 348?: ErrorCallback<TContext> | undefined;
  396. 349?: ErrorCallback<TContext> | undefined;
  397. 350?: ErrorCallback<TContext> | undefined;
  398. 351?: ErrorCallback<TContext> | undefined;
  399. 352?: ErrorCallback<TContext> | undefined;
  400. 353?: ErrorCallback<TContext> | undefined;
  401. 354?: ErrorCallback<TContext> | undefined;
  402. 355?: ErrorCallback<TContext> | undefined;
  403. 356?: ErrorCallback<TContext> | undefined;
  404. 357?: ErrorCallback<TContext> | undefined;
  405. 358?: ErrorCallback<TContext> | undefined;
  406. 359?: ErrorCallback<TContext> | undefined;
  407. 360?: ErrorCallback<TContext> | undefined;
  408. 361?: ErrorCallback<TContext> | undefined;
  409. 362?: ErrorCallback<TContext> | undefined;
  410. 363?: ErrorCallback<TContext> | undefined;
  411. 364?: ErrorCallback<TContext> | undefined;
  412. 365?: ErrorCallback<TContext> | undefined;
  413. 366?: ErrorCallback<TContext> | undefined;
  414. 367?: ErrorCallback<TContext> | undefined;
  415. 368?: ErrorCallback<TContext> | undefined;
  416. 369?: ErrorCallback<TContext> | undefined;
  417. 370?: ErrorCallback<TContext> | undefined;
  418. 371?: ErrorCallback<TContext> | undefined;
  419. 372?: ErrorCallback<TContext> | undefined;
  420. 373?: ErrorCallback<TContext> | undefined;
  421. 374?: ErrorCallback<TContext> | undefined;
  422. 375?: ErrorCallback<TContext> | undefined;
  423. 376?: ErrorCallback<TContext> | undefined;
  424. 377?: ErrorCallback<TContext> | undefined;
  425. 378?: ErrorCallback<TContext> | undefined;
  426. 379?: ErrorCallback<TContext> | undefined;
  427. 380?: ErrorCallback<TContext> | undefined;
  428. 381?: ErrorCallback<TContext> | undefined;
  429. 382?: ErrorCallback<TContext> | undefined;
  430. 383?: ErrorCallback<TContext> | undefined;
  431. 384?: ErrorCallback<TContext> | undefined;
  432. 385?: ErrorCallback<TContext> | undefined;
  433. 386?: ErrorCallback<TContext> | undefined;
  434. 387?: ErrorCallback<TContext> | undefined;
  435. 388?: ErrorCallback<TContext> | undefined;
  436. 389?: ErrorCallback<TContext> | undefined;
  437. 390?: ErrorCallback<TContext> | undefined;
  438. 391?: ErrorCallback<TContext> | undefined;
  439. 392?: ErrorCallback<TContext> | undefined;
  440. 393?: ErrorCallback<TContext> | undefined;
  441. 394?: ErrorCallback<TContext> | undefined;
  442. 395?: ErrorCallback<TContext> | undefined;
  443. 396?: ErrorCallback<TContext> | undefined;
  444. 397?: ErrorCallback<TContext> | undefined;
  445. 398?: ErrorCallback<TContext> | undefined;
  446. 399?: ErrorCallback<TContext> | undefined;
  447. 400?: ErrorCallback<TContext> | undefined;
  448. 401?: ErrorCallback<TContext> | undefined;
  449. 402?: ErrorCallback<TContext> | undefined;
  450. 403?: ErrorCallback<TContext> | undefined;
  451. 404?: ErrorCallback<TContext> | undefined;
  452. 405?: ErrorCallback<TContext> | undefined;
  453. 406?: ErrorCallback<TContext> | undefined;
  454. 407?: ErrorCallback<TContext> | undefined;
  455. 408?: ErrorCallback<TContext> | undefined;
  456. 409?: ErrorCallback<TContext> | undefined;
  457. 410?: ErrorCallback<TContext> | undefined;
  458. 411?: ErrorCallback<TContext> | undefined;
  459. 412?: ErrorCallback<TContext> | undefined;
  460. 413?: ErrorCallback<TContext> | undefined;
  461. 414?: ErrorCallback<TContext> | undefined;
  462. 415?: ErrorCallback<TContext> | undefined;
  463. 416?: ErrorCallback<TContext> | undefined;
  464. 417?: ErrorCallback<TContext> | undefined;
  465. 418?: ErrorCallback<TContext> | undefined;
  466. 419?: ErrorCallback<TContext> | undefined;
  467. 420?: ErrorCallback<TContext> | undefined;
  468. 421?: ErrorCallback<TContext> | undefined;
  469. 422?: ErrorCallback<TContext> | undefined;
  470. 423?: ErrorCallback<TContext> | undefined;
  471. 424?: ErrorCallback<TContext> | undefined;
  472. 425?: ErrorCallback<TContext> | undefined;
  473. 426?: ErrorCallback<TContext> | undefined;
  474. 427?: ErrorCallback<TContext> | undefined;
  475. 428?: ErrorCallback<TContext> | undefined;
  476. 429?: ErrorCallback<TContext> | undefined;
  477. 430?: ErrorCallback<TContext> | undefined;
  478. 431?: ErrorCallback<TContext> | undefined;
  479. 432?: ErrorCallback<TContext> | undefined;
  480. 433?: ErrorCallback<TContext> | undefined;
  481. 434?: ErrorCallback<TContext> | undefined;
  482. 435?: ErrorCallback<TContext> | undefined;
  483. 436?: ErrorCallback<TContext> | undefined;
  484. 437?: ErrorCallback<TContext> | undefined;
  485. 438?: ErrorCallback<TContext> | undefined;
  486. 439?: ErrorCallback<TContext> | undefined;
  487. 440?: ErrorCallback<TContext> | undefined;
  488. 441?: ErrorCallback<TContext> | undefined;
  489. 442?: ErrorCallback<TContext> | undefined;
  490. 443?: ErrorCallback<TContext> | undefined;
  491. 444?: ErrorCallback<TContext> | undefined;
  492. 445?: ErrorCallback<TContext> | undefined;
  493. 446?: ErrorCallback<TContext> | undefined;
  494. 447?: ErrorCallback<TContext> | undefined;
  495. 448?: ErrorCallback<TContext> | undefined;
  496. 449?: ErrorCallback<TContext> | undefined;
  497. 450?: ErrorCallback<TContext> | undefined;
  498. 451?: ErrorCallback<TContext> | undefined;
  499. 452?: ErrorCallback<TContext> | undefined;
  500. 453?: ErrorCallback<TContext> | undefined;
  501. 454?: ErrorCallback<TContext> | undefined;
  502. 455?: ErrorCallback<TContext> | undefined;
  503. 456?: ErrorCallback<TContext> | undefined;
  504. 457?: ErrorCallback<TContext> | undefined;
  505. 458?: ErrorCallback<TContext> | undefined;
  506. 459?: ErrorCallback<TContext> | undefined;
  507. 460?: ErrorCallback<TContext> | undefined;
  508. 461?: ErrorCallback<TContext> | undefined;
  509. 462?: ErrorCallback<TContext> | undefined;
  510. 463?: ErrorCallback<TContext> | undefined;
  511. 464?: ErrorCallback<TContext> | undefined;
  512. 465?: ErrorCallback<TContext> | undefined;
  513. 466?: ErrorCallback<TContext> | undefined;
  514. 467?: ErrorCallback<TContext> | undefined;
  515. 468?: ErrorCallback<TContext> | undefined;
  516. 469?: ErrorCallback<TContext> | undefined;
  517. 470?: ErrorCallback<TContext> | undefined;
  518. 471?: ErrorCallback<TContext> | undefined;
  519. 472?: ErrorCallback<TContext> | undefined;
  520. 473?: ErrorCallback<TContext> | undefined;
  521. 474?: ErrorCallback<TContext> | undefined;
  522. 475?: ErrorCallback<TContext> | undefined;
  523. 476?: ErrorCallback<TContext> | undefined;
  524. 477?: ErrorCallback<TContext> | undefined;
  525. 478?: ErrorCallback<TContext> | undefined;
  526. 479?: ErrorCallback<TContext> | undefined;
  527. 480?: ErrorCallback<TContext> | undefined;
  528. 481?: ErrorCallback<TContext> | undefined;
  529. 482?: ErrorCallback<TContext> | undefined;
  530. 483?: ErrorCallback<TContext> | undefined;
  531. 484?: ErrorCallback<TContext> | undefined;
  532. 485?: ErrorCallback<TContext> | undefined;
  533. 486?: ErrorCallback<TContext> | undefined;
  534. 487?: ErrorCallback<TContext> | undefined;
  535. 488?: ErrorCallback<TContext> | undefined;
  536. 489?: ErrorCallback<TContext> | undefined;
  537. 490?: ErrorCallback<TContext> | undefined;
  538. 491?: ErrorCallback<TContext> | undefined;
  539. 492?: ErrorCallback<TContext> | undefined;
  540. 493?: ErrorCallback<TContext> | undefined;
  541. 494?: ErrorCallback<TContext> | undefined;
  542. 495?: ErrorCallback<TContext> | undefined;
  543. 496?: ErrorCallback<TContext> | undefined;
  544. 497?: ErrorCallback<TContext> | undefined;
  545. 498?: ErrorCallback<TContext> | undefined;
  546. 499?: ErrorCallback<TContext> | undefined;
  547. 500?: ErrorCallback<TContext> | undefined;
  548. 501?: ErrorCallback<TContext> | undefined;
  549. 502?: ErrorCallback<TContext> | undefined;
  550. 503?: ErrorCallback<TContext> | undefined;
  551. 504?: ErrorCallback<TContext> | undefined;
  552. 505?: ErrorCallback<TContext> | undefined;
  553. 506?: ErrorCallback<TContext> | undefined;
  554. 507?: ErrorCallback<TContext> | undefined;
  555. 508?: ErrorCallback<TContext> | undefined;
  556. 509?: ErrorCallback<TContext> | undefined;
  557. 510?: ErrorCallback<TContext> | undefined;
  558. 511?: ErrorCallback<TContext> | undefined;
  559. 512?: ErrorCallback<TContext> | undefined;
  560. 513?: ErrorCallback<TContext> | undefined;
  561. 514?: ErrorCallback<TContext> | undefined;
  562. 515?: ErrorCallback<TContext> | undefined;
  563. 516?: ErrorCallback<TContext> | undefined;
  564. 517?: ErrorCallback<TContext> | undefined;
  565. 518?: ErrorCallback<TContext> | undefined;
  566. 519?: ErrorCallback<TContext> | undefined;
  567. 520?: ErrorCallback<TContext> | undefined;
  568. 521?: ErrorCallback<TContext> | undefined;
  569. 522?: ErrorCallback<TContext> | undefined;
  570. 523?: ErrorCallback<TContext> | undefined;
  571. 524?: ErrorCallback<TContext> | undefined;
  572. 525?: ErrorCallback<TContext> | undefined;
  573. 526?: ErrorCallback<TContext> | undefined;
  574. 527?: ErrorCallback<TContext> | undefined;
  575. 528?: ErrorCallback<TContext> | undefined;
  576. 529?: ErrorCallback<TContext> | undefined;
  577. 530?: ErrorCallback<TContext> | undefined;
  578. 531?: ErrorCallback<TContext> | undefined;
  579. 532?: ErrorCallback<TContext> | undefined;
  580. 533?: ErrorCallback<TContext> | undefined;
  581. 534?: ErrorCallback<TContext> | undefined;
  582. 535?: ErrorCallback<TContext> | undefined;
  583. 536?: ErrorCallback<TContext> | undefined;
  584. 537?: ErrorCallback<TContext> | undefined;
  585. 538?: ErrorCallback<TContext> | undefined;
  586. 539?: ErrorCallback<TContext> | undefined;
  587. 540?: ErrorCallback<TContext> | undefined;
  588. 541?: ErrorCallback<TContext> | undefined;
  589. 542?: ErrorCallback<TContext> | undefined;
  590. 543?: ErrorCallback<TContext> | undefined;
  591. 544?: ErrorCallback<TContext> | undefined;
  592. 545?: ErrorCallback<TContext> | undefined;
  593. 546?: ErrorCallback<TContext> | undefined;
  594. 547?: ErrorCallback<TContext> | undefined;
  595. 548?: ErrorCallback<TContext> | undefined;
  596. 549?: ErrorCallback<TContext> | undefined;
  597. 550?: ErrorCallback<TContext> | undefined;
  598. 551?: ErrorCallback<TContext> | undefined;
  599. 552?: ErrorCallback<TContext> | undefined;
  600. 553?: ErrorCallback<TContext> | undefined;
  601. 554?: ErrorCallback<TContext> | undefined;
  602. 555?: ErrorCallback<TContext> | undefined;
  603. 556?: ErrorCallback<TContext> | undefined;
  604. 557?: ErrorCallback<TContext> | undefined;
  605. 558?: ErrorCallback<TContext> | undefined;
  606. 559?: ErrorCallback<TContext> | undefined;
  607. 560?: ErrorCallback<TContext> | undefined;
  608. 561?: ErrorCallback<TContext> | undefined;
  609. 562?: ErrorCallback<TContext> | undefined;
  610. 563?: ErrorCallback<TContext> | undefined;
  611. 564?: ErrorCallback<TContext> | undefined;
  612. 565?: ErrorCallback<TContext> | undefined;
  613. 566?: ErrorCallback<TContext> | undefined;
  614. 567?: ErrorCallback<TContext> | undefined;
  615. 568?: ErrorCallback<TContext> | undefined;
  616. 569?: ErrorCallback<TContext> | undefined;
  617. 570?: ErrorCallback<TContext> | undefined;
  618. 571?: ErrorCallback<TContext> | undefined;
  619. 572?: ErrorCallback<TContext> | undefined;
  620. 573?: ErrorCallback<TContext> | undefined;
  621. 574?: ErrorCallback<TContext> | undefined;
  622. 575?: ErrorCallback<TContext> | undefined;
  623. 576?: ErrorCallback<TContext> | undefined;
  624. 577?: ErrorCallback<TContext> | undefined;
  625. 578?: ErrorCallback<TContext> | undefined;
  626. 579?: ErrorCallback<TContext> | undefined;
  627. 580?: ErrorCallback<TContext> | undefined;
  628. 581?: ErrorCallback<TContext> | undefined;
  629. 582?: ErrorCallback<TContext> | undefined;
  630. 583?: ErrorCallback<TContext> | undefined;
  631. 584?: ErrorCallback<TContext> | undefined;
  632. 585?: ErrorCallback<TContext> | undefined;
  633. 586?: ErrorCallback<TContext> | undefined;
  634. 587?: ErrorCallback<TContext> | undefined;
  635. 588?: ErrorCallback<TContext> | undefined;
  636. 589?: ErrorCallback<TContext> | undefined;
  637. 590?: ErrorCallback<TContext> | undefined;
  638. 591?: ErrorCallback<TContext> | undefined;
  639. 592?: ErrorCallback<TContext> | undefined;
  640. 593?: ErrorCallback<TContext> | undefined;
  641. 594?: ErrorCallback<TContext> | undefined;
  642. 595?: ErrorCallback<TContext> | undefined;
  643. 596?: ErrorCallback<TContext> | undefined;
  644. 597?: ErrorCallback<TContext> | undefined;
  645. 598?: ErrorCallback<TContext> | undefined;
  646. 599?: ErrorCallback<TContext> | undefined;
  647. // #endregion
  648. } & {
  649. // Status codes not listed require type annotations when defining the callback
  650. [index: number]: SuccessCallback<TContext> | ErrorCallback<TContext>;
  651. };
  652. // #endregion
  653. // Writable properties on XMLHttpRequest
  654. interface XHRFields
  655. extends Partial<Pick<XMLHttpRequest, "onreadystatechange" | "responseType" | "timeout" | "withCredentials">>
  656. {
  657. msCaching?: string | undefined;
  658. }
  659. }
  660. interface Transport {
  661. send(headers: PlainObject, completeCallback: Transport.SuccessCallback): void;
  662. abort(): void;
  663. }
  664. namespace Transport {
  665. type SuccessCallback = (
  666. status: number,
  667. statusText: Ajax.TextStatus,
  668. responses?: PlainObject,
  669. headers?: string,
  670. ) => void;
  671. }
  672. /**
  673. * @see \`{@link https://api.jquery.com/jquery.ajax/#jqXHR }\`
  674. */
  675. interface jqXHR<TResolve = any> extends
  676. Promise3<
  677. TResolve,
  678. jqXHR<TResolve>,
  679. never,
  680. Ajax.SuccessTextStatus,
  681. Ajax.ErrorTextStatus,
  682. never,
  683. jqXHR<TResolve>,
  684. string,
  685. never
  686. >,
  687. Pick<
  688. XMLHttpRequest,
  689. | "abort"
  690. | "getAllResponseHeaders"
  691. | "getResponseHeader"
  692. | "overrideMimeType"
  693. | "readyState"
  694. | "responseText"
  695. | "setRequestHeader"
  696. | "status"
  697. | "statusText"
  698. >,
  699. Partial<Pick<XMLHttpRequest, "responseXML">>
  700. {
  701. responseJSON?: any;
  702. abort(statusText?: string): void;
  703. /**
  704. * Determine the current state of a Deferred object.
  705. * @see \`{@link https://api.jquery.com/deferred.state/ }\`
  706. * @since 1.7
  707. */
  708. state(): "pending" | "resolved" | "rejected";
  709. statusCode(map: Ajax.StatusCodeCallbacks<any>): void;
  710. }
  711. namespace jqXHR {
  712. interface DoneCallback<TResolve = any, TjqXHR = jqXHR<TResolve>>
  713. extends Deferred.Callback3<TResolve, Ajax.SuccessTextStatus, TjqXHR>
  714. {}
  715. interface FailCallback<TjqXHR> extends Deferred.Callback3<TjqXHR, Ajax.ErrorTextStatus, string> {}
  716. interface AlwaysCallback<TResolve = any, TjqXHR = jqXHR<TResolve>>
  717. extends Deferred.Callback3<TResolve | TjqXHR, Ajax.TextStatus, TjqXHR | string>
  718. {}
  719. }
  720. // #endregion
  721. // region Callbacks
  722. // #region Callbacks
  723. interface CallbacksStatic {
  724. /**
  725. * A multi-purpose callbacks list object that provides a powerful way to manage callback lists.
  726. * @param flags An optional list of space-separated flags that change how the callback list behaves.
  727. * @see \`{@link https://api.jquery.com/jQuery.Callbacks/ }\`
  728. * @since 1.7
  729. */
  730. /* eslint-disable @definitelytyped/no-unnecessary-generics */
  731. // eslint-disable-next-line @typescript-eslint/ban-types
  732. <T extends Function>(flags?: string): Callbacks<T>;
  733. /* eslint-enable @definitelytyped/no-unnecessary-generics */
  734. }
  735. // eslint-disable-next-line @typescript-eslint/ban-types
  736. interface Callbacks<T extends Function = Function> {
  737. /**
  738. * Add a callback or a collection of callbacks to a callback list.
  739. * @param callback A function, or array of functions, that are to be added to the callback list.
  740. * @param callbacks A function, or array of functions, that are to be added to the callback list.
  741. * @see \`{@link https://api.jquery.com/callbacks.add/ }\`
  742. * @since 1.7
  743. * @example ​ ````Use callbacks.add() to add new callbacks to a callback list:
  744. ```javascript
  745. // A sample logging function to be added to a callbacks list
  746. var foo = function( value ) {
  747. console.log( "foo: " + value );
  748. };
  749. // Another function to also be added to the list
  750. var bar = function( value ) {
  751. console.log( "bar: " + value );
  752. };
  753. var callbacks = $.Callbacks();
  754. // Add the function "foo" to the list
  755. callbacks.add( foo );
  756. // Fire the items on the list
  757. callbacks.fire( "hello" );
  758. // Outputs: "foo: hello"
  759. // Add the function "bar" to the list
  760. callbacks.add( bar );
  761. // Fire the items on the list again
  762. callbacks.fire( "world" );
  763. // Outputs:
  764. // "foo: world"
  765. // "bar: world"
  766. ```
  767. */
  768. add(callback: TypeOrArray<T>, ...callbacks: Array<TypeOrArray<T>>): this;
  769. /**
  770. * Disable a callback list from doing anything more.
  771. * @see \`{@link https://api.jquery.com/callbacks.disable/ }\`
  772. * @since 1.7
  773. * @example ​ ````Use callbacks.disable() to disable further calls to a callback list:
  774. ```javascript
  775. // A sample logging function to be added to a callbacks list
  776. var foo = function( value ) {
  777. console.log( value );
  778. };
  779. var callbacks = $.Callbacks();
  780. // Add the above function to the list
  781. callbacks.add( foo );
  782. // Fire the items on the list
  783. callbacks.fire( "foo" );
  784. // Outputs: foo
  785. // Disable further calls being possible
  786. callbacks.disable();
  787. // Attempt to fire with "foobar" as an argument
  788. callbacks.fire( "foobar" );
  789. // foobar isn't output
  790. ```
  791. */
  792. disable(): this;
  793. /**
  794. * Determine if the callbacks list has been disabled.
  795. * @see \`{@link https://api.jquery.com/callbacks.disabled/ }\`
  796. * @since 1.7
  797. * @example ​ ````Use callbacks.disabled() to determine if the callbacks list has been disabled:
  798. ```javascript
  799. // A sample logging function to be added to a callbacks list
  800. var foo = function( value ) {
  801. console.log( "foo:" + value );
  802. };
  803. var callbacks = $.Callbacks();
  804. // Add the logging function to the callback list
  805. callbacks.add( foo );
  806. // Fire the items on the list, passing an argument
  807. callbacks.fire( "hello" );
  808. // Outputs "foo: hello"
  809. // Disable the callbacks list
  810. callbacks.disable();
  811. // Test the disabled state of the list
  812. console.log ( callbacks.disabled() );
  813. // Outputs: true
  814. ```
  815. */
  816. disabled(): boolean;
  817. /**
  818. * Remove all of the callbacks from a list.
  819. * @see \`{@link https://api.jquery.com/callbacks.empty/ }\`
  820. * @since 1.7
  821. * @example ​ ````Use callbacks.empty() to empty a list of callbacks:
  822. ```javascript
  823. // A sample logging function to be added to a callbacks list
  824. var foo = function( value1, value2 ) {
  825. console.log( "foo: " + value1 + "," + value2 );
  826. };
  827. // Another function to also be added to the list
  828. var bar = function( value1, value2 ) {
  829. console.log( "bar: " + value1 + "," + value2 );
  830. };
  831. var callbacks = $.Callbacks();
  832. // Add the two functions
  833. callbacks.add( foo );
  834. callbacks.add( bar );
  835. // Empty the callbacks list
  836. callbacks.empty();
  837. // Check to ensure all callbacks have been removed
  838. console.log( callbacks.has( foo ) );
  839. // false
  840. console.log( callbacks.has( bar ) );
  841. // false
  842. ```
  843. */
  844. empty(): this;
  845. /**
  846. * Call all of the callbacks with the given arguments.
  847. * @param args The argument or list of arguments to pass back to the callback list.
  848. * @see \`{@link https://api.jquery.com/callbacks.fire/ }\`
  849. * @since 1.7
  850. * @example ​ ````Use callbacks.fire() to invoke the callbacks in a list with any arguments that have been passed:
  851. ```javascript
  852. // A sample logging function to be added to a callbacks list
  853. var foo = function( value ) {
  854. console.log( "foo:" + value );
  855. };
  856. var callbacks = $.Callbacks();
  857. // Add the function "foo" to the list
  858. callbacks.add( foo );
  859. // Fire the items on the list
  860. callbacks.fire( "hello" ); // Outputs: "foo: hello"
  861. callbacks.fire( "world" ); // Outputs: "foo: world"
  862. // Add another function to the list
  863. var bar = function( value ){
  864. console.log( "bar:" + value );
  865. };
  866. // Add this function to the list
  867. callbacks.add( bar );
  868. // Fire the items on the list again
  869. callbacks.fire( "hello again" );
  870. // Outputs:
  871. // "foo: hello again"
  872. // "bar: hello again"
  873. ```
  874. */
  875. fire(...args: any[]): this;
  876. /**
  877. * Determine if the callbacks have already been called at least once.
  878. * @see \`{@link https://api.jquery.com/callbacks.fired/ }\`
  879. * @since 1.7
  880. * @example ​ ````Use callbacks.fired() to determine if the callbacks in a list have been called at least once:
  881. ```javascript
  882. // A sample logging function to be added to a callbacks list
  883. var foo = function( value ) {
  884. console.log( "foo:" + value );
  885. };
  886. var callbacks = $.Callbacks();
  887. // Add the function "foo" to the list
  888. callbacks.add( foo );
  889. // Fire the items on the list
  890. callbacks.fire( "hello" ); // Outputs: "foo: hello"
  891. callbacks.fire( "world" ); // Outputs: "foo: world"
  892. // Test to establish if the callbacks have been called
  893. console.log( callbacks.fired() );
  894. ```
  895. */
  896. fired(): boolean;
  897. /**
  898. * Call all callbacks in a list with the given context and arguments.
  899. * @param context A reference to the context in which the callbacks in the list should be fired.
  900. * @param args An argument, or array of arguments, to pass to the callbacks in the list.
  901. * @see \`{@link https://api.jquery.com/callbacks.fireWith/ }\`
  902. * @since 1.7
  903. * @example ​ ````Use callbacks.fireWith() to fire a list of callbacks with a specific context and an array of arguments:
  904. ```javascript
  905. // A sample logging function to be added to a callbacks list
  906. var log = function( value1, value2 ) {
  907. console.log( "Received: " + value1 + "," + value2 );
  908. };
  909. var callbacks = $.Callbacks();
  910. // Add the log method to the callbacks list
  911. callbacks.add( log );
  912. // Fire the callbacks on the list using the context "window"
  913. // and an arguments array
  914. callbacks.fireWith( window, [ "foo","bar" ] );
  915. // Outputs: "Received: foo, bar"
  916. ```
  917. */
  918. fireWith(context: object, args?: ArrayLike<any>): this;
  919. /**
  920. * Determine whether or not the list has any callbacks attached. If a callback is provided as an argument, determine whether it is in a list.
  921. * @param callback The callback to search for.
  922. * @see \`{@link https://api.jquery.com/callbacks.has/ }\`
  923. * @since 1.7
  924. * @example ​ ````Use callbacks.has() to check if a callback list contains a specific callback:
  925. ```javascript
  926. // A sample logging function to be added to a callbacks list
  927. var foo = function( value1, value2 ) {
  928. console.log( "Received: " + value1 + "," + value2 );
  929. };
  930. // A second function which will not be added to the list
  931. var bar = function( value1, value2 ) {
  932. console.log( "foobar" );
  933. };
  934. var callbacks = $.Callbacks();
  935. // Add the log method to the callbacks list
  936. callbacks.add( foo );
  937. // Determine which callbacks are in the list
  938. console.log( callbacks.has( foo ) );
  939. // true
  940. console.log( callbacks.has( bar ) );
  941. // false
  942. ```
  943. */
  944. has(callback?: T): boolean;
  945. /**
  946. * Lock a callback list in its current state.
  947. * @see \`{@link https://api.jquery.com/callbacks.lock/ }\`
  948. * @since 1.7
  949. * @example ​ ````Use callbacks.lock() to lock a callback list to avoid further changes being made to the list state:
  950. ```javascript
  951. // A sample logging function to be added to a callbacks list
  952. var foo = function( value ) {
  953. console.log( "foo:" + value );
  954. };
  955. var callbacks = $.Callbacks();
  956. // Add the logging function to the callback list
  957. callbacks.add( foo );
  958. // Fire the items on the list, passing an argument
  959. callbacks.fire( "hello" );
  960. // Outputs "foo: hello"
  961. // Lock the callbacks list
  962. callbacks.lock();
  963. // Try firing the items again
  964. callbacks.fire( "world" );
  965. // As the list was locked, no items were called,
  966. // so "world" isn't logged
  967. ```
  968. * @example ​ ````Use callbacks.lock() to lock a callback list with &quot;memory,&quot; and then resume using the list:
  969. ```html
  970. <!doctype html>
  971. <html lang="en">
  972. <head>
  973. <meta charset="utf-8">
  974. <title>callbacks.lock demo</title>
  975. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  976. </head>
  977. <body>
  978. <div id="log"></div>
  979. <script>
  980. // Simple function for logging results
  981. var log = function( value ) {
  982. $( "#log" ).append( "<p>" + value + "</p>" );
  983. };
  984. // Two sample functions to be added to a callbacks list
  985. var foo = function( value ) {
  986. log( "foo: " + value );
  987. };
  988. var bar = function( value ) {
  989. log( "bar: " + value );
  990. };
  991. // Create the callbacks object with the "memory" flag
  992. var callbacks = $.Callbacks( "memory" );
  993. // Add the foo logging function to the callback list
  994. callbacks.add( foo );
  995. // Fire the items on the list, passing an argument
  996. callbacks.fire( "hello" );
  997. // Outputs "foo: hello"
  998. // Lock the callbacks list
  999. callbacks.lock();
  1000. // Try firing the items again
  1001. callbacks.fire( "world" );
  1002. // As the list was locked, no items were called,
  1003. // so "foo: world" isn't logged
  1004. // Add the foo function to the callback list again
  1005. callbacks.add( foo );
  1006. // Try firing the items again
  1007. callbacks.fire( "silentArgument" );
  1008. // Outputs "foo: hello" because the argument value was stored in memory
  1009. // Add the bar function to the callback list
  1010. callbacks.add( bar );
  1011. callbacks.fire( "youHadMeAtHello" );
  1012. // Outputs "bar: hello" because the list is still locked,
  1013. // and the argument value is still stored in memory
  1014. </script>
  1015. </body>
  1016. </html>
  1017. ```
  1018. */
  1019. lock(): this;
  1020. /**
  1021. * Determine if the callbacks list has been locked.
  1022. * @see \`{@link https://api.jquery.com/callbacks.locked/ }\`
  1023. * @since 1.7
  1024. * @example ​ ````Use callbacks.locked() to determine the lock-state of a callback list:
  1025. ```javascript
  1026. // A sample logging function to be added to a callbacks list
  1027. var foo = function( value ) {
  1028. console.log( "foo: " + value );
  1029. };
  1030. var callbacks = $.Callbacks();
  1031. // Add the logging function to the callback list
  1032. callbacks.add( foo );
  1033. // Fire the items on the list, passing an argument
  1034. callbacks.fire( "hello" );
  1035. // Outputs "foo: hello"
  1036. // Lock the callbacks list
  1037. callbacks.lock();
  1038. // Test the lock-state of the list
  1039. console.log ( callbacks.locked() );
  1040. // true
  1041. ```
  1042. */
  1043. locked(): boolean;
  1044. /**
  1045. * Remove a callback or a collection of callbacks from a callback list.
  1046. * @param callbacks A function, or array of functions, that are to be removed from the callback list.
  1047. * @see \`{@link https://api.jquery.com/callbacks.remove/ }\`
  1048. * @since 1.7
  1049. * @example ​ ````Use callbacks.remove() to remove callbacks from a callback list:
  1050. ```javascript
  1051. // A sample logging function to be added to a callbacks list
  1052. var foo = function( value ) {
  1053. console.log( "foo: " + value );
  1054. };
  1055. var callbacks = $.Callbacks();
  1056. // Add the function "foo" to the list
  1057. callbacks.add( foo );
  1058. // Fire the items on the list
  1059. callbacks.fire( "hello" );
  1060. // Outputs: "foo: hello"
  1061. // Remove "foo" from the callback list
  1062. callbacks.remove( foo );
  1063. // Fire the items on the list again
  1064. callbacks.fire( "world" );
  1065. // Nothing output as "foo" is no longer in the list
  1066. ```
  1067. */
  1068. remove(...callbacks: T[]): this;
  1069. }
  1070. // #endregion
  1071. // region CSS hooks
  1072. // #region CSS hooks
  1073. // Workaround for TypeScript 2.3 which does not have support for weak types handling.
  1074. type CSSHook<TElement> =
  1075. & Partial<_CSSHook<TElement>>
  1076. & (
  1077. | Pick<_CSSHook<TElement>, "get">
  1078. | Pick<_CSSHook<TElement>, "set">
  1079. );
  1080. interface _CSSHook<TElement> {
  1081. get(elem: TElement, computed: any, extra: any): any;
  1082. set(elem: TElement, value: any): void;
  1083. }
  1084. interface CSSHooks {
  1085. // Set to HTMLElement to minimize breaks but should probably be Element.
  1086. [propertyName: string]: CSSHook<HTMLElement>;
  1087. }
  1088. // #endregion
  1089. // region Deferred
  1090. // #region Deferred
  1091. /**
  1092. * Any object that has a then method.
  1093. */
  1094. interface Thenable<T> extends PromiseLike<T> {}
  1095. // Type parameter guide
  1096. // --------------------
  1097. // Each type parameter represents a parameter in one of the three possible callbacks.
  1098. //
  1099. // The first letter indicates which position the parameter is in.
  1100. //
  1101. // T = A = 1st position
  1102. // U = B = 2nd position
  1103. // V = C = 3rd position
  1104. // S = R = rest position
  1105. //
  1106. // The second letter indicates which whether it is a [R]esolve, Re[J]ect, or [N]otify value.
  1107. //
  1108. // The third letter indicates whether the value is returned in the [D]one filter, [F]ail filter, or [P]rogress filter.
  1109. /**
  1110. * This object provides a subset of the methods of the Deferred object (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred.
  1111. * @see \`{@link https://api.jquery.com/Types/#Promise }\`
  1112. */
  1113. interface PromiseBase<TR, TJ, TN, UR, UJ, UN, VR, VJ, VN, SR, SJ, SN> {
  1114. /**
  1115. * Add handlers to be called when the Deferred object is either resolved or rejected.
  1116. * @param alwaysCallback A function, or array of functions, that is called when the Deferred is resolved or rejected.
  1117. * @param alwaysCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected.
  1118. * @see \`{@link https://api.jquery.com/deferred.always/ }\`
  1119. * @since 1.6
  1120. * @example ​ ````Since the jQuery.get() method returns a jqXHR object, which is derived from a Deferred object, we can attach a callback for both success and error using the deferred.always() method.
  1121. ```javascript
  1122. $.get( "test.php" ).always(function() {
  1123. alert( "$.get completed with success or error callback arguments" );
  1124. });
  1125. ```
  1126. */
  1127. always(
  1128. alwaysCallback: TypeOrArray<Deferred.CallbackBase<TR | TJ, UR | UJ, VR | VJ, SR | SJ>>,
  1129. ...alwaysCallbacks: Array<TypeOrArray<Deferred.CallbackBase<TR | TJ, UR | UJ, VR | VJ, SR | SJ>>>
  1130. ): this;
  1131. /**
  1132. * Add handlers to be called when the Deferred object is resolved.
  1133. * @param doneCallback A function, or array of functions, that are called when the Deferred is resolved.
  1134. * @param doneCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved.
  1135. * @see \`{@link https://api.jquery.com/deferred.done/ }\`
  1136. * @since 1.5
  1137. * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can attach a success callback using the .done() method.
  1138. ```javascript
  1139. $.get( "test.php" ).done(function() {
  1140. alert( "$.get succeeded" );
  1141. });
  1142. ```
  1143. * @example ​ ````Resolve a Deferred object when the user clicks a button, triggering a number of callback functions:
  1144. ```html
  1145. <!doctype html>
  1146. <html lang="en">
  1147. <head>
  1148. <meta charset="utf-8">
  1149. <title>deferred.done demo</title>
  1150. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1151. </head>
  1152. <body>
  1153. <button>Go</button>
  1154. <p>Ready...</p>
  1155. <script>
  1156. // 3 functions to call when the Deferred object is resolved
  1157. function fn1() {
  1158. $( "p" ).append( " 1 " );
  1159. }
  1160. function fn2() {
  1161. $( "p" ).append( " 2 " );
  1162. }
  1163. function fn3( n ) {
  1164. $( "p" ).append( n + " 3 " + n );
  1165. }
  1166. // Create a deferred object
  1167. var dfd = $.Deferred();
  1168. // Add handlers to be called when dfd is resolved
  1169. dfd
  1170. // .done() can take any number of functions or arrays of functions
  1171. .done( [ fn1, fn2 ], fn3, [ fn2, fn1 ] )
  1172. // We can chain done methods, too
  1173. .done(function( n ) {
  1174. $( "p" ).append( n + " we're done." );
  1175. });
  1176. // Resolve the Deferred object when the button is clicked
  1177. $( "button" ).on( "click", function() {
  1178. dfd.resolve( "and" );
  1179. });
  1180. </script>
  1181. </body>
  1182. </html>
  1183. ```
  1184. */
  1185. done(
  1186. doneCallback: TypeOrArray<Deferred.CallbackBase<TR, UR, VR, SR>>,
  1187. ...doneCallbacks: Array<TypeOrArray<Deferred.CallbackBase<TR, UR, VR, SR>>>
  1188. ): this;
  1189. /**
  1190. * Add handlers to be called when the Deferred object is rejected.
  1191. * @param failCallback A function, or array of functions, that are called when the Deferred is rejected.
  1192. * @param failCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is rejected.
  1193. * @see \`{@link https://api.jquery.com/deferred.fail/ }\`
  1194. * @since 1.5
  1195. * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred, you can attach a success and failure callback using the deferred.done() and deferred.fail() methods.
  1196. ```javascript
  1197. $.get( "test.php" )
  1198. .done(function() {
  1199. alert( "$.get succeeded" );
  1200. })
  1201. .fail(function() {
  1202. alert( "$.get failed!" );
  1203. });
  1204. ```
  1205. */
  1206. fail(
  1207. failCallback: TypeOrArray<Deferred.CallbackBase<TJ, UJ, VJ, SJ>>,
  1208. ...failCallbacks: Array<TypeOrArray<Deferred.CallbackBase<TJ, UJ, VJ, SJ>>>
  1209. ): this;
  1210. /**
  1211. * Add handlers to be called when the Deferred object generates progress notifications.
  1212. * @param progressCallback A function, or array of functions, to be called when the Deferred generates progress notifications.
  1213. * @param progressCallbacks Optional additional functions, or arrays of functions, to be called when the Deferred generates
  1214. * progress notifications.
  1215. * @see \`{@link https://api.jquery.com/deferred.progress/ }\`
  1216. * @since 1.7
  1217. */
  1218. progress(
  1219. progressCallback: TypeOrArray<Deferred.CallbackBase<TN, UN, VN, SN>>,
  1220. ...progressCallbacks: Array<TypeOrArray<Deferred.CallbackBase<TN, UN, VN, SN>>>
  1221. ): this;
  1222. /**
  1223. * Return a Deferred's Promise object.
  1224. * @param target Object onto which the promise methods have to be attached
  1225. * @see \`{@link https://api.jquery.com/deferred.promise/ }\`
  1226. * @since 1.5
  1227. * @example ​ ````Create a Deferred and set two timer-based functions to either resolve or reject the Deferred after a random interval. Whichever one fires first &quot;wins&quot; and will call one of the callbacks. The second timeout has no effect since the Deferred is already complete (in a resolved or rejected state) from the first timeout action. Also set a timer-based progress notification function, and call a progress handler that adds &quot;working...&quot; to the document body.
  1228. ```javascript
  1229. function asyncEvent() {
  1230. var dfd = jQuery.Deferred();
  1231. // Resolve after a random interval
  1232. setTimeout(function() {
  1233. dfd.resolve( "hurray" );
  1234. }, Math.floor( 400 + Math.random() * 2000 ) );
  1235. // Reject after a random interval
  1236. setTimeout(function() {
  1237. dfd.reject( "sorry" );
  1238. }, Math.floor( 400 + Math.random() * 2000 ) );
  1239. // Show a "working..." message every half-second
  1240. setTimeout(function working() {
  1241. if ( dfd.state() === "pending" ) {
  1242. dfd.notify( "working... " );
  1243. setTimeout( working, 500 );
  1244. }
  1245. }, 1 );
  1246. // Return the Promise so caller can't change the Deferred
  1247. return dfd.promise();
  1248. }
  1249. // Attach a done, fail, and progress handler for the asyncEvent
  1250. $.when( asyncEvent() ).then(
  1251. function( status ) {
  1252. alert( status + ", things are going well" );
  1253. },
  1254. function( status ) {
  1255. alert( status + ", you fail this time" );
  1256. },
  1257. function( status ) {
  1258. $( "body" ).append( status );
  1259. }
  1260. );
  1261. ```
  1262. */
  1263. promise<TTarget extends object>(target: TTarget): this & TTarget;
  1264. /**
  1265. * Return a Deferred's Promise object.
  1266. * @see \`{@link https://api.jquery.com/deferred.promise/ }\`
  1267. * @since 1.5
  1268. * @example ​ ````Use the target argument to promote an existing object to a Promise:
  1269. ```javascript
  1270. // Existing object
  1271. var obj = {
  1272. hello: function( name ) {
  1273. alert( "Hello " + name );
  1274. }
  1275. },
  1276. // Create a Deferred
  1277. defer = $.Deferred();
  1278. // Set object as a promise
  1279. defer.promise( obj );
  1280. // Resolve the deferred
  1281. defer.resolve( "John" );
  1282. // Use the object as a Promise
  1283. obj.done(function( name ) {
  1284. obj.hello( name ); // Will alert "Hello John"
  1285. }).hello( "Karl" ); // Will alert "Hello Karl"
  1286. ```
  1287. */
  1288. promise(): this;
  1289. /**
  1290. * Determine the current state of a Deferred object.
  1291. * @see \`{@link https://api.jquery.com/deferred.state/ }\`
  1292. * @since 1.7
  1293. */
  1294. state(): "pending" | "resolved" | "rejected";
  1295. // region pipe
  1296. // #region pipe
  1297. /**
  1298. * Utility method to filter and/or chain Deferreds.
  1299. * @param doneFilter An optional function that is called when the Deferred is resolved.
  1300. * @param failFilter An optional function that is called when the Deferred is rejected.
  1301. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  1302. * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
  1303. * @since 1.6
  1304. * @since 1.7
  1305. * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
  1306. *
  1307. * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
  1308. *
  1309. * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
  1310. * @example ​ ````Filter resolve value:
  1311. ```javascript
  1312. var defer = $.Deferred(),
  1313. filtered = defer.pipe(function( value ) {
  1314. return value * 2;
  1315. });
  1316. defer.resolve( 5 );
  1317. filtered.done(function( value ) {
  1318. alert( "Value is ( 2*5 = ) 10: " + value );
  1319. });
  1320. ```
  1321. * @example ​ ````Filter reject value:
  1322. ```javascript
  1323. var defer = $.Deferred(),
  1324. filtered = defer.pipe( null, function( value ) {
  1325. return value * 3;
  1326. });
  1327. defer.reject( 6 );
  1328. filtered.fail(function( value ) {
  1329. alert( "Value is ( 3*6 = ) 18: " + value );
  1330. });
  1331. ```
  1332. * @example ​ ````Chain tasks:
  1333. ```javascript
  1334. var request = $.ajax( url, { dataType: "json" } ),
  1335. chained = request.pipe(function( data ) {
  1336. return $.ajax( url2, { data: { user: data.userId } } );
  1337. });
  1338. chained.done(function( data ) {
  1339. // data retrieved from url2 as provided by the first request
  1340. });
  1341. ```
  1342. */
  1343. pipe<
  1344. ARD = never,
  1345. AJD = never,
  1346. AND = never,
  1347. BRD = never,
  1348. BJD = never,
  1349. BND = never,
  1350. CRD = never,
  1351. CJD = never,
  1352. CND = never,
  1353. RRD = never,
  1354. RJD = never,
  1355. RND = never,
  1356. ARF = never,
  1357. AJF = never,
  1358. ANF = never,
  1359. BRF = never,
  1360. BJF = never,
  1361. BNF = never,
  1362. CRF = never,
  1363. CJF = never,
  1364. CNF = never,
  1365. RRF = never,
  1366. RJF = never,
  1367. RNF = never,
  1368. ARP = never,
  1369. AJP = never,
  1370. ANP = never,
  1371. BRP = never,
  1372. BJP = never,
  1373. BNP = never,
  1374. CRP = never,
  1375. CJP = never,
  1376. CNP = never,
  1377. RRP = never,
  1378. RJP = never,
  1379. RNP = never,
  1380. >(
  1381. doneFilter: (
  1382. t: TR,
  1383. u: UR,
  1384. v: VR,
  1385. ...s: SR[]
  1386. ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
  1387. failFilter: (
  1388. t: TJ,
  1389. u: UJ,
  1390. v: VJ,
  1391. ...s: SJ[]
  1392. ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<AJF> | AJF,
  1393. progressFilter: (
  1394. t: TN,
  1395. u: UN,
  1396. v: VN,
  1397. ...s: SN[]
  1398. ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
  1399. ): PromiseBase<
  1400. ARD | ARF | ARP,
  1401. AJD | AJF | AJP,
  1402. AND | ANF | ANP,
  1403. BRD | BRF | BRP,
  1404. BJD | BJF | BJP,
  1405. BND | BNF | BNP,
  1406. CRD | CRF | CRP,
  1407. CJD | CJF | CJP,
  1408. CND | CNF | CNP,
  1409. RRD | RRF | RRP,
  1410. RJD | RJF | RJP,
  1411. RND | RNF | RNP
  1412. >;
  1413. /**
  1414. * Utility method to filter and/or chain Deferreds.
  1415. * @param doneFilter An optional function that is called when the Deferred is resolved.
  1416. * @param failFilter An optional function that is called when the Deferred is rejected.
  1417. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  1418. * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
  1419. * @since 1.6
  1420. * @since 1.7
  1421. * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
  1422. *
  1423. * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
  1424. *
  1425. * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
  1426. * @example ​ ````Filter reject value:
  1427. ```javascript
  1428. var defer = $.Deferred(),
  1429. filtered = defer.pipe( null, function( value ) {
  1430. return value * 3;
  1431. });
  1432. defer.reject( 6 );
  1433. filtered.fail(function( value ) {
  1434. alert( "Value is ( 3*6 = ) 18: " + value );
  1435. });
  1436. ```
  1437. * @example ​ ````Chain tasks:
  1438. ```javascript
  1439. var request = $.ajax( url, { dataType: "json" } ),
  1440. chained = request.pipe(function( data ) {
  1441. return $.ajax( url2, { data: { user: data.userId } } );
  1442. });
  1443. chained.done(function( data ) {
  1444. // data retrieved from url2 as provided by the first request
  1445. });
  1446. ```
  1447. */
  1448. pipe<
  1449. ARF = never,
  1450. AJF = never,
  1451. ANF = never,
  1452. BRF = never,
  1453. BJF = never,
  1454. BNF = never,
  1455. CRF = never,
  1456. CJF = never,
  1457. CNF = never,
  1458. RRF = never,
  1459. RJF = never,
  1460. RNF = never,
  1461. ARP = never,
  1462. AJP = never,
  1463. ANP = never,
  1464. BRP = never,
  1465. BJP = never,
  1466. BNP = never,
  1467. CRP = never,
  1468. CJP = never,
  1469. CNP = never,
  1470. RRP = never,
  1471. RJP = never,
  1472. RNP = never,
  1473. >(
  1474. doneFilter: null,
  1475. failFilter: (
  1476. t: TJ,
  1477. u: UJ,
  1478. v: VJ,
  1479. ...s: SJ[]
  1480. ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<AJF> | AJF,
  1481. progressFilter: (
  1482. t: TN,
  1483. u: UN,
  1484. v: VN,
  1485. ...s: SN[]
  1486. ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
  1487. ): PromiseBase<
  1488. ARF | ARP,
  1489. AJF | AJP,
  1490. ANF | ANP,
  1491. BRF | BRP,
  1492. BJF | BJP,
  1493. BNF | BNP,
  1494. CRF | CRP,
  1495. CJF | CJP,
  1496. CNF | CNP,
  1497. RRF | RRP,
  1498. RJF | RJP,
  1499. RNF | RNP
  1500. >;
  1501. /**
  1502. * Utility method to filter and/or chain Deferreds.
  1503. * @param doneFilter An optional function that is called when the Deferred is resolved.
  1504. * @param failFilter An optional function that is called when the Deferred is rejected.
  1505. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  1506. * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
  1507. * @since 1.6
  1508. * @since 1.7
  1509. * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
  1510. *
  1511. * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
  1512. *
  1513. * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
  1514. * @example ​ ````Filter resolve value:
  1515. ```javascript
  1516. var defer = $.Deferred(),
  1517. filtered = defer.pipe(function( value ) {
  1518. return value * 2;
  1519. });
  1520. defer.resolve( 5 );
  1521. filtered.done(function( value ) {
  1522. alert( "Value is ( 2*5 = ) 10: " + value );
  1523. });
  1524. ```
  1525. * @example ​ ````Chain tasks:
  1526. ```javascript
  1527. var request = $.ajax( url, { dataType: "json" } ),
  1528. chained = request.pipe(function( data ) {
  1529. return $.ajax( url2, { data: { user: data.userId } } );
  1530. });
  1531. chained.done(function( data ) {
  1532. // data retrieved from url2 as provided by the first request
  1533. });
  1534. ```
  1535. */
  1536. pipe<
  1537. ARD = never,
  1538. AJD = never,
  1539. AND = never,
  1540. BRD = never,
  1541. BJD = never,
  1542. BND = never,
  1543. CRD = never,
  1544. CJD = never,
  1545. CND = never,
  1546. RRD = never,
  1547. RJD = never,
  1548. RND = never,
  1549. ARP = never,
  1550. AJP = never,
  1551. ANP = never,
  1552. BRP = never,
  1553. BJP = never,
  1554. BNP = never,
  1555. CRP = never,
  1556. CJP = never,
  1557. CNP = never,
  1558. RRP = never,
  1559. RJP = never,
  1560. RNP = never,
  1561. >(
  1562. doneFilter: (
  1563. t: TR,
  1564. u: UR,
  1565. v: VR,
  1566. ...s: SR[]
  1567. ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
  1568. failFilter: null,
  1569. progressFilter: (
  1570. t: TN,
  1571. u: UN,
  1572. v: VN,
  1573. ...s: SN[]
  1574. ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
  1575. ): PromiseBase<
  1576. ARD | ARP,
  1577. AJD | AJP,
  1578. AND | ANP,
  1579. BRD | BRP,
  1580. BJD | BJP,
  1581. BND | BNP,
  1582. CRD | CRP,
  1583. CJD | CJP,
  1584. CND | CNP,
  1585. RRD | RRP,
  1586. RJD | RJP,
  1587. RND | RNP
  1588. >;
  1589. /**
  1590. * Utility method to filter and/or chain Deferreds.
  1591. * @param doneFilter An optional function that is called when the Deferred is resolved.
  1592. * @param failFilter An optional function that is called when the Deferred is rejected.
  1593. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  1594. * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
  1595. * @since 1.6
  1596. * @since 1.7
  1597. * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
  1598. *
  1599. * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
  1600. *
  1601. * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
  1602. * @example ​ ````Chain tasks:
  1603. ```javascript
  1604. var request = $.ajax( url, { dataType: "json" } ),
  1605. chained = request.pipe(function( data ) {
  1606. return $.ajax( url2, { data: { user: data.userId } } );
  1607. });
  1608. chained.done(function( data ) {
  1609. // data retrieved from url2 as provided by the first request
  1610. });
  1611. ```
  1612. */
  1613. pipe<
  1614. ARP = never,
  1615. AJP = never,
  1616. ANP = never,
  1617. BRP = never,
  1618. BJP = never,
  1619. BNP = never,
  1620. CRP = never,
  1621. CJP = never,
  1622. CNP = never,
  1623. RRP = never,
  1624. RJP = never,
  1625. RNP = never,
  1626. >(
  1627. doneFilter: null,
  1628. failFilter: null,
  1629. progressFilter?: (
  1630. t: TN,
  1631. u: UN,
  1632. v: VN,
  1633. ...s: SN[]
  1634. ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
  1635. ): PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP>;
  1636. /**
  1637. * Utility method to filter and/or chain Deferreds.
  1638. * @param doneFilter An optional function that is called when the Deferred is resolved.
  1639. * @param failFilter An optional function that is called when the Deferred is rejected.
  1640. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  1641. * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
  1642. * @since 1.6
  1643. * @since 1.7
  1644. * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
  1645. *
  1646. * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
  1647. *
  1648. * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
  1649. * @example ​ ````Filter resolve value:
  1650. ```javascript
  1651. var defer = $.Deferred(),
  1652. filtered = defer.pipe(function( value ) {
  1653. return value * 2;
  1654. });
  1655. defer.resolve( 5 );
  1656. filtered.done(function( value ) {
  1657. alert( "Value is ( 2*5 = ) 10: " + value );
  1658. });
  1659. ```
  1660. * @example ​ ````Filter reject value:
  1661. ```javascript
  1662. var defer = $.Deferred(),
  1663. filtered = defer.pipe( null, function( value ) {
  1664. return value * 3;
  1665. });
  1666. defer.reject( 6 );
  1667. filtered.fail(function( value ) {
  1668. alert( "Value is ( 3*6 = ) 18: " + value );
  1669. });
  1670. ```
  1671. * @example ​ ````Chain tasks:
  1672. ```javascript
  1673. var request = $.ajax( url, { dataType: "json" } ),
  1674. chained = request.pipe(function( data ) {
  1675. return $.ajax( url2, { data: { user: data.userId } } );
  1676. });
  1677. chained.done(function( data ) {
  1678. // data retrieved from url2 as provided by the first request
  1679. });
  1680. ```
  1681. */
  1682. pipe<
  1683. ARD = never,
  1684. AJD = never,
  1685. AND = never,
  1686. BRD = never,
  1687. BJD = never,
  1688. BND = never,
  1689. CRD = never,
  1690. CJD = never,
  1691. CND = never,
  1692. RRD = never,
  1693. RJD = never,
  1694. RND = never,
  1695. ARF = never,
  1696. AJF = never,
  1697. ANF = never,
  1698. BRF = never,
  1699. BJF = never,
  1700. BNF = never,
  1701. CRF = never,
  1702. CJF = never,
  1703. CNF = never,
  1704. RRF = never,
  1705. RJF = never,
  1706. RNF = never,
  1707. >(
  1708. doneFilter: (
  1709. t: TR,
  1710. u: UR,
  1711. v: VR,
  1712. ...s: SR[]
  1713. ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
  1714. failFilter: (
  1715. t: TJ,
  1716. u: UJ,
  1717. v: VJ,
  1718. ...s: SJ[]
  1719. ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<AJF> | AJF,
  1720. progressFilter?: null,
  1721. ): PromiseBase<
  1722. ARD | ARF,
  1723. AJD | AJF,
  1724. AND | ANF,
  1725. BRD | BRF,
  1726. BJD | BJF,
  1727. BND | BNF,
  1728. CRD | CRF,
  1729. CJD | CJF,
  1730. CND | CNF,
  1731. RRD | RRF,
  1732. RJD | RJF,
  1733. RND | RNF
  1734. >;
  1735. /**
  1736. * Utility method to filter and/or chain Deferreds.
  1737. * @param doneFilter An optional function that is called when the Deferred is resolved.
  1738. * @param failFilter An optional function that is called when the Deferred is rejected.
  1739. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  1740. * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
  1741. * @since 1.6
  1742. * @since 1.7
  1743. * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
  1744. *
  1745. * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
  1746. *
  1747. * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
  1748. * @example ​ ````Filter reject value:
  1749. ```javascript
  1750. var defer = $.Deferred(),
  1751. filtered = defer.pipe( null, function( value ) {
  1752. return value * 3;
  1753. });
  1754. defer.reject( 6 );
  1755. filtered.fail(function( value ) {
  1756. alert( "Value is ( 3*6 = ) 18: " + value );
  1757. });
  1758. ```
  1759. * @example ​ ````Chain tasks:
  1760. ```javascript
  1761. var request = $.ajax( url, { dataType: "json" } ),
  1762. chained = request.pipe(function( data ) {
  1763. return $.ajax( url2, { data: { user: data.userId } } );
  1764. });
  1765. chained.done(function( data ) {
  1766. // data retrieved from url2 as provided by the first request
  1767. });
  1768. ```
  1769. */
  1770. pipe<
  1771. ARF = never,
  1772. AJF = never,
  1773. ANF = never,
  1774. BRF = never,
  1775. BJF = never,
  1776. BNF = never,
  1777. CRF = never,
  1778. CJF = never,
  1779. CNF = never,
  1780. RRF = never,
  1781. RJF = never,
  1782. RNF = never,
  1783. >(
  1784. doneFilter: null,
  1785. failFilter: (
  1786. t: TJ,
  1787. u: UJ,
  1788. v: VJ,
  1789. ...s: SJ[]
  1790. ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<AJF> | AJF,
  1791. progressFilter?: null,
  1792. ): PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF>;
  1793. /**
  1794. * Utility method to filter and/or chain Deferreds.
  1795. * @param doneFilter An optional function that is called when the Deferred is resolved.
  1796. * @param failFilter An optional function that is called when the Deferred is rejected.
  1797. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  1798. * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
  1799. * @since 1.6
  1800. * @since 1.7
  1801. * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
  1802. *
  1803. * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
  1804. *
  1805. * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
  1806. * @example ​ ````Filter resolve value:
  1807. ```javascript
  1808. var defer = $.Deferred(),
  1809. filtered = defer.pipe(function( value ) {
  1810. return value * 2;
  1811. });
  1812. defer.resolve( 5 );
  1813. filtered.done(function( value ) {
  1814. alert( "Value is ( 2*5 = ) 10: " + value );
  1815. });
  1816. ```
  1817. * @example ​ ````Chain tasks:
  1818. ```javascript
  1819. var request = $.ajax( url, { dataType: "json" } ),
  1820. chained = request.pipe(function( data ) {
  1821. return $.ajax( url2, { data: { user: data.userId } } );
  1822. });
  1823. chained.done(function( data ) {
  1824. // data retrieved from url2 as provided by the first request
  1825. });
  1826. ```
  1827. */
  1828. pipe<
  1829. ARD = never,
  1830. AJD = never,
  1831. AND = never,
  1832. BRD = never,
  1833. BJD = never,
  1834. BND = never,
  1835. CRD = never,
  1836. CJD = never,
  1837. CND = never,
  1838. RRD = never,
  1839. RJD = never,
  1840. RND = never,
  1841. >(
  1842. doneFilter: (
  1843. t: TR,
  1844. u: UR,
  1845. v: VR,
  1846. ...s: SR[]
  1847. ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
  1848. failFilter?: null,
  1849. progressFilter?: null,
  1850. ): PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND>;
  1851. // #endregion
  1852. // region then
  1853. // #region then
  1854. /**
  1855. * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
  1856. * @param doneFilter An optional function that is called when the Deferred is resolved.
  1857. * @param failFilter An optional function that is called when the Deferred is rejected.
  1858. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  1859. * @see \`{@link https://api.jquery.com/deferred.then/ }\`
  1860. * @since 1.8
  1861. * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can attach handlers using the .then method.
  1862. ```javascript
  1863. $.get( "test.php" ).then(
  1864. function() {
  1865. alert( "$.get succeeded" );
  1866. }, function() {
  1867. alert( "$.get failed!" );
  1868. }
  1869. );
  1870. ```
  1871. * @example ​ ````Filter the resolve value:
  1872. ```html
  1873. <!doctype html>
  1874. <html lang="en">
  1875. <head>
  1876. <meta charset="utf-8">
  1877. <title>deferred.then demo</title>
  1878. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  1879. </head>
  1880. <body>
  1881. <button>Filter Resolve</button>
  1882. <p></p>
  1883. <script>
  1884. var filterResolve = function() {
  1885. var defer = $.Deferred(),
  1886. filtered = defer.then(function( value ) {
  1887. return value * 2;
  1888. });
  1889. defer.resolve( 5 );
  1890. filtered.done(function( value ) {
  1891. $( "p" ).html( "Value is ( 2*5 = ) 10: " + value );
  1892. });
  1893. };
  1894. $( "button" ).on( "click", filterResolve );
  1895. </script>
  1896. </body>
  1897. </html>
  1898. ```
  1899. * @example ​ ````Filter reject value:
  1900. ```javascript
  1901. var defer = $.Deferred(),
  1902. filtered = defer.then( null, function( value ) {
  1903. return value * 3;
  1904. });
  1905. defer.reject( 6 );
  1906. filtered.fail(function( value ) {
  1907. alert( "Value is ( 3*6 = ) 18: " + value );
  1908. });
  1909. ```
  1910. * @example ​ ````Chain tasks:
  1911. ```javascript
  1912. var request = $.ajax( url, { dataType: "json" } ),
  1913. chained = request.then(function( data ) {
  1914. return $.ajax( url2, { data: { user: data.userId } } );
  1915. });
  1916. chained.done(function( data ) {
  1917. // data retrieved from url2 as provided by the first request
  1918. });
  1919. ```
  1920. */
  1921. then<
  1922. ARD = never,
  1923. AJD = never,
  1924. AND = never,
  1925. BRD = never,
  1926. BJD = never,
  1927. BND = never,
  1928. CRD = never,
  1929. CJD = never,
  1930. CND = never,
  1931. RRD = never,
  1932. RJD = never,
  1933. RND = never,
  1934. ARF = never,
  1935. AJF = never,
  1936. ANF = never,
  1937. BRF = never,
  1938. BJF = never,
  1939. BNF = never,
  1940. CRF = never,
  1941. CJF = never,
  1942. CNF = never,
  1943. RRF = never,
  1944. RJF = never,
  1945. RNF = never,
  1946. ARP = never,
  1947. AJP = never,
  1948. ANP = never,
  1949. BRP = never,
  1950. BJP = never,
  1951. BNP = never,
  1952. CRP = never,
  1953. CJP = never,
  1954. CNP = never,
  1955. RRP = never,
  1956. RJP = never,
  1957. RNP = never,
  1958. >(
  1959. doneFilter: (
  1960. t: TR,
  1961. u: UR,
  1962. v: VR,
  1963. ...s: SR[]
  1964. ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
  1965. failFilter: (
  1966. t: TJ,
  1967. u: UJ,
  1968. v: VJ,
  1969. ...s: SJ[]
  1970. ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF,
  1971. progressFilter: (
  1972. t: TN,
  1973. u: UN,
  1974. v: VN,
  1975. ...s: SN[]
  1976. ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
  1977. ): PromiseBase<
  1978. ARD | ARF | ARP,
  1979. AJD | AJF | AJP,
  1980. AND | ANF | ANP,
  1981. BRD | BRF | BRP,
  1982. BJD | BJF | BJP,
  1983. BND | BNF | BNP,
  1984. CRD | CRF | CRP,
  1985. CJD | CJF | CJP,
  1986. CND | CNF | CNP,
  1987. RRD | RRF | RRP,
  1988. RJD | RJF | RJP,
  1989. RND | RNF | RNP
  1990. >;
  1991. /**
  1992. * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
  1993. * @param doneFilter An optional function that is called when the Deferred is resolved.
  1994. * @param failFilter An optional function that is called when the Deferred is rejected.
  1995. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  1996. * @see \`{@link https://api.jquery.com/deferred.then/ }\`
  1997. * @since 1.8
  1998. * @example ​ ````Filter reject value:
  1999. ```javascript
  2000. var defer = $.Deferred(),
  2001. filtered = defer.then( null, function( value ) {
  2002. return value * 3;
  2003. });
  2004. defer.reject( 6 );
  2005. filtered.fail(function( value ) {
  2006. alert( "Value is ( 3*6 = ) 18: " + value );
  2007. });
  2008. ```
  2009. * @example ​ ````Chain tasks:
  2010. ```javascript
  2011. var request = $.ajax( url, { dataType: "json" } ),
  2012. chained = request.then(function( data ) {
  2013. return $.ajax( url2, { data: { user: data.userId } } );
  2014. });
  2015. chained.done(function( data ) {
  2016. // data retrieved from url2 as provided by the first request
  2017. });
  2018. ```
  2019. */
  2020. then<
  2021. ARF = never,
  2022. AJF = never,
  2023. ANF = never,
  2024. BRF = never,
  2025. BJF = never,
  2026. BNF = never,
  2027. CRF = never,
  2028. CJF = never,
  2029. CNF = never,
  2030. RRF = never,
  2031. RJF = never,
  2032. RNF = never,
  2033. ARP = never,
  2034. AJP = never,
  2035. ANP = never,
  2036. BRP = never,
  2037. BJP = never,
  2038. BNP = never,
  2039. CRP = never,
  2040. CJP = never,
  2041. CNP = never,
  2042. RRP = never,
  2043. RJP = never,
  2044. RNP = never,
  2045. >(
  2046. doneFilter: null,
  2047. failFilter: (
  2048. t: TJ,
  2049. u: UJ,
  2050. v: VJ,
  2051. ...s: SJ[]
  2052. ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF,
  2053. progressFilter: (
  2054. t: TN,
  2055. u: UN,
  2056. v: VN,
  2057. ...s: SN[]
  2058. ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
  2059. ): PromiseBase<
  2060. ARF | ARP,
  2061. AJF | AJP,
  2062. ANF | ANP,
  2063. BRF | BRP,
  2064. BJF | BJP,
  2065. BNF | BNP,
  2066. CRF | CRP,
  2067. CJF | CJP,
  2068. CNF | CNP,
  2069. RRF | RRP,
  2070. RJF | RJP,
  2071. RNF | RNP
  2072. >;
  2073. /**
  2074. * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
  2075. * @param doneFilter An optional function that is called when the Deferred is resolved.
  2076. * @param failFilter An optional function that is called when the Deferred is rejected.
  2077. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  2078. * @see \`{@link https://api.jquery.com/deferred.then/ }\`
  2079. * @since 1.8
  2080. * @example ​ ````Filter the resolve value:
  2081. ```html
  2082. <!doctype html>
  2083. <html lang="en">
  2084. <head>
  2085. <meta charset="utf-8">
  2086. <title>deferred.then demo</title>
  2087. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  2088. </head>
  2089. <body>
  2090. <button>Filter Resolve</button>
  2091. <p></p>
  2092. <script>
  2093. var filterResolve = function() {
  2094. var defer = $.Deferred(),
  2095. filtered = defer.then(function( value ) {
  2096. return value * 2;
  2097. });
  2098. defer.resolve( 5 );
  2099. filtered.done(function( value ) {
  2100. $( "p" ).html( "Value is ( 2*5 = ) 10: " + value );
  2101. });
  2102. };
  2103. $( "button" ).on( "click", filterResolve );
  2104. </script>
  2105. </body>
  2106. </html>
  2107. ```
  2108. * @example ​ ````Chain tasks:
  2109. ```javascript
  2110. var request = $.ajax( url, { dataType: "json" } ),
  2111. chained = request.then(function( data ) {
  2112. return $.ajax( url2, { data: { user: data.userId } } );
  2113. });
  2114. chained.done(function( data ) {
  2115. // data retrieved from url2 as provided by the first request
  2116. });
  2117. ```
  2118. */
  2119. then<
  2120. ARD = never,
  2121. AJD = never,
  2122. AND = never,
  2123. BRD = never,
  2124. BJD = never,
  2125. BND = never,
  2126. CRD = never,
  2127. CJD = never,
  2128. CND = never,
  2129. RRD = never,
  2130. RJD = never,
  2131. RND = never,
  2132. ARP = never,
  2133. AJP = never,
  2134. ANP = never,
  2135. BRP = never,
  2136. BJP = never,
  2137. BNP = never,
  2138. CRP = never,
  2139. CJP = never,
  2140. CNP = never,
  2141. RRP = never,
  2142. RJP = never,
  2143. RNP = never,
  2144. >(
  2145. doneFilter: (
  2146. t: TR,
  2147. u: UR,
  2148. v: VR,
  2149. ...s: SR[]
  2150. ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
  2151. failFilter: null,
  2152. progressFilter: (
  2153. t: TN,
  2154. u: UN,
  2155. v: VN,
  2156. ...s: SN[]
  2157. ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
  2158. ): PromiseBase<
  2159. ARD | ARP,
  2160. AJD | AJP,
  2161. AND | ANP,
  2162. BRD | BRP,
  2163. BJD | BJP,
  2164. BND | BNP,
  2165. CRD | CRP,
  2166. CJD | CJP,
  2167. CND | CNP,
  2168. RRD | RRP,
  2169. RJD | RJP,
  2170. RND | RNP
  2171. >;
  2172. /**
  2173. * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
  2174. * @param doneFilter An optional function that is called when the Deferred is resolved.
  2175. * @param failFilter An optional function that is called when the Deferred is rejected.
  2176. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  2177. * @see \`{@link https://api.jquery.com/deferred.then/ }\`
  2178. * @since 1.8
  2179. * @example ​ ````Chain tasks:
  2180. ```javascript
  2181. var request = $.ajax( url, { dataType: "json" } ),
  2182. chained = request.then(function( data ) {
  2183. return $.ajax( url2, { data: { user: data.userId } } );
  2184. });
  2185. chained.done(function( data ) {
  2186. // data retrieved from url2 as provided by the first request
  2187. });
  2188. ```
  2189. */
  2190. then<
  2191. ARP = never,
  2192. AJP = never,
  2193. ANP = never,
  2194. BRP = never,
  2195. BJP = never,
  2196. BNP = never,
  2197. CRP = never,
  2198. CJP = never,
  2199. CNP = never,
  2200. RRP = never,
  2201. RJP = never,
  2202. RNP = never,
  2203. >(
  2204. doneFilter: null,
  2205. failFilter: null,
  2206. progressFilter?: (
  2207. t: TN,
  2208. u: UN,
  2209. v: VN,
  2210. ...s: SN[]
  2211. ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
  2212. ): PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP>;
  2213. /**
  2214. * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
  2215. * @param doneFilter An optional function that is called when the Deferred is resolved.
  2216. * @param failFilter An optional function that is called when the Deferred is rejected.
  2217. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  2218. * @see \`{@link https://api.jquery.com/deferred.then/ }\`
  2219. * @since 1.8
  2220. * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can attach handlers using the .then method.
  2221. ```javascript
  2222. $.get( "test.php" ).then(
  2223. function() {
  2224. alert( "$.get succeeded" );
  2225. }, function() {
  2226. alert( "$.get failed!" );
  2227. }
  2228. );
  2229. ```
  2230. * @example ​ ````Filter the resolve value:
  2231. ```html
  2232. <!doctype html>
  2233. <html lang="en">
  2234. <head>
  2235. <meta charset="utf-8">
  2236. <title>deferred.then demo</title>
  2237. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  2238. </head>
  2239. <body>
  2240. <button>Filter Resolve</button>
  2241. <p></p>
  2242. <script>
  2243. var filterResolve = function() {
  2244. var defer = $.Deferred(),
  2245. filtered = defer.then(function( value ) {
  2246. return value * 2;
  2247. });
  2248. defer.resolve( 5 );
  2249. filtered.done(function( value ) {
  2250. $( "p" ).html( "Value is ( 2*5 = ) 10: " + value );
  2251. });
  2252. };
  2253. $( "button" ).on( "click", filterResolve );
  2254. </script>
  2255. </body>
  2256. </html>
  2257. ```
  2258. * @example ​ ````Filter reject value:
  2259. ```javascript
  2260. var defer = $.Deferred(),
  2261. filtered = defer.then( null, function( value ) {
  2262. return value * 3;
  2263. });
  2264. defer.reject( 6 );
  2265. filtered.fail(function( value ) {
  2266. alert( "Value is ( 3*6 = ) 18: " + value );
  2267. });
  2268. ```
  2269. * @example ​ ````Chain tasks:
  2270. ```javascript
  2271. var request = $.ajax( url, { dataType: "json" } ),
  2272. chained = request.then(function( data ) {
  2273. return $.ajax( url2, { data: { user: data.userId } } );
  2274. });
  2275. chained.done(function( data ) {
  2276. // data retrieved from url2 as provided by the first request
  2277. });
  2278. ```
  2279. */
  2280. then<
  2281. ARD = never,
  2282. AJD = never,
  2283. AND = never,
  2284. BRD = never,
  2285. BJD = never,
  2286. BND = never,
  2287. CRD = never,
  2288. CJD = never,
  2289. CND = never,
  2290. RRD = never,
  2291. RJD = never,
  2292. RND = never,
  2293. ARF = never,
  2294. AJF = never,
  2295. ANF = never,
  2296. BRF = never,
  2297. BJF = never,
  2298. BNF = never,
  2299. CRF = never,
  2300. CJF = never,
  2301. CNF = never,
  2302. RRF = never,
  2303. RJF = never,
  2304. RNF = never,
  2305. >(
  2306. doneFilter: (
  2307. t: TR,
  2308. u: UR,
  2309. v: VR,
  2310. ...s: SR[]
  2311. ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
  2312. failFilter: (
  2313. t: TJ,
  2314. u: UJ,
  2315. v: VJ,
  2316. ...s: SJ[]
  2317. ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF,
  2318. progressFilter?: null,
  2319. ): PromiseBase<
  2320. ARD | ARF,
  2321. AJD | AJF,
  2322. AND | ANF,
  2323. BRD | BRF,
  2324. BJD | BJF,
  2325. BND | BNF,
  2326. CRD | CRF,
  2327. CJD | CJF,
  2328. CND | CNF,
  2329. RRD | RRF,
  2330. RJD | RJF,
  2331. RND | RNF
  2332. >;
  2333. /**
  2334. * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
  2335. * @param doneFilter An optional function that is called when the Deferred is resolved.
  2336. * @param failFilter An optional function that is called when the Deferred is rejected.
  2337. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  2338. * @see \`{@link https://api.jquery.com/deferred.then/ }\`
  2339. * @since 1.8
  2340. * @example ​ ````Filter reject value:
  2341. ```javascript
  2342. var defer = $.Deferred(),
  2343. filtered = defer.then( null, function( value ) {
  2344. return value * 3;
  2345. });
  2346. defer.reject( 6 );
  2347. filtered.fail(function( value ) {
  2348. alert( "Value is ( 3*6 = ) 18: " + value );
  2349. });
  2350. ```
  2351. * @example ​ ````Chain tasks:
  2352. ```javascript
  2353. var request = $.ajax( url, { dataType: "json" } ),
  2354. chained = request.then(function( data ) {
  2355. return $.ajax( url2, { data: { user: data.userId } } );
  2356. });
  2357. chained.done(function( data ) {
  2358. // data retrieved from url2 as provided by the first request
  2359. });
  2360. ```
  2361. */
  2362. then<
  2363. ARF = never,
  2364. AJF = never,
  2365. ANF = never,
  2366. BRF = never,
  2367. BJF = never,
  2368. BNF = never,
  2369. CRF = never,
  2370. CJF = never,
  2371. CNF = never,
  2372. RRF = never,
  2373. RJF = never,
  2374. RNF = never,
  2375. >(
  2376. doneFilter: null,
  2377. failFilter: (
  2378. t: TJ,
  2379. u: UJ,
  2380. v: VJ,
  2381. ...s: SJ[]
  2382. ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF,
  2383. progressFilter?: null,
  2384. ): PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF>;
  2385. /**
  2386. * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
  2387. * @param doneFilter An optional function that is called when the Deferred is resolved.
  2388. * @param failFilter An optional function that is called when the Deferred is rejected.
  2389. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  2390. * @see \`{@link https://api.jquery.com/deferred.then/ }\`
  2391. * @since 1.8
  2392. * @example ​ ````Filter the resolve value:
  2393. ```html
  2394. <!doctype html>
  2395. <html lang="en">
  2396. <head>
  2397. <meta charset="utf-8">
  2398. <title>deferred.then demo</title>
  2399. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  2400. </head>
  2401. <body>
  2402. <button>Filter Resolve</button>
  2403. <p></p>
  2404. <script>
  2405. var filterResolve = function() {
  2406. var defer = $.Deferred(),
  2407. filtered = defer.then(function( value ) {
  2408. return value * 2;
  2409. });
  2410. defer.resolve( 5 );
  2411. filtered.done(function( value ) {
  2412. $( "p" ).html( "Value is ( 2*5 = ) 10: " + value );
  2413. });
  2414. };
  2415. $( "button" ).on( "click", filterResolve );
  2416. </script>
  2417. </body>
  2418. </html>
  2419. ```
  2420. * @example ​ ````Chain tasks:
  2421. ```javascript
  2422. var request = $.ajax( url, { dataType: "json" } ),
  2423. chained = request.then(function( data ) {
  2424. return $.ajax( url2, { data: { user: data.userId } } );
  2425. });
  2426. chained.done(function( data ) {
  2427. // data retrieved from url2 as provided by the first request
  2428. });
  2429. ```
  2430. */
  2431. then<
  2432. ARD = never,
  2433. AJD = never,
  2434. AND = never,
  2435. BRD = never,
  2436. BJD = never,
  2437. BND = never,
  2438. CRD = never,
  2439. CJD = never,
  2440. CND = never,
  2441. RRD = never,
  2442. RJD = never,
  2443. RND = never,
  2444. >(
  2445. doneFilter: (
  2446. t: TR,
  2447. u: UR,
  2448. v: VR,
  2449. ...s: SR[]
  2450. ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
  2451. failFilter?: null,
  2452. progressFilter?: null,
  2453. ): PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND>;
  2454. // #endregion
  2455. /**
  2456. * Add handlers to be called when the Deferred object is rejected.
  2457. * @param failFilter A function that is called when the Deferred is rejected.
  2458. * @see \`{@link https://api.jquery.com/deferred.catch/ }\`
  2459. * @since 3.0
  2460. * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can rejection handlers using the .catch method.
  2461. ```javascript
  2462. $.get( "test.php" )
  2463. .then( function() {
  2464. alert( "$.get succeeded" );
  2465. } )
  2466. .catch( function() {
  2467. alert( "$.get failed!" );
  2468. } );
  2469. ```
  2470. */
  2471. catch<
  2472. ARF = never,
  2473. AJF = never,
  2474. ANF = never,
  2475. BRF = never,
  2476. BJF = never,
  2477. BNF = never,
  2478. CRF = never,
  2479. CJF = never,
  2480. CNF = never,
  2481. RRF = never,
  2482. RJF = never,
  2483. RNF = never,
  2484. >(
  2485. failFilter?:
  2486. | ((
  2487. t: TJ,
  2488. u: UJ,
  2489. v: VJ,
  2490. ...s: SJ[]
  2491. ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF)
  2492. | null,
  2493. ): PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF>;
  2494. }
  2495. /**
  2496. * This object provides a subset of the methods of the Deferred object (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred.
  2497. * @see \`{@link https://api.jquery.com/Types/#Promise }\`
  2498. */
  2499. interface Promise3<TR, TJ, TN, UR, UJ, UN, VR, VJ, VN>
  2500. extends PromiseBase<TR, TJ, TN, UR, UJ, UN, VR, VJ, VN, never, never, never>
  2501. {}
  2502. /**
  2503. * This object provides a subset of the methods of the Deferred object (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred.
  2504. * @see \`{@link https://api.jquery.com/Types/#Promise }\`
  2505. */
  2506. interface Promise2<TR, TJ, TN, UR, UJ, UN>
  2507. extends PromiseBase<TR, TJ, TN, UR, UJ, UN, never, never, never, never, never, never>
  2508. {}
  2509. /**
  2510. * This object provides a subset of the methods of the Deferred object (then, done, fail, always, pipe, progress, state and promise) to prevent users from changing the state of the Deferred.
  2511. * @see \`{@link https://api.jquery.com/Types/#Promise }\`
  2512. */
  2513. interface Promise<TR, TJ = any, TN = any> extends PromiseBase<TR, TJ, TN, TR, TJ, TN, TR, TJ, TN, TR, TJ, TN> {}
  2514. interface DeferredStatic {
  2515. // https://jquery.com/upgrade-guide/3.0/#callback-exit
  2516. exceptionHook: any;
  2517. /**
  2518. * A factory function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function.
  2519. * @param beforeStart A function that is called just before the constructor returns.
  2520. * @see \`{@link https://api.jquery.com/jQuery.Deferred/ }\`
  2521. * @since 1.5
  2522. */
  2523. <TR = any, TJ = any, TN = any>(
  2524. beforeStart?: (this: Deferred<TR, TJ, TN>, deferred: Deferred<TR, TJ, TN>) => void,
  2525. ): Deferred<TR, TJ, TN>;
  2526. }
  2527. interface Deferred<TR, TJ = any, TN = any> {
  2528. /**
  2529. * Call the progressCallbacks on a Deferred object with the given args.
  2530. * @param args Optional arguments that are passed to the progressCallbacks.
  2531. * @see \`{@link https://api.jquery.com/deferred.notify/ }\`
  2532. * @since 1.7
  2533. */
  2534. notify(...args: TN[]): this;
  2535. /**
  2536. * Call the progressCallbacks on a Deferred object with the given context and args.
  2537. * @param context Context passed to the progressCallbacks as the this object.
  2538. * @param args An optional array of arguments that are passed to the progressCallbacks.
  2539. * @see \`{@link https://api.jquery.com/deferred.notifyWith/ }\`
  2540. * @since 1.7
  2541. */
  2542. notifyWith(context: object, args?: ArrayLike<TN>): this;
  2543. /**
  2544. * Reject a Deferred object and call any failCallbacks with the given args.
  2545. * @param args Optional arguments that are passed to the failCallbacks.
  2546. * @see \`{@link https://api.jquery.com/deferred.reject/ }\`
  2547. * @since 1.5
  2548. */
  2549. reject(...args: TJ[]): this;
  2550. /**
  2551. * Reject a Deferred object and call any failCallbacks with the given context and args.
  2552. * @param context Context passed to the failCallbacks as the this object.
  2553. * @param args An optional array of arguments that are passed to the failCallbacks.
  2554. * @see \`{@link https://api.jquery.com/deferred.rejectWith/ }\`
  2555. * @since 1.5
  2556. */
  2557. rejectWith(context: object, args?: ArrayLike<TJ>): this;
  2558. /**
  2559. * Resolve a Deferred object and call any doneCallbacks with the given args.
  2560. * @param args Optional arguments that are passed to the doneCallbacks.
  2561. * @see \`{@link https://api.jquery.com/deferred.resolve/ }\`
  2562. * @since 1.5
  2563. */
  2564. resolve(...args: TR[]): this;
  2565. /**
  2566. * Resolve a Deferred object and call any doneCallbacks with the given context and args.
  2567. * @param context Context passed to the doneCallbacks as the this object.
  2568. * @param args An optional array of arguments that are passed to the doneCallbacks.
  2569. * @see \`{@link https://api.jquery.com/deferred.resolveWith/ }\`
  2570. * @since 1.5
  2571. */
  2572. resolveWith(context: object, args?: ArrayLike<TR>): this;
  2573. /**
  2574. * Add handlers to be called when the Deferred object is either resolved or rejected.
  2575. * @param alwaysCallback A function, or array of functions, that is called when the Deferred is resolved or rejected.
  2576. * @param alwaysCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected.
  2577. * @see \`{@link https://api.jquery.com/deferred.always/ }\`
  2578. * @since 1.6
  2579. * @example ​ ````Since the jQuery.get() method returns a jqXHR object, which is derived from a Deferred object, we can attach a callback for both success and error using the deferred.always() method.
  2580. ```javascript
  2581. $.get( "test.php" ).always(function() {
  2582. alert( "$.get completed with success or error callback arguments" );
  2583. });
  2584. ```
  2585. */
  2586. always(
  2587. alwaysCallback: TypeOrArray<Deferred.Callback<TR | TJ>>,
  2588. ...alwaysCallbacks: Array<TypeOrArray<Deferred.Callback<TR | TJ>>>
  2589. ): this;
  2590. /**
  2591. * Add handlers to be called when the Deferred object is resolved.
  2592. * @param doneCallback A function, or array of functions, that are called when the Deferred is resolved.
  2593. * @param doneCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is resolved.
  2594. * @see \`{@link https://api.jquery.com/deferred.done/ }\`
  2595. * @since 1.5
  2596. * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can attach a success callback using the .done() method.
  2597. ```javascript
  2598. $.get( "test.php" ).done(function() {
  2599. alert( "$.get succeeded" );
  2600. });
  2601. ```
  2602. * @example ​ ````Resolve a Deferred object when the user clicks a button, triggering a number of callback functions:
  2603. ```html
  2604. <!doctype html>
  2605. <html lang="en">
  2606. <head>
  2607. <meta charset="utf-8">
  2608. <title>deferred.done demo</title>
  2609. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  2610. </head>
  2611. <body>
  2612. <button>Go</button>
  2613. <p>Ready...</p>
  2614. <script>
  2615. // 3 functions to call when the Deferred object is resolved
  2616. function fn1() {
  2617. $( "p" ).append( " 1 " );
  2618. }
  2619. function fn2() {
  2620. $( "p" ).append( " 2 " );
  2621. }
  2622. function fn3( n ) {
  2623. $( "p" ).append( n + " 3 " + n );
  2624. }
  2625. // Create a deferred object
  2626. var dfd = $.Deferred();
  2627. // Add handlers to be called when dfd is resolved
  2628. dfd
  2629. // .done() can take any number of functions or arrays of functions
  2630. .done( [ fn1, fn2 ], fn3, [ fn2, fn1 ] )
  2631. // We can chain done methods, too
  2632. .done(function( n ) {
  2633. $( "p" ).append( n + " we're done." );
  2634. });
  2635. // Resolve the Deferred object when the button is clicked
  2636. $( "button" ).on( "click", function() {
  2637. dfd.resolve( "and" );
  2638. });
  2639. </script>
  2640. </body>
  2641. </html>
  2642. ```
  2643. */
  2644. done(
  2645. doneCallback: TypeOrArray<Deferred.Callback<TR>>,
  2646. ...doneCallbacks: Array<TypeOrArray<Deferred.Callback<TR>>>
  2647. ): this;
  2648. /**
  2649. * Add handlers to be called when the Deferred object is rejected.
  2650. * @param failCallback A function, or array of functions, that are called when the Deferred is rejected.
  2651. * @param failCallbacks Optional additional functions, or arrays of functions, that are called when the Deferred is rejected.
  2652. * @see \`{@link https://api.jquery.com/deferred.fail/ }\`
  2653. * @since 1.5
  2654. * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred, you can attach a success and failure callback using the deferred.done() and deferred.fail() methods.
  2655. ```javascript
  2656. $.get( "test.php" )
  2657. .done(function() {
  2658. alert( "$.get succeeded" );
  2659. })
  2660. .fail(function() {
  2661. alert( "$.get failed!" );
  2662. });
  2663. ```
  2664. */
  2665. fail(
  2666. failCallback: TypeOrArray<Deferred.Callback<TJ>>,
  2667. ...failCallbacks: Array<TypeOrArray<Deferred.Callback<TJ>>>
  2668. ): this;
  2669. /**
  2670. * Add handlers to be called when the Deferred object generates progress notifications.
  2671. * @param progressCallback A function, or array of functions, to be called when the Deferred generates progress notifications.
  2672. * @param progressCallbacks Optional additional functions, or arrays of functions, to be called when the Deferred generates
  2673. * progress notifications.
  2674. * @see \`{@link https://api.jquery.com/deferred.progress/ }\`
  2675. * @since 1.7
  2676. */
  2677. progress(
  2678. progressCallback: TypeOrArray<Deferred.Callback<TN>>,
  2679. ...progressCallbacks: Array<TypeOrArray<Deferred.Callback<TN>>>
  2680. ): this;
  2681. /**
  2682. * Return a Deferred's Promise object.
  2683. * @param target Object onto which the promise methods have to be attached
  2684. * @see \`{@link https://api.jquery.com/deferred.promise/ }\`
  2685. * @since 1.5
  2686. * @example ​ ````Use the target argument to promote an existing object to a Promise:
  2687. ```javascript
  2688. // Existing object
  2689. var obj = {
  2690. hello: function( name ) {
  2691. alert( "Hello " + name );
  2692. }
  2693. },
  2694. // Create a Deferred
  2695. defer = $.Deferred();
  2696. // Set object as a promise
  2697. defer.promise( obj );
  2698. // Resolve the deferred
  2699. defer.resolve( "John" );
  2700. // Use the object as a Promise
  2701. obj.done(function( name ) {
  2702. obj.hello( name ); // Will alert "Hello John"
  2703. }).hello( "Karl" ); // Will alert "Hello Karl"
  2704. ```
  2705. */
  2706. promise<TTarget extends object>(target: TTarget): Promise<TR, TJ, TN> & TTarget;
  2707. /**
  2708. * Return a Deferred's Promise object.
  2709. * @see \`{@link https://api.jquery.com/deferred.promise/ }\`
  2710. * @since 1.5
  2711. * @example ​ ````Create a Deferred and set two timer-based functions to either resolve or reject the Deferred after a random interval. Whichever one fires first &quot;wins&quot; and will call one of the callbacks. The second timeout has no effect since the Deferred is already complete (in a resolved or rejected state) from the first timeout action. Also set a timer-based progress notification function, and call a progress handler that adds &quot;working...&quot; to the document body.
  2712. ```javascript
  2713. function asyncEvent() {
  2714. var dfd = jQuery.Deferred();
  2715. // Resolve after a random interval
  2716. setTimeout(function() {
  2717. dfd.resolve( "hurray" );
  2718. }, Math.floor( 400 + Math.random() * 2000 ) );
  2719. // Reject after a random interval
  2720. setTimeout(function() {
  2721. dfd.reject( "sorry" );
  2722. }, Math.floor( 400 + Math.random() * 2000 ) );
  2723. // Show a "working..." message every half-second
  2724. setTimeout(function working() {
  2725. if ( dfd.state() === "pending" ) {
  2726. dfd.notify( "working... " );
  2727. setTimeout( working, 500 );
  2728. }
  2729. }, 1 );
  2730. // Return the Promise so caller can't change the Deferred
  2731. return dfd.promise();
  2732. }
  2733. // Attach a done, fail, and progress handler for the asyncEvent
  2734. $.when( asyncEvent() ).then(
  2735. function( status ) {
  2736. alert( status + ", things are going well" );
  2737. },
  2738. function( status ) {
  2739. alert( status + ", you fail this time" );
  2740. },
  2741. function( status ) {
  2742. $( "body" ).append( status );
  2743. }
  2744. );
  2745. ```
  2746. */
  2747. promise(): Promise<TR, TJ, TN>;
  2748. /**
  2749. * Determine the current state of a Deferred object.
  2750. * @see \`{@link https://api.jquery.com/deferred.state/ }\`
  2751. * @since 1.7
  2752. */
  2753. state(): "pending" | "resolved" | "rejected";
  2754. // region pipe
  2755. // #region pipe
  2756. /**
  2757. * Utility method to filter and/or chain Deferreds.
  2758. * @param doneFilter An optional function that is called when the Deferred is resolved.
  2759. * @param failFilter An optional function that is called when the Deferred is rejected.
  2760. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  2761. * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
  2762. * @since 1.6
  2763. * @since 1.7
  2764. * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
  2765. *
  2766. * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
  2767. *
  2768. * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
  2769. * @example ​ ````Filter resolve value:
  2770. ```javascript
  2771. var defer = $.Deferred(),
  2772. filtered = defer.pipe(function( value ) {
  2773. return value * 2;
  2774. });
  2775. defer.resolve( 5 );
  2776. filtered.done(function( value ) {
  2777. alert( "Value is ( 2*5 = ) 10: " + value );
  2778. });
  2779. ```
  2780. * @example ​ ````Filter reject value:
  2781. ```javascript
  2782. var defer = $.Deferred(),
  2783. filtered = defer.pipe( null, function( value ) {
  2784. return value * 3;
  2785. });
  2786. defer.reject( 6 );
  2787. filtered.fail(function( value ) {
  2788. alert( "Value is ( 3*6 = ) 18: " + value );
  2789. });
  2790. ```
  2791. * @example ​ ````Chain tasks:
  2792. ```javascript
  2793. var request = $.ajax( url, { dataType: "json" } ),
  2794. chained = request.pipe(function( data ) {
  2795. return $.ajax( url2, { data: { user: data.userId } } );
  2796. });
  2797. chained.done(function( data ) {
  2798. // data retrieved from url2 as provided by the first request
  2799. });
  2800. ```
  2801. */
  2802. pipe<
  2803. ARD = never,
  2804. AJD = never,
  2805. AND = never,
  2806. BRD = never,
  2807. BJD = never,
  2808. BND = never,
  2809. CRD = never,
  2810. CJD = never,
  2811. CND = never,
  2812. RRD = never,
  2813. RJD = never,
  2814. RND = never,
  2815. ARF = never,
  2816. AJF = never,
  2817. ANF = never,
  2818. BRF = never,
  2819. BJF = never,
  2820. BNF = never,
  2821. CRF = never,
  2822. CJF = never,
  2823. CNF = never,
  2824. RRF = never,
  2825. RJF = never,
  2826. RNF = never,
  2827. ARP = never,
  2828. AJP = never,
  2829. ANP = never,
  2830. BRP = never,
  2831. BJP = never,
  2832. BNP = never,
  2833. CRP = never,
  2834. CJP = never,
  2835. CNP = never,
  2836. RRP = never,
  2837. RJP = never,
  2838. RNP = never,
  2839. >(
  2840. doneFilter: (
  2841. ...t: TR[]
  2842. ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
  2843. failFilter: (
  2844. ...t: TJ[]
  2845. ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<AJF> | AJF,
  2846. progressFilter: (
  2847. ...t: TN[]
  2848. ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
  2849. ): PromiseBase<
  2850. ARD | ARF | ARP,
  2851. AJD | AJF | AJP,
  2852. AND | ANF | ANP,
  2853. BRD | BRF | BRP,
  2854. BJD | BJF | BJP,
  2855. BND | BNF | BNP,
  2856. CRD | CRF | CRP,
  2857. CJD | CJF | CJP,
  2858. CND | CNF | CNP,
  2859. RRD | RRF | RRP,
  2860. RJD | RJF | RJP,
  2861. RND | RNF | RNP
  2862. >;
  2863. /**
  2864. * Utility method to filter and/or chain Deferreds.
  2865. * @param doneFilter An optional function that is called when the Deferred is resolved.
  2866. * @param failFilter An optional function that is called when the Deferred is rejected.
  2867. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  2868. * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
  2869. * @since 1.6
  2870. * @since 1.7
  2871. * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
  2872. *
  2873. * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
  2874. *
  2875. * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
  2876. * @example ​ ````Filter reject value:
  2877. ```javascript
  2878. var defer = $.Deferred(),
  2879. filtered = defer.pipe( null, function( value ) {
  2880. return value * 3;
  2881. });
  2882. defer.reject( 6 );
  2883. filtered.fail(function( value ) {
  2884. alert( "Value is ( 3*6 = ) 18: " + value );
  2885. });
  2886. ```
  2887. * @example ​ ````Chain tasks:
  2888. ```javascript
  2889. var request = $.ajax( url, { dataType: "json" } ),
  2890. chained = request.pipe(function( data ) {
  2891. return $.ajax( url2, { data: { user: data.userId } } );
  2892. });
  2893. chained.done(function( data ) {
  2894. // data retrieved from url2 as provided by the first request
  2895. });
  2896. ```
  2897. */
  2898. pipe<
  2899. ARF = never,
  2900. AJF = never,
  2901. ANF = never,
  2902. BRF = never,
  2903. BJF = never,
  2904. BNF = never,
  2905. CRF = never,
  2906. CJF = never,
  2907. CNF = never,
  2908. RRF = never,
  2909. RJF = never,
  2910. RNF = never,
  2911. ARP = never,
  2912. AJP = never,
  2913. ANP = never,
  2914. BRP = never,
  2915. BJP = never,
  2916. BNP = never,
  2917. CRP = never,
  2918. CJP = never,
  2919. CNP = never,
  2920. RRP = never,
  2921. RJP = never,
  2922. RNP = never,
  2923. >(
  2924. doneFilter: null,
  2925. failFilter: (
  2926. ...t: TJ[]
  2927. ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<AJF> | AJF,
  2928. progressFilter: (
  2929. ...t: TN[]
  2930. ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
  2931. ): PromiseBase<
  2932. ARF | ARP,
  2933. AJF | AJP,
  2934. ANF | ANP,
  2935. BRF | BRP,
  2936. BJF | BJP,
  2937. BNF | BNP,
  2938. CRF | CRP,
  2939. CJF | CJP,
  2940. CNF | CNP,
  2941. RRF | RRP,
  2942. RJF | RJP,
  2943. RNF | RNP
  2944. >;
  2945. /**
  2946. * Utility method to filter and/or chain Deferreds.
  2947. * @param doneFilter An optional function that is called when the Deferred is resolved.
  2948. * @param failFilter An optional function that is called when the Deferred is rejected.
  2949. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  2950. * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
  2951. * @since 1.6
  2952. * @since 1.7
  2953. * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
  2954. *
  2955. * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
  2956. *
  2957. * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
  2958. * @example ​ ````Filter resolve value:
  2959. ```javascript
  2960. var defer = $.Deferred(),
  2961. filtered = defer.pipe(function( value ) {
  2962. return value * 2;
  2963. });
  2964. defer.resolve( 5 );
  2965. filtered.done(function( value ) {
  2966. alert( "Value is ( 2*5 = ) 10: " + value );
  2967. });
  2968. ```
  2969. * @example ​ ````Chain tasks:
  2970. ```javascript
  2971. var request = $.ajax( url, { dataType: "json" } ),
  2972. chained = request.pipe(function( data ) {
  2973. return $.ajax( url2, { data: { user: data.userId } } );
  2974. });
  2975. chained.done(function( data ) {
  2976. // data retrieved from url2 as provided by the first request
  2977. });
  2978. ```
  2979. */
  2980. pipe<
  2981. ARD = never,
  2982. AJD = never,
  2983. AND = never,
  2984. BRD = never,
  2985. BJD = never,
  2986. BND = never,
  2987. CRD = never,
  2988. CJD = never,
  2989. CND = never,
  2990. RRD = never,
  2991. RJD = never,
  2992. RND = never,
  2993. ARP = never,
  2994. AJP = never,
  2995. ANP = never,
  2996. BRP = never,
  2997. BJP = never,
  2998. BNP = never,
  2999. CRP = never,
  3000. CJP = never,
  3001. CNP = never,
  3002. RRP = never,
  3003. RJP = never,
  3004. RNP = never,
  3005. >(
  3006. doneFilter: (
  3007. ...t: TR[]
  3008. ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
  3009. failFilter: null,
  3010. progressFilter: (
  3011. ...t: TN[]
  3012. ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
  3013. ): PromiseBase<
  3014. ARD | ARP,
  3015. AJD | AJP,
  3016. AND | ANP,
  3017. BRD | BRP,
  3018. BJD | BJP,
  3019. BND | BNP,
  3020. CRD | CRP,
  3021. CJD | CJP,
  3022. CND | CNP,
  3023. RRD | RRP,
  3024. RJD | RJP,
  3025. RND | RNP
  3026. >;
  3027. /**
  3028. * Utility method to filter and/or chain Deferreds.
  3029. * @param doneFilter An optional function that is called when the Deferred is resolved.
  3030. * @param failFilter An optional function that is called when the Deferred is rejected.
  3031. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  3032. * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
  3033. * @since 1.6
  3034. * @since 1.7
  3035. * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
  3036. *
  3037. * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
  3038. *
  3039. * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
  3040. * @example ​ ````Chain tasks:
  3041. ```javascript
  3042. var request = $.ajax( url, { dataType: "json" } ),
  3043. chained = request.pipe(function( data ) {
  3044. return $.ajax( url2, { data: { user: data.userId } } );
  3045. });
  3046. chained.done(function( data ) {
  3047. // data retrieved from url2 as provided by the first request
  3048. });
  3049. ```
  3050. */
  3051. pipe<
  3052. ARP = never,
  3053. AJP = never,
  3054. ANP = never,
  3055. BRP = never,
  3056. BJP = never,
  3057. BNP = never,
  3058. CRP = never,
  3059. CJP = never,
  3060. CNP = never,
  3061. RRP = never,
  3062. RJP = never,
  3063. RNP = never,
  3064. >(
  3065. doneFilter: null,
  3066. failFilter: null,
  3067. progressFilter?: (
  3068. ...t: TN[]
  3069. ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
  3070. ): PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP>;
  3071. /**
  3072. * Utility method to filter and/or chain Deferreds.
  3073. * @param doneFilter An optional function that is called when the Deferred is resolved.
  3074. * @param failFilter An optional function that is called when the Deferred is rejected.
  3075. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  3076. * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
  3077. * @since 1.6
  3078. * @since 1.7
  3079. * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
  3080. *
  3081. * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
  3082. *
  3083. * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
  3084. * @example ​ ````Filter resolve value:
  3085. ```javascript
  3086. var defer = $.Deferred(),
  3087. filtered = defer.pipe(function( value ) {
  3088. return value * 2;
  3089. });
  3090. defer.resolve( 5 );
  3091. filtered.done(function( value ) {
  3092. alert( "Value is ( 2*5 = ) 10: " + value );
  3093. });
  3094. ```
  3095. * @example ​ ````Filter reject value:
  3096. ```javascript
  3097. var defer = $.Deferred(),
  3098. filtered = defer.pipe( null, function( value ) {
  3099. return value * 3;
  3100. });
  3101. defer.reject( 6 );
  3102. filtered.fail(function( value ) {
  3103. alert( "Value is ( 3*6 = ) 18: " + value );
  3104. });
  3105. ```
  3106. * @example ​ ````Chain tasks:
  3107. ```javascript
  3108. var request = $.ajax( url, { dataType: "json" } ),
  3109. chained = request.pipe(function( data ) {
  3110. return $.ajax( url2, { data: { user: data.userId } } );
  3111. });
  3112. chained.done(function( data ) {
  3113. // data retrieved from url2 as provided by the first request
  3114. });
  3115. ```
  3116. */
  3117. pipe<
  3118. ARD = never,
  3119. AJD = never,
  3120. AND = never,
  3121. BRD = never,
  3122. BJD = never,
  3123. BND = never,
  3124. CRD = never,
  3125. CJD = never,
  3126. CND = never,
  3127. RRD = never,
  3128. RJD = never,
  3129. RND = never,
  3130. ARF = never,
  3131. AJF = never,
  3132. ANF = never,
  3133. BRF = never,
  3134. BJF = never,
  3135. BNF = never,
  3136. CRF = never,
  3137. CJF = never,
  3138. CNF = never,
  3139. RRF = never,
  3140. RJF = never,
  3141. RNF = never,
  3142. >(
  3143. doneFilter: (
  3144. ...t: TR[]
  3145. ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
  3146. failFilter: (
  3147. ...t: TJ[]
  3148. ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<AJF> | AJF,
  3149. progressFilter?: null,
  3150. ): PromiseBase<
  3151. ARD | ARF,
  3152. AJD | AJF,
  3153. AND | ANF,
  3154. BRD | BRF,
  3155. BJD | BJF,
  3156. BND | BNF,
  3157. CRD | CRF,
  3158. CJD | CJF,
  3159. CND | CNF,
  3160. RRD | RRF,
  3161. RJD | RJF,
  3162. RND | RNF
  3163. >;
  3164. /**
  3165. * Utility method to filter and/or chain Deferreds.
  3166. * @param doneFilter An optional function that is called when the Deferred is resolved.
  3167. * @param failFilter An optional function that is called when the Deferred is rejected.
  3168. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  3169. * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
  3170. * @since 1.6
  3171. * @since 1.7
  3172. * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
  3173. *
  3174. * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
  3175. *
  3176. * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
  3177. * @example ​ ````Filter reject value:
  3178. ```javascript
  3179. var defer = $.Deferred(),
  3180. filtered = defer.pipe( null, function( value ) {
  3181. return value * 3;
  3182. });
  3183. defer.reject( 6 );
  3184. filtered.fail(function( value ) {
  3185. alert( "Value is ( 3*6 = ) 18: " + value );
  3186. });
  3187. ```
  3188. * @example ​ ````Chain tasks:
  3189. ```javascript
  3190. var request = $.ajax( url, { dataType: "json" } ),
  3191. chained = request.pipe(function( data ) {
  3192. return $.ajax( url2, { data: { user: data.userId } } );
  3193. });
  3194. chained.done(function( data ) {
  3195. // data retrieved from url2 as provided by the first request
  3196. });
  3197. ```
  3198. */
  3199. pipe<
  3200. ARF = never,
  3201. AJF = never,
  3202. ANF = never,
  3203. BRF = never,
  3204. BJF = never,
  3205. BNF = never,
  3206. CRF = never,
  3207. CJF = never,
  3208. CNF = never,
  3209. RRF = never,
  3210. RJF = never,
  3211. RNF = never,
  3212. >(
  3213. doneFilter: null,
  3214. failFilter: (
  3215. ...t: TJ[]
  3216. ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<AJF> | AJF,
  3217. progressFilter?: null,
  3218. ): PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF>;
  3219. /**
  3220. * Utility method to filter and/or chain Deferreds.
  3221. * @param doneFilter An optional function that is called when the Deferred is resolved.
  3222. * @param failFilter An optional function that is called when the Deferred is rejected.
  3223. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  3224. * @see \`{@link https://api.jquery.com/deferred.pipe/ }\`
  3225. * @since 1.6
  3226. * @since 1.7
  3227. * @deprecated ​ Deprecated since 1.8. Use \`{@link then }\`.
  3228. *
  3229. * **Cause**: The `.pipe()` method on a `jQuery.Deferred` object was deprecated as of jQuery 1.8, when the `.then()` method was changed to perform the same function.
  3230. *
  3231. * **Solution**: In most cases it is sufficient to change all occurrences of `.pipe()` to `.then()`. Ensure that you aren't relying on context/state propagation (e.g., using `this`) or synchronous callback invocation, which were dropped from `.then()` for Promises/A+ interoperability as of jQuery 3.0.
  3232. * @example ​ ````Filter resolve value:
  3233. ```javascript
  3234. var defer = $.Deferred(),
  3235. filtered = defer.pipe(function( value ) {
  3236. return value * 2;
  3237. });
  3238. defer.resolve( 5 );
  3239. filtered.done(function( value ) {
  3240. alert( "Value is ( 2*5 = ) 10: " + value );
  3241. });
  3242. ```
  3243. * @example ​ ````Chain tasks:
  3244. ```javascript
  3245. var request = $.ajax( url, { dataType: "json" } ),
  3246. chained = request.pipe(function( data ) {
  3247. return $.ajax( url2, { data: { user: data.userId } } );
  3248. });
  3249. chained.done(function( data ) {
  3250. // data retrieved from url2 as provided by the first request
  3251. });
  3252. ```
  3253. */
  3254. pipe<
  3255. ARD = never,
  3256. AJD = never,
  3257. AND = never,
  3258. BRD = never,
  3259. BJD = never,
  3260. BND = never,
  3261. CRD = never,
  3262. CJD = never,
  3263. CND = never,
  3264. RRD = never,
  3265. RJD = never,
  3266. RND = never,
  3267. >(
  3268. doneFilter: (
  3269. ...t: TR[]
  3270. ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
  3271. failFilter?: null,
  3272. progressFilter?: null,
  3273. ): PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND>;
  3274. // #endregion
  3275. // region then
  3276. // #region then
  3277. /**
  3278. * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
  3279. * @param doneFilter A function that is called when the Deferred is resolved.
  3280. * @param failFilter An optional function that is called when the Deferred is rejected.
  3281. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  3282. * @see \`{@link https://api.jquery.com/deferred.then/ }\`
  3283. * @since 1.8
  3284. * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can attach handlers using the .then method.
  3285. ```javascript
  3286. $.get( "test.php" ).then(
  3287. function() {
  3288. alert( "$.get succeeded" );
  3289. }, function() {
  3290. alert( "$.get failed!" );
  3291. }
  3292. );
  3293. ```
  3294. * @example ​ ````Filter the resolve value:
  3295. ```html
  3296. <!doctype html>
  3297. <html lang="en">
  3298. <head>
  3299. <meta charset="utf-8">
  3300. <title>deferred.then demo</title>
  3301. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  3302. </head>
  3303. <body>
  3304. <button>Filter Resolve</button>
  3305. <p></p>
  3306. <script>
  3307. var filterResolve = function() {
  3308. var defer = $.Deferred(),
  3309. filtered = defer.then(function( value ) {
  3310. return value * 2;
  3311. });
  3312. defer.resolve( 5 );
  3313. filtered.done(function( value ) {
  3314. $( "p" ).html( "Value is ( 2*5 = ) 10: " + value );
  3315. });
  3316. };
  3317. $( "button" ).on( "click", filterResolve );
  3318. </script>
  3319. </body>
  3320. </html>
  3321. ```
  3322. * @example ​ ````Filter reject value:
  3323. ```javascript
  3324. var defer = $.Deferred(),
  3325. filtered = defer.then( null, function( value ) {
  3326. return value * 3;
  3327. });
  3328. defer.reject( 6 );
  3329. filtered.fail(function( value ) {
  3330. alert( "Value is ( 3*6 = ) 18: " + value );
  3331. });
  3332. ```
  3333. * @example ​ ````Chain tasks:
  3334. ```javascript
  3335. var request = $.ajax( url, { dataType: "json" } ),
  3336. chained = request.then(function( data ) {
  3337. return $.ajax( url2, { data: { user: data.userId } } );
  3338. });
  3339. chained.done(function( data ) {
  3340. // data retrieved from url2 as provided by the first request
  3341. });
  3342. ```
  3343. */
  3344. then<
  3345. ARD = never,
  3346. AJD = never,
  3347. AND = never,
  3348. BRD = never,
  3349. BJD = never,
  3350. BND = never,
  3351. CRD = never,
  3352. CJD = never,
  3353. CND = never,
  3354. RRD = never,
  3355. RJD = never,
  3356. RND = never,
  3357. ARF = never,
  3358. AJF = never,
  3359. ANF = never,
  3360. BRF = never,
  3361. BJF = never,
  3362. BNF = never,
  3363. CRF = never,
  3364. CJF = never,
  3365. CNF = never,
  3366. RRF = never,
  3367. RJF = never,
  3368. RNF = never,
  3369. ARP = never,
  3370. AJP = never,
  3371. ANP = never,
  3372. BRP = never,
  3373. BJP = never,
  3374. BNP = never,
  3375. CRP = never,
  3376. CJP = never,
  3377. CNP = never,
  3378. RRP = never,
  3379. RJP = never,
  3380. RNP = never,
  3381. >(
  3382. doneFilter: (
  3383. ...t: TR[]
  3384. ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
  3385. failFilter: (
  3386. ...t: TJ[]
  3387. ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF,
  3388. progressFilter: (
  3389. ...t: TN[]
  3390. ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
  3391. ): PromiseBase<
  3392. ARD | ARF | ARP,
  3393. AJD | AJF | AJP,
  3394. AND | ANF | ANP,
  3395. BRD | BRF | BRP,
  3396. BJD | BJF | BJP,
  3397. BND | BNF | BNP,
  3398. CRD | CRF | CRP,
  3399. CJD | CJF | CJP,
  3400. CND | CNF | CNP,
  3401. RRD | RRF | RRP,
  3402. RJD | RJF | RJP,
  3403. RND | RNF | RNP
  3404. >;
  3405. /**
  3406. * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
  3407. * @param doneFilter A function that is called when the Deferred is resolved.
  3408. * @param failFilter An optional function that is called when the Deferred is rejected.
  3409. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  3410. * @see \`{@link https://api.jquery.com/deferred.then/ }\`
  3411. * @since 1.8
  3412. * @example ​ ````Filter reject value:
  3413. ```javascript
  3414. var defer = $.Deferred(),
  3415. filtered = defer.then( null, function( value ) {
  3416. return value * 3;
  3417. });
  3418. defer.reject( 6 );
  3419. filtered.fail(function( value ) {
  3420. alert( "Value is ( 3*6 = ) 18: " + value );
  3421. });
  3422. ```
  3423. * @example ​ ````Chain tasks:
  3424. ```javascript
  3425. var request = $.ajax( url, { dataType: "json" } ),
  3426. chained = request.then(function( data ) {
  3427. return $.ajax( url2, { data: { user: data.userId } } );
  3428. });
  3429. chained.done(function( data ) {
  3430. // data retrieved from url2 as provided by the first request
  3431. });
  3432. ```
  3433. */
  3434. then<
  3435. ARF = never,
  3436. AJF = never,
  3437. ANF = never,
  3438. BRF = never,
  3439. BJF = never,
  3440. BNF = never,
  3441. CRF = never,
  3442. CJF = never,
  3443. CNF = never,
  3444. RRF = never,
  3445. RJF = never,
  3446. RNF = never,
  3447. ARP = never,
  3448. AJP = never,
  3449. ANP = never,
  3450. BRP = never,
  3451. BJP = never,
  3452. BNP = never,
  3453. CRP = never,
  3454. CJP = never,
  3455. CNP = never,
  3456. RRP = never,
  3457. RJP = never,
  3458. RNP = never,
  3459. >(
  3460. doneFilter: null,
  3461. failFilter: (
  3462. ...t: TJ[]
  3463. ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF,
  3464. progressFilter: (
  3465. ...t: TN[]
  3466. ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
  3467. ): PromiseBase<
  3468. ARF | ARP,
  3469. AJF | AJP,
  3470. ANF | ANP,
  3471. BRF | BRP,
  3472. BJF | BJP,
  3473. BNF | BNP,
  3474. CRF | CRP,
  3475. CJF | CJP,
  3476. CNF | CNP,
  3477. RRF | RRP,
  3478. RJF | RJP,
  3479. RNF | RNP
  3480. >;
  3481. /**
  3482. * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
  3483. * @param doneFilter A function that is called when the Deferred is resolved.
  3484. * @param failFilter An optional function that is called when the Deferred is rejected.
  3485. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  3486. * @see \`{@link https://api.jquery.com/deferred.then/ }\`
  3487. * @since 1.8
  3488. * @example ​ ````Filter the resolve value:
  3489. ```html
  3490. <!doctype html>
  3491. <html lang="en">
  3492. <head>
  3493. <meta charset="utf-8">
  3494. <title>deferred.then demo</title>
  3495. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  3496. </head>
  3497. <body>
  3498. <button>Filter Resolve</button>
  3499. <p></p>
  3500. <script>
  3501. var filterResolve = function() {
  3502. var defer = $.Deferred(),
  3503. filtered = defer.then(function( value ) {
  3504. return value * 2;
  3505. });
  3506. defer.resolve( 5 );
  3507. filtered.done(function( value ) {
  3508. $( "p" ).html( "Value is ( 2*5 = ) 10: " + value );
  3509. });
  3510. };
  3511. $( "button" ).on( "click", filterResolve );
  3512. </script>
  3513. </body>
  3514. </html>
  3515. ```
  3516. * @example ​ ````Chain tasks:
  3517. ```javascript
  3518. var request = $.ajax( url, { dataType: "json" } ),
  3519. chained = request.then(function( data ) {
  3520. return $.ajax( url2, { data: { user: data.userId } } );
  3521. });
  3522. chained.done(function( data ) {
  3523. // data retrieved from url2 as provided by the first request
  3524. });
  3525. ```
  3526. */
  3527. then<
  3528. ARD = never,
  3529. AJD = never,
  3530. AND = never,
  3531. BRD = never,
  3532. BJD = never,
  3533. BND = never,
  3534. CRD = never,
  3535. CJD = never,
  3536. CND = never,
  3537. RRD = never,
  3538. RJD = never,
  3539. RND = never,
  3540. ARP = never,
  3541. AJP = never,
  3542. ANP = never,
  3543. BRP = never,
  3544. BJP = never,
  3545. BNP = never,
  3546. CRP = never,
  3547. CJP = never,
  3548. CNP = never,
  3549. RRP = never,
  3550. RJP = never,
  3551. RNP = never,
  3552. >(
  3553. doneFilter: (
  3554. ...t: TR[]
  3555. ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
  3556. failFilter: null,
  3557. progressFilter: (
  3558. ...t: TN[]
  3559. ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
  3560. ): PromiseBase<
  3561. ARD | ARP,
  3562. AJD | AJP,
  3563. AND | ANP,
  3564. BRD | BRP,
  3565. BJD | BJP,
  3566. BND | BNP,
  3567. CRD | CRP,
  3568. CJD | CJP,
  3569. CND | CNP,
  3570. RRD | RRP,
  3571. RJD | RJP,
  3572. RND | RNP
  3573. >;
  3574. /**
  3575. * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
  3576. * @param doneFilter A function that is called when the Deferred is resolved.
  3577. * @param failFilter An optional function that is called when the Deferred is rejected.
  3578. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  3579. * @see \`{@link https://api.jquery.com/deferred.then/ }\`
  3580. * @since 1.8
  3581. * @example ​ ````Chain tasks:
  3582. ```javascript
  3583. var request = $.ajax( url, { dataType: "json" } ),
  3584. chained = request.then(function( data ) {
  3585. return $.ajax( url2, { data: { user: data.userId } } );
  3586. });
  3587. chained.done(function( data ) {
  3588. // data retrieved from url2 as provided by the first request
  3589. });
  3590. ```
  3591. */
  3592. then<
  3593. ARP = never,
  3594. AJP = never,
  3595. ANP = never,
  3596. BRP = never,
  3597. BJP = never,
  3598. BNP = never,
  3599. CRP = never,
  3600. CJP = never,
  3601. CNP = never,
  3602. RRP = never,
  3603. RJP = never,
  3604. RNP = never,
  3605. >(
  3606. doneFilter: null,
  3607. failFilter: null,
  3608. progressFilter?: (
  3609. ...t: TN[]
  3610. ) => PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP> | Thenable<ANP> | ANP,
  3611. ): PromiseBase<ARP, AJP, ANP, BRP, BJP, BNP, CRP, CJP, CNP, RRP, RJP, RNP>;
  3612. /**
  3613. * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
  3614. * @param doneFilter An optional function that is called when the Deferred is resolved.
  3615. * @param failFilter An optional function that is called when the Deferred is rejected.
  3616. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  3617. * @see \`{@link https://api.jquery.com/deferred.then/ }\`
  3618. * @since 1.8
  3619. * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can attach handlers using the .then method.
  3620. ```javascript
  3621. $.get( "test.php" ).then(
  3622. function() {
  3623. alert( "$.get succeeded" );
  3624. }, function() {
  3625. alert( "$.get failed!" );
  3626. }
  3627. );
  3628. ```
  3629. * @example ​ ````Filter the resolve value:
  3630. ```html
  3631. <!doctype html>
  3632. <html lang="en">
  3633. <head>
  3634. <meta charset="utf-8">
  3635. <title>deferred.then demo</title>
  3636. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  3637. </head>
  3638. <body>
  3639. <button>Filter Resolve</button>
  3640. <p></p>
  3641. <script>
  3642. var filterResolve = function() {
  3643. var defer = $.Deferred(),
  3644. filtered = defer.then(function( value ) {
  3645. return value * 2;
  3646. });
  3647. defer.resolve( 5 );
  3648. filtered.done(function( value ) {
  3649. $( "p" ).html( "Value is ( 2*5 = ) 10: " + value );
  3650. });
  3651. };
  3652. $( "button" ).on( "click", filterResolve );
  3653. </script>
  3654. </body>
  3655. </html>
  3656. ```
  3657. * @example ​ ````Filter reject value:
  3658. ```javascript
  3659. var defer = $.Deferred(),
  3660. filtered = defer.then( null, function( value ) {
  3661. return value * 3;
  3662. });
  3663. defer.reject( 6 );
  3664. filtered.fail(function( value ) {
  3665. alert( "Value is ( 3*6 = ) 18: " + value );
  3666. });
  3667. ```
  3668. * @example ​ ````Chain tasks:
  3669. ```javascript
  3670. var request = $.ajax( url, { dataType: "json" } ),
  3671. chained = request.then(function( data ) {
  3672. return $.ajax( url2, { data: { user: data.userId } } );
  3673. });
  3674. chained.done(function( data ) {
  3675. // data retrieved from url2 as provided by the first request
  3676. });
  3677. ```
  3678. */
  3679. then<
  3680. ARD = never,
  3681. AJD = never,
  3682. AND = never,
  3683. BRD = never,
  3684. BJD = never,
  3685. BND = never,
  3686. CRD = never,
  3687. CJD = never,
  3688. CND = never,
  3689. RRD = never,
  3690. RJD = never,
  3691. RND = never,
  3692. ARF = never,
  3693. AJF = never,
  3694. ANF = never,
  3695. BRF = never,
  3696. BJF = never,
  3697. BNF = never,
  3698. CRF = never,
  3699. CJF = never,
  3700. CNF = never,
  3701. RRF = never,
  3702. RJF = never,
  3703. RNF = never,
  3704. >(
  3705. doneFilter: (
  3706. ...t: TR[]
  3707. ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
  3708. failFilter: (
  3709. ...t: TJ[]
  3710. ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF,
  3711. progressFilter?: null,
  3712. ): PromiseBase<
  3713. ARD | ARF,
  3714. AJD | AJF,
  3715. AND | ANF,
  3716. BRD | BRF,
  3717. BJD | BJF,
  3718. BND | BNF,
  3719. CRD | CRF,
  3720. CJD | CJF,
  3721. CND | CNF,
  3722. RRD | RRF,
  3723. RJD | RJF,
  3724. RND | RNF
  3725. >;
  3726. /**
  3727. * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
  3728. * @param doneFilter An optional function that is called when the Deferred is resolved.
  3729. * @param failFilter An optional function that is called when the Deferred is rejected.
  3730. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  3731. * @see \`{@link https://api.jquery.com/deferred.then/ }\`
  3732. * @since 1.8
  3733. * @example ​ ````Filter reject value:
  3734. ```javascript
  3735. var defer = $.Deferred(),
  3736. filtered = defer.then( null, function( value ) {
  3737. return value * 3;
  3738. });
  3739. defer.reject( 6 );
  3740. filtered.fail(function( value ) {
  3741. alert( "Value is ( 3*6 = ) 18: " + value );
  3742. });
  3743. ```
  3744. * @example ​ ````Chain tasks:
  3745. ```javascript
  3746. var request = $.ajax( url, { dataType: "json" } ),
  3747. chained = request.then(function( data ) {
  3748. return $.ajax( url2, { data: { user: data.userId } } );
  3749. });
  3750. chained.done(function( data ) {
  3751. // data retrieved from url2 as provided by the first request
  3752. });
  3753. ```
  3754. */
  3755. then<
  3756. ARF = never,
  3757. AJF = never,
  3758. ANF = never,
  3759. BRF = never,
  3760. BJF = never,
  3761. BNF = never,
  3762. CRF = never,
  3763. CJF = never,
  3764. CNF = never,
  3765. RRF = never,
  3766. RJF = never,
  3767. RNF = never,
  3768. >(
  3769. doneFilter: null,
  3770. failFilter: (
  3771. ...t: TJ[]
  3772. ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF,
  3773. progressFilter?: null,
  3774. ): PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF>;
  3775. /**
  3776. * Add handlers to be called when the Deferred object is resolved, rejected, or still in progress.
  3777. * @param doneFilter An optional function that is called when the Deferred is resolved.
  3778. * @param failFilter An optional function that is called when the Deferred is rejected.
  3779. * @param progressFilter An optional function that is called when progress notifications are sent to the Deferred.
  3780. * @see \`{@link https://api.jquery.com/deferred.then/ }\`
  3781. * @since 1.8
  3782. * @example ​ ````Filter the resolve value:
  3783. ```html
  3784. <!doctype html>
  3785. <html lang="en">
  3786. <head>
  3787. <meta charset="utf-8">
  3788. <title>deferred.then demo</title>
  3789. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  3790. </head>
  3791. <body>
  3792. <button>Filter Resolve</button>
  3793. <p></p>
  3794. <script>
  3795. var filterResolve = function() {
  3796. var defer = $.Deferred(),
  3797. filtered = defer.then(function( value ) {
  3798. return value * 2;
  3799. });
  3800. defer.resolve( 5 );
  3801. filtered.done(function( value ) {
  3802. $( "p" ).html( "Value is ( 2*5 = ) 10: " + value );
  3803. });
  3804. };
  3805. $( "button" ).on( "click", filterResolve );
  3806. </script>
  3807. </body>
  3808. </html>
  3809. ```
  3810. * @example ​ ````Chain tasks:
  3811. ```javascript
  3812. var request = $.ajax( url, { dataType: "json" } ),
  3813. chained = request.then(function( data ) {
  3814. return $.ajax( url2, { data: { user: data.userId } } );
  3815. });
  3816. chained.done(function( data ) {
  3817. // data retrieved from url2 as provided by the first request
  3818. });
  3819. ```
  3820. */
  3821. then<
  3822. ARD = never,
  3823. AJD = never,
  3824. AND = never,
  3825. BRD = never,
  3826. BJD = never,
  3827. BND = never,
  3828. CRD = never,
  3829. CJD = never,
  3830. CND = never,
  3831. RRD = never,
  3832. RJD = never,
  3833. RND = never,
  3834. >(
  3835. doneFilter: (
  3836. ...t: TR[]
  3837. ) => PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND> | Thenable<ARD> | ARD,
  3838. failFilter?: null,
  3839. progressFilter?: null,
  3840. ): PromiseBase<ARD, AJD, AND, BRD, BJD, BND, CRD, CJD, CND, RRD, RJD, RND>;
  3841. // #endregion
  3842. /**
  3843. * Add handlers to be called when the Deferred object is rejected.
  3844. * @param failFilter A function that is called when the Deferred is rejected.
  3845. * @see \`{@link https://api.jquery.com/deferred.catch/ }\`
  3846. * @since 3.0
  3847. * @example ​ ````Since the jQuery.get method returns a jqXHR object, which is derived from a Deferred object, we can rejection handlers using the .catch method.
  3848. ```javascript
  3849. $.get( "test.php" )
  3850. .then( function() {
  3851. alert( "$.get succeeded" );
  3852. } )
  3853. .catch( function() {
  3854. alert( "$.get failed!" );
  3855. } );
  3856. ```
  3857. */
  3858. catch<
  3859. ARF = never,
  3860. AJF = never,
  3861. ANF = never,
  3862. BRF = never,
  3863. BJF = never,
  3864. BNF = never,
  3865. CRF = never,
  3866. CJF = never,
  3867. CNF = never,
  3868. RRF = never,
  3869. RJF = never,
  3870. RNF = never,
  3871. >(
  3872. failFilter?:
  3873. | ((
  3874. ...t: TJ[]
  3875. ) => PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF> | Thenable<ARF> | ARF)
  3876. | null,
  3877. ): PromiseBase<ARF, AJF, ANF, BRF, BJF, BNF, CRF, CJF, CNF, RRF, RJF, RNF>;
  3878. }
  3879. namespace Deferred {
  3880. type CallbackBase<T, U, V, R> = (t: T, u: U, v: V, ...r: R[]) => void;
  3881. interface Callback3<T, U, V> extends CallbackBase<T, U, V, never> {}
  3882. type Callback<T> = (...args: T[]) => void;
  3883. /**
  3884. * @deprecated ​ Deprecated. Use \`{@link Callback }\`.
  3885. */
  3886. interface DoneCallback<TResolve> extends Callback<TResolve> {}
  3887. /**
  3888. * @deprecated ​ Deprecated. Use \`{@link Callback }\`.
  3889. */
  3890. interface FailCallback<TReject> extends Callback<TReject> {}
  3891. /**
  3892. * @deprecated ​ Deprecated. Use \`{@link Callback }\`.
  3893. */
  3894. interface AlwaysCallback<TResolve, TReject> extends Callback<TResolve | TReject> {}
  3895. /**
  3896. * @deprecated ​ Deprecated. Use \`{@link Callback }\`.
  3897. */
  3898. interface ProgressCallback<TNotify> extends Callback<TNotify> {}
  3899. }
  3900. // #endregion
  3901. // region Effects
  3902. // #region Effects
  3903. type Duration = number | "fast" | "slow";
  3904. /**
  3905. * @see \`{@link https://api.jquery.com/animate/#animate-properties-options }\`
  3906. */
  3907. interface EffectsOptions<TElement> extends PlainObject {
  3908. /**
  3909. * A function to be called when the animation on an element completes or stops without completing (its Promise object is either resolved or rejected).
  3910. */
  3911. always?(this: TElement, animation: Animation<TElement>, jumpedToEnd: boolean): void;
  3912. /**
  3913. * A function that is called once the animation on an element is complete.
  3914. */
  3915. complete?(this: TElement): void;
  3916. /**
  3917. * A function to be called when the animation on an element completes (its Promise object is resolved).
  3918. */
  3919. done?(this: TElement, animation: Animation<TElement>, jumpedToEnd: boolean): void;
  3920. /**
  3921. * A string or number determining how long the animation will run.
  3922. */
  3923. duration?: Duration | undefined;
  3924. /**
  3925. * A string indicating which easing function to use for the transition.
  3926. */
  3927. easing?: string | undefined;
  3928. /**
  3929. * A function to be called when the animation on an element fails to complete (its Promise object is rejected).
  3930. */
  3931. fail?(this: TElement, animation: Animation<TElement>, jumpedToEnd: boolean): void;
  3932. /**
  3933. * A function to be called after each step of the animation, only once per animated element regardless of the number of animated properties.
  3934. */
  3935. progress?(this: TElement, animation: Animation<TElement>, progress: number, remainingMs: number): void;
  3936. /**
  3937. * A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string. When a custom queue name is used the animation does not automatically start; you must call .dequeue("queuename") to start it.
  3938. */
  3939. queue?: boolean | string | undefined;
  3940. /**
  3941. * An object containing one or more of the CSS properties defined by the properties argument and their corresponding easing functions.
  3942. */
  3943. specialEasing?: PlainObject<string> | undefined;
  3944. /**
  3945. * A function to call when the animation on an element begins.
  3946. */
  3947. start?(this: TElement, animation: Animation<TElement>): void;
  3948. /**
  3949. * A function to be called for each animated property of each animated element. This function provides an opportunity to modify the Tween object to change the value of the property before it is set.
  3950. */
  3951. step?(this: TElement, now: number, tween: Tween<TElement>): void;
  3952. }
  3953. // region Animation
  3954. // #region Animation
  3955. /**
  3956. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
  3957. * @since 1.8
  3958. */
  3959. interface AnimationStatic {
  3960. /**
  3961. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
  3962. * @since 1.8
  3963. */
  3964. <TElement>(element: TElement, props: PlainObject, opts: EffectsOptions<TElement>): Animation<TElement>;
  3965. /**
  3966. * During the initial setup, `jQuery.Animation` will call any callbacks that have been registered through `jQuery.Animation.prefilter( function( element, props, opts ) )`.
  3967. * @param callback The prefilter will have `this` set to an animation object, and you can modify any of the `props` or
  3968. * `opts` however you need. The prefilter _may_ return its own promise which also implements `stop()`,
  3969. * in which case, processing of prefilters stops. If the prefilter is not trying to override the animation
  3970. * entirely, it should return `undefined` or some other falsy value.
  3971. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#prefilters }\`
  3972. * @since 1.8
  3973. */
  3974. prefilter<TElement>(
  3975. callback: (
  3976. this: Animation<TElement>,
  3977. element: TElement,
  3978. props: PlainObject,
  3979. opts: EffectsOptions<TElement>,
  3980. // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
  3981. ) => Animation<TElement> | _Falsy | void,
  3982. prepend?: boolean,
  3983. ): void;
  3984. /**
  3985. * A "Tweener" is a function responsible for creating a tween object, and you might want to override these if you want to implement complex values ( like a clip/transform array matrix ) in a single property.
  3986. *
  3987. * You can override the default process for creating a tween in order to provide your own tween object by using `jQuery.Animation.tweener( props, callback( prop, value ) )`.
  3988. * @param props A space separated list of properties to be passed to your tweener, or `"*"` if it should be called
  3989. * for all properties.
  3990. * @param callback The callback will be called with `this` being an `Animation` object. The tweener function will
  3991. * generally start with `var tween = this.createTween( prop, value );`, but doesn't nessecarily need to
  3992. * use the `jQuery.Tween()` factory.
  3993. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweeners }\`
  3994. * @since 1.8
  3995. */
  3996. tweener(props: string, callback: Tweener<any>): void;
  3997. }
  3998. /**
  3999. * The promise will be resolved when the animation reaches its end, and rejected when terminated early. The context of callbacks attached to the promise will be the element, and the arguments will be the `Animation` object and a boolean `jumpedToEnd` which when true means the animation was stopped with `gotoEnd`, when `undefined` the animation completed naturally.
  4000. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
  4001. * @since 1.8
  4002. */
  4003. interface Animation<TElement> extends
  4004. Promise3<
  4005. Animation<TElement>,
  4006. Animation<TElement>,
  4007. Animation<TElement>,
  4008. true | undefined,
  4009. false,
  4010. number,
  4011. never,
  4012. never,
  4013. number
  4014. >
  4015. {
  4016. /**
  4017. * The duration specified in ms
  4018. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
  4019. * @since 1.8
  4020. */
  4021. duration: number;
  4022. /**
  4023. * The element being animatied
  4024. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
  4025. * @since 1.8
  4026. */
  4027. elem: TElement;
  4028. /**
  4029. * The final value of each property animating
  4030. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
  4031. * @since 1.8
  4032. */
  4033. props: PlainObject;
  4034. /**
  4035. * The animation options
  4036. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
  4037. * @since 1.8
  4038. */
  4039. opts: EffectsOptions<TElement>;
  4040. /**
  4041. * The original properties before being filtered
  4042. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
  4043. * @since 1.8
  4044. */
  4045. originalProps: PlainObject;
  4046. /**
  4047. * The original options before being filtered
  4048. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
  4049. * @since 1.8
  4050. */
  4051. originalOpts: EffectsOptions<TElement>;
  4052. /**
  4053. * The numeric value of `new Date()` when the animation began
  4054. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
  4055. * @since 1.8
  4056. */
  4057. startTime: number;
  4058. /**
  4059. * The animations tweens.
  4060. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
  4061. * @since 1.8
  4062. */
  4063. tweens: Array<Tween<TElement>>;
  4064. /**
  4065. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
  4066. * @since 1.8
  4067. */
  4068. createTween(propName: string, finalValue: number): Tween<TElement>;
  4069. /**
  4070. * Stops the animation early, optionally going to the end.
  4071. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#animation-factory }\`
  4072. * @since 1.8
  4073. */
  4074. stop(gotoEnd: boolean): this;
  4075. }
  4076. /**
  4077. * A "Tweener" is a function responsible for creating a tween object, and you might want to override these if you want to implement complex values ( like a clip/transform array matrix ) in a single property.
  4078. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweeners }\`
  4079. * @since 1.8
  4080. */
  4081. type Tweener<TElement> = (this: Animation<TElement>, propName: string, finalValue: number) => Tween<TElement>;
  4082. /**
  4083. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
  4084. * @since 1.8
  4085. */
  4086. interface TweenStatic {
  4087. /**
  4088. * `jQuery.Tween.propHooks[ prop ]` is a hook point that replaces `jQuery.fx.step[ prop ]` (which is being deprecated.) These hooks are used by the tween to get and set values on elements.
  4089. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tween-hooks }\`
  4090. * @since 1.8
  4091. * @example
  4092. ```javascript
  4093. jQuery.Tween.propHooks[ property ] = {
  4094. get: function( tween ) {
  4095. // get tween.prop from tween.elem and return it
  4096. },
  4097. set: function( tween ) {
  4098. // set tween.prop on tween.elem to tween.now + tween.unit
  4099. }
  4100. }
  4101. ```
  4102. */
  4103. propHooks: PropHooks;
  4104. /**
  4105. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
  4106. * @since 1.8
  4107. */
  4108. <TElement>(
  4109. elem: TElement,
  4110. options: EffectsOptions<TElement>,
  4111. prop: string,
  4112. end: number,
  4113. easing?: string,
  4114. unit?: string,
  4115. ): Tween<TElement>;
  4116. }
  4117. /**
  4118. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
  4119. * @since 1.8
  4120. */
  4121. // This should be a class but doesn't work correctly under the JQuery namespace. Tween should be an inner class of jQuery.
  4122. interface Tween<TElement> {
  4123. /**
  4124. * The easing used
  4125. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
  4126. * @since 1.8
  4127. */
  4128. easing: string;
  4129. /**
  4130. * The element being animated
  4131. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
  4132. * @since 1.8
  4133. */
  4134. elem: TElement;
  4135. /**
  4136. * The ending value of the tween
  4137. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
  4138. * @since 1.8
  4139. */
  4140. end: number;
  4141. /**
  4142. * The current value of the tween
  4143. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
  4144. * @since 1.8
  4145. */
  4146. now: number;
  4147. /**
  4148. * A reference to the animation options
  4149. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
  4150. * @since 1.8
  4151. */
  4152. options: EffectsOptions<TElement>;
  4153. // Undocumented. Is this intended to be public?
  4154. pos?: number | undefined;
  4155. /**
  4156. * The property being animated
  4157. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
  4158. * @since 1.8
  4159. */
  4160. prop: string;
  4161. /**
  4162. * The starting value of the tween
  4163. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
  4164. * @since 1.8
  4165. */
  4166. start: number;
  4167. /**
  4168. * The CSS unit for the tween
  4169. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
  4170. * @since 1.8
  4171. */
  4172. unit: string;
  4173. /**
  4174. * Reads the current value for property from the element
  4175. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
  4176. * @since 1.8
  4177. */
  4178. cur(): any;
  4179. /**
  4180. * Updates the value for the property on the animated elemd.
  4181. * @param progress A number from 0 to 1.
  4182. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tweens }\`
  4183. * @since 1.8
  4184. */
  4185. run(progress: number): this;
  4186. }
  4187. /**
  4188. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tween-hooks }\`
  4189. * @since 1.8
  4190. */
  4191. // Workaround for TypeScript 2.3 which does not have support for weak types handling.
  4192. type PropHook<TElement> = {
  4193. /**
  4194. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tween-hooks }\`
  4195. * @since 1.8
  4196. */
  4197. get(tween: Tween<TElement>): any;
  4198. } | {
  4199. /**
  4200. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tween-hooks }\`
  4201. * @since 1.8
  4202. */
  4203. set(tween: Tween<TElement>): void;
  4204. } | {
  4205. [key: string]: never;
  4206. };
  4207. /**
  4208. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#tween-hooks }\`
  4209. * @since 1.8
  4210. */
  4211. interface PropHooks {
  4212. [property: string]: PropHook<Node>;
  4213. }
  4214. // #endregion
  4215. // region Easing
  4216. // #region Easing
  4217. type EasingMethod = (percent: number) => number;
  4218. interface Easings {
  4219. [name: string]: EasingMethod;
  4220. }
  4221. // #endregion
  4222. // region Effects (fx)
  4223. // #region Effects (fx)
  4224. interface Effects {
  4225. /**
  4226. * The rate (in milliseconds) at which animations fire.
  4227. * @see \`{@link https://api.jquery.com/jQuery.fx.interval/ }\`
  4228. * @since 1.4.3
  4229. * @deprecated ​ Deprecated since 3.0. See \`{@link https://api.jquery.com/jQuery.fx.interval/ }\`.
  4230. *
  4231. * **Cause**: As of jQuery 3.0 the `jQuery.fx.interval` property can be used to change the animation interval only on browsers that do not support the `window.requestAnimationFrame()` method. That is currently only Internet Explorer 9 and the Android Browser. Once support is dropped for these browsers, the property will serve no purpose and it will be removed.
  4232. *
  4233. * **Solution**: Find and remove code that changes or uses `jQuery.fx.interval`. If the value is being used by code in your page or a plugin, the code may be making assumptions that are no longer valid. The default value of `jQuery.fx.interval` is `13` (milliseconds), which could be used instead of accessing this property.
  4234. * @example ​ ````Cause all animations to run with less frames.
  4235. ```html
  4236. <!doctype html>
  4237. <html lang="en">
  4238. <head>
  4239. <meta charset="utf-8">
  4240. <title>jQuery.fx.interval demo</title>
  4241. <style>
  4242. div {
  4243. width: 50px;
  4244. height: 30px;
  4245. margin: 5px;
  4246. float: left;
  4247. background: green;
  4248. }
  4249. </style>
  4250. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4251. </head>
  4252. <body>
  4253. <p><input type="button" value="Run"></p>
  4254. <div></div>
  4255. <script>
  4256. jQuery.fx.interval = 100;
  4257. $( "input" ).click(function() {
  4258. $( "div" ).toggle( 3000 );
  4259. });
  4260. </script>
  4261. </body>
  4262. </html>
  4263. ```
  4264. */
  4265. interval: number;
  4266. /**
  4267. * Globally disable all animations.
  4268. * @see \`{@link https://api.jquery.com/jQuery.fx.off/ }\`
  4269. * @since 1.3
  4270. * @example ​ ````Toggle animation on and off
  4271. ```html
  4272. <!doctype html>
  4273. <html lang="en">
  4274. <head>
  4275. <meta charset="utf-8">
  4276. <title>jQuery.fx.off demo</title>
  4277. <style>
  4278. div {
  4279. width: 50px;
  4280. height: 30px;
  4281. margin: 5px;
  4282. float: left;
  4283. background: green;
  4284. }
  4285. </style>
  4286. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4287. </head>
  4288. <body>
  4289. <input type="button" value="Run">
  4290. <button>Toggle fx</button>
  4291. <div></div>
  4292. <script>
  4293. var toggleFx = function() {
  4294. $.fx.off = !$.fx.off;
  4295. };
  4296. toggleFx();
  4297. $( "button" ).click( toggleFx );
  4298. $( "input" ).click(function() {
  4299. $( "div" ).toggle( "slow" );
  4300. });
  4301. </script>
  4302. </body>
  4303. </html>
  4304. ```
  4305. */
  4306. off: boolean;
  4307. /**
  4308. * @deprecated ​ Deprecated since 1.8. Use \`{@link Tween.propHooks jQuery.Tween.propHooks}\`.
  4309. *
  4310. * `jQuery.fx.step` functions are being replaced by `jQuery.Tween.propHooks` and may eventually be removed, but are still supported via the default tween propHook.
  4311. */
  4312. step: PlainObject<AnimationHook<Node>>;
  4313. /**
  4314. * _overridable_ Clears up the `setInterval`
  4315. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#plugging-in-a-different-timer-loop }\`
  4316. * @since 1.8
  4317. */
  4318. stop(): void;
  4319. /**
  4320. * Calls `.run()` on each object in the `jQuery.timers` array, removing it from the array if `.run()` returns a falsy value. Calls `jQuery.fx.stop()` whenever there are no timers remaining.
  4321. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#plugging-in-a-different-timer-loop }\`
  4322. * @since 1.8
  4323. */
  4324. tick(): void;
  4325. /**
  4326. * _overridable_ Creates a `setInterval` if one doesn't already exist, and pushes `tickFunction` to the `jQuery.timers` array. `tickFunction` should also have `anim`, `elem`, and `queue` properties that reference the animation object, animated element, and queue option to facilitate `jQuery.fn.stop()`
  4327. *
  4328. * By overriding `fx.timer` and `fx.stop` you should be able to implement any animation tick behaviour you desire. (like using `requestAnimationFrame` instead of `setTimeout`.)
  4329. *
  4330. * There is an example of overriding the timer loop in \`{@link https://github.com/gnarf37/jquery-requestAnimationFrame jquery.requestAnimationFrame}\`
  4331. * @see \`{@link https://gist.github.com/gnarf/54829d408993526fe475#plugging-in-a-different-timer-loop }\`
  4332. * @since 1.8
  4333. */
  4334. timer(tickFunction: TickFunction<any>): void;
  4335. }
  4336. /**
  4337. * @deprecated ​ Deprecated since 1.8. Use \`{@link Tween.propHooks jQuery.Tween.propHooks}\`.
  4338. *
  4339. * `jQuery.fx.step` functions are being replaced by `jQuery.Tween.propHooks` and may eventually be removed, but are still supported via the default tween propHook.
  4340. */
  4341. type AnimationHook<TElement> = (fx: Tween<TElement>) => void;
  4342. interface TickFunction<TElement> {
  4343. anim: Animation<TElement>;
  4344. elem: TElement;
  4345. queue: boolean | string;
  4346. (): any;
  4347. }
  4348. // #endregion
  4349. // region Queue
  4350. // #region Queue
  4351. // TODO: Is the first element always a string or is that specific to the 'fx' queue?
  4352. type Queue<TElement> = { 0: string } & Array<QueueFunction<TElement>>;
  4353. type QueueFunction<TElement> = (this: TElement, next: () => void) => void;
  4354. // #endregion
  4355. // region Speed
  4356. // #region Speed
  4357. // Workaround for TypeScript 2.3 which does not have support for weak types handling.
  4358. type SpeedSettings<TElement> = {
  4359. /**
  4360. * A string or number determining how long the animation will run.
  4361. */
  4362. duration: Duration;
  4363. } | {
  4364. /**
  4365. * A string indicating which easing function to use for the transition.
  4366. */
  4367. easing: string;
  4368. } | {
  4369. /**
  4370. * A function to call once the animation is complete.
  4371. */
  4372. complete(this: TElement): void;
  4373. } | {
  4374. [key: string]: never;
  4375. };
  4376. // #endregion
  4377. // #endregion
  4378. // region Events
  4379. // #region Events
  4380. // region Event
  4381. // #region Event
  4382. // This should be a class but doesn't work correctly under the JQuery namespace. Event should be an inner class of jQuery.
  4383. /**
  4384. * jQuery's event system normalizes the event object according to W3C standards. The event object is guaranteed to be passed to the event handler (no checks for window.event required). It normalizes the target, relatedTarget, which, metaKey and pageX/Y properties and provides both stopPropagation() and preventDefault() methods.
  4385. *
  4386. * Those properties are all documented, and accompanied by examples, on the \`{@link http://api.jquery.com/category/events/event-object/ Event object}\` page.
  4387. *
  4388. * The standard events in the Document Object Model are: `blur`, `focus`, `load`, `resize`, `scroll`, `unload`, `beforeunload`, `click`, `dblclick`, `mousedown`, `mouseup`, `mousemove`, `mouseover`, `mouseout`, `mouseenter`, `mouseleave`, `change`, `select`, `submit`, `keydown`, `keypress`, and `keyup`. Since the DOM event names have predefined meanings for some elements, using them for other purposes is not recommended. jQuery's event model can trigger an event by any name on an element, and it is propagated up the DOM tree to which that element belongs, if any.
  4389. * @see \`{@link https://api.jquery.com/category/events/event-object/ }\`
  4390. */
  4391. interface EventStatic {
  4392. /**
  4393. * The jQuery.Event constructor is exposed and can be used when calling trigger. The new operator is optional.
  4394. *
  4395. * Check \`{@link https://api.jquery.com/trigger/ trigger}\`'s documentation to see how to combine it with your own event object.
  4396. * @see \`{@link https://api.jquery.com/category/events/event-object/ }\`
  4397. * @since 1.6
  4398. * @example
  4399. ```javascript
  4400. //Create a new jQuery.Event object without the "new" operator.
  4401. var e = jQuery.Event( "click" );
  4402. // trigger an artificial click event
  4403. jQuery( "body" ).trigger( e );
  4404. ```
  4405. * @example
  4406. ```javascript
  4407. // Create a new jQuery.Event object with specified event properties.
  4408. var e = jQuery.Event( "keydown", { keyCode: 64 } );
  4409. // trigger an artificial keydown event with keyCode 64
  4410. jQuery( "body" ).trigger( e );
  4411. ```
  4412. */
  4413. <T extends object>(event: string, properties?: T): Event & T;
  4414. /**
  4415. * The jQuery.Event constructor is exposed and can be used when calling trigger. The new operator is optional.
  4416. *
  4417. * Check \`{@link https://api.jquery.com/trigger/ trigger}\`'s documentation to see how to combine it with your own event object.
  4418. * @see \`{@link https://api.jquery.com/category/events/event-object/ }\`
  4419. * @since 1.6
  4420. * @example
  4421. ```javascript
  4422. //Create a new jQuery.Event object without the "new" operator.
  4423. var e = jQuery.Event( "click" );
  4424. // trigger an artificial click event
  4425. jQuery( "body" ).trigger( e );
  4426. ```
  4427. * @example
  4428. ```javascript
  4429. // Create a new jQuery.Event object with specified event properties.
  4430. var e = jQuery.Event( "keydown", { keyCode: 64 } );
  4431. // trigger an artificial keydown event with keyCode 64
  4432. jQuery( "body" ).trigger( e );
  4433. ```
  4434. */
  4435. new<T extends object>(event: string, properties?: T): Event & T;
  4436. }
  4437. /**
  4438. * jQuery's event system normalizes the event object according to W3C standards. The event object is guaranteed to be passed to the event handler (no checks for window.event required). It normalizes the target, relatedTarget, which, metaKey and pageX/Y properties and provides both stopPropagation() and preventDefault() methods.
  4439. *
  4440. * Those properties are all documented, and accompanied by examples, on the \`{@link http://api.jquery.com/category/events/event-object/ Event object}\` page.
  4441. *
  4442. * The standard events in the Document Object Model are: `blur`, `focus`, `load`, `resize`, `scroll`, `unload`, `beforeunload`, `click`, `dblclick`, `mousedown`, `mouseup`, `mousemove`, `mouseover`, `mouseout`, `mouseenter`, `mouseleave`, `change`, `select`, `submit`, `keydown`, `keypress`, and `keyup`. Since the DOM event names have predefined meanings for some elements, using them for other purposes is not recommended. jQuery's event model can trigger an event by any name on an element, and it is propagated up the DOM tree to which that element belongs, if any.
  4443. * @see \`{@link https://api.jquery.com/category/events/event-object/ }\`
  4444. * @see \`{@link TriggeredEvent }\`
  4445. */
  4446. interface Event {
  4447. // region Copied properties
  4448. // #region Copied properties
  4449. // Event
  4450. bubbles: boolean | undefined;
  4451. cancelable: boolean | undefined;
  4452. eventPhase: number | undefined;
  4453. // UIEvent
  4454. detail: number | undefined;
  4455. view: Window | undefined;
  4456. // MouseEvent
  4457. button: number | undefined;
  4458. buttons: number | undefined;
  4459. clientX: number | undefined;
  4460. clientY: number | undefined;
  4461. offsetX: number | undefined;
  4462. offsetY: number | undefined;
  4463. /**
  4464. * The mouse position relative to the left edge of the document.
  4465. * @see \`{@link https://api.jquery.com/event.pageX/ }\`
  4466. * @since 1.0.4
  4467. * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
  4468. ```html
  4469. <!doctype html>
  4470. <html lang="en">
  4471. <head>
  4472. <meta charset="utf-8">
  4473. <title>event.pageX demo</title>
  4474. <style>
  4475. body {
  4476. background-color: #eef;
  4477. }
  4478. div {
  4479. padding: 20px;
  4480. }
  4481. </style>
  4482. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4483. </head>
  4484. <body>
  4485. <div id="log"></div>
  4486. <script>
  4487. $( document ).on( "mousemove", function( event ) {
  4488. $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
  4489. });
  4490. </script>
  4491. </body>
  4492. </html>
  4493. ```
  4494. */
  4495. pageX: number | undefined;
  4496. /**
  4497. * The mouse position relative to the top edge of the document.
  4498. * @see \`{@link https://api.jquery.com/event.pageY/ }\`
  4499. * @since 1.0.4
  4500. * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
  4501. ```html
  4502. <!doctype html>
  4503. <html lang="en">
  4504. <head>
  4505. <meta charset="utf-8">
  4506. <title>event.pageY demo</title>
  4507. <style>
  4508. body {
  4509. background-color: #eef;
  4510. }
  4511. div {
  4512. padding: 20px;
  4513. }
  4514. </style>
  4515. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4516. </head>
  4517. <body>
  4518. <div id="log"></div>
  4519. <script>
  4520. $( document ).on( "mousemove", function( event ) {
  4521. $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
  4522. });
  4523. </script>
  4524. </body>
  4525. </html>
  4526. ```
  4527. */
  4528. pageY: number | undefined;
  4529. screenX: number | undefined;
  4530. screenY: number | undefined;
  4531. /** @deprecated */
  4532. toElement: Element | undefined;
  4533. // PointerEvent
  4534. pointerId: number | undefined;
  4535. pointerType: string | undefined;
  4536. // KeyboardEvent
  4537. /** @deprecated */
  4538. char: string | undefined;
  4539. /** @deprecated */
  4540. charCode: number | undefined;
  4541. key: string | undefined;
  4542. /** @deprecated */
  4543. keyCode: number | undefined;
  4544. // TouchEvent
  4545. changedTouches: TouchList | undefined;
  4546. targetTouches: TouchList | undefined;
  4547. touches: TouchList | undefined;
  4548. // MouseEvent, KeyboardEvent
  4549. /**
  4550. * For key or mouse events, this property indicates the specific key or button that was pressed.
  4551. * @see \`{@link https://api.jquery.com/event.which/ }\`
  4552. * @since 1.1.3
  4553. * @example ​ ````Log which key was depressed.
  4554. ```html
  4555. <!doctype html>
  4556. <html lang="en">
  4557. <head>
  4558. <meta charset="utf-8">
  4559. <title>event.which demo</title>
  4560. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4561. </head>
  4562. <body>
  4563. <input id="whichkey" value="type something">
  4564. <div id="log"></div>
  4565. <script>
  4566. $( "#whichkey" ).on( "keydown", function( event ) {
  4567. $( "#log" ).html( event.type + ": " + event.which );
  4568. });
  4569. </script>
  4570. </body>
  4571. </html>
  4572. ```
  4573. * @example ​ ````Log which mouse button was depressed.
  4574. ```html
  4575. <!doctype html>
  4576. <html lang="en">
  4577. <head>
  4578. <meta charset="utf-8">
  4579. <title>event.which demo</title>
  4580. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4581. </head>
  4582. <body>
  4583. <input id="whichkey" value="click here">
  4584. <div id="log"></div>
  4585. <script>
  4586. $( "#whichkey" ).on( "mousedown", function( event ) {
  4587. $( "#log" ).html( event.type + ": " + event.which );
  4588. });
  4589. </script>
  4590. </body>
  4591. </html>
  4592. ```
  4593. */
  4594. which: number | undefined;
  4595. // MouseEvent, KeyboardEvent, TouchEvent
  4596. altKey: boolean | undefined;
  4597. ctrlKey: boolean | undefined;
  4598. /**
  4599. * Indicates whether the META key was pressed when the event fired.
  4600. * @see \`{@link https://api.jquery.com/event.metaKey/ }\`
  4601. * @since 1.0.4
  4602. * @example ​ ````Determine whether the META key was pressed when the event fired.
  4603. ```html
  4604. <!doctype html>
  4605. <html lang="en">
  4606. <head>
  4607. <meta charset="utf-8">
  4608. <title>event.metaKey demo</title>
  4609. <style>
  4610. body {
  4611. background-color: #eef;
  4612. }
  4613. div {
  4614. padding: 20px;
  4615. }
  4616. </style>
  4617. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4618. </head>
  4619. <body>
  4620. <button value="Test" name="Test" id="checkMetaKey">Click me!</button>
  4621. <div id="display"></div>
  4622. <script>
  4623. $( "#checkMetaKey" ).click(function( event ) {
  4624. $( "#display" ).text( event.metaKey );
  4625. });
  4626. </script>
  4627. </body>
  4628. </html>
  4629. ```
  4630. */
  4631. metaKey: boolean | undefined;
  4632. shiftKey: boolean | undefined;
  4633. // #endregion
  4634. /**
  4635. * The difference in milliseconds between the time the browser created the event and January 1, 1970.
  4636. * @see \`{@link https://api.jquery.com/event.timeStamp/ }\`
  4637. * @since 1.2.6
  4638. * @example ​ ````Display the time since the click handler last executed.
  4639. ```html
  4640. <!doctype html>
  4641. <html lang="en">
  4642. <head>
  4643. <meta charset="utf-8">
  4644. <title>event.timeStamp demo</title>
  4645. <style>
  4646. div {
  4647. height: 100px;
  4648. width: 300px;
  4649. margin: 10px;
  4650. background-color: #ffd;
  4651. overflow: auto;
  4652. }
  4653. </style>
  4654. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4655. </head>
  4656. <body>
  4657. <div>Click.</div>
  4658. <script>
  4659. var last, diff;
  4660. $( "div" ).click(function( event ) {
  4661. if ( last ) {
  4662. diff = event.timeStamp - last;
  4663. $( "div" ).append( "time since last event: " + diff + "<br>" );
  4664. } else {
  4665. $( "div" ).append( "Click again.<br>" );
  4666. }
  4667. last = event.timeStamp;
  4668. });
  4669. </script>
  4670. </body>
  4671. </html>
  4672. ```
  4673. */
  4674. timeStamp: number;
  4675. /**
  4676. * Describes the nature of the event.
  4677. * @see \`{@link https://api.jquery.com/event.type/ }\`
  4678. * @since 1.0
  4679. * @example ​ ````On all anchor clicks, alert the event type.
  4680. ```javascript
  4681. $( "a" ).click(function( event ) {
  4682. alert( event.type ); // "click"
  4683. });
  4684. ```
  4685. */
  4686. type: string;
  4687. /**
  4688. * Returns whether event.preventDefault() was ever called on this event object.
  4689. * @see \`{@link https://api.jquery.com/event.isDefaultPrevented/ }\`
  4690. * @since 1.3
  4691. * @example ​ ````Checks whether event.preventDefault() was called.
  4692. ```javascript
  4693. $( "a" ).click(function( event ) {
  4694. alert( event.isDefaultPrevented() ); // false
  4695. event.preventDefault();
  4696. alert( event.isDefaultPrevented() ); // true
  4697. });
  4698. ```
  4699. */
  4700. isDefaultPrevented(): boolean;
  4701. /**
  4702. * Returns whether event.stopImmediatePropagation() was ever called on this event object.
  4703. * @see \`{@link https://api.jquery.com/event.isImmediatePropagationStopped/ }\`
  4704. * @since 1.3
  4705. * @example ​ ````Checks whether event.stopImmediatePropagation() was called.
  4706. ```html
  4707. <!doctype html>
  4708. <html lang="en">
  4709. <head>
  4710. <meta charset="utf-8">
  4711. <title>event.isImmediatePropagationStopped demo</title>
  4712. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4713. </head>
  4714. <body>
  4715. <button>click me</button>
  4716. <div id="stop-log"></div>
  4717. <script>
  4718. function immediatePropStopped( event ) {
  4719. var msg = "";
  4720. if ( event.isImmediatePropagationStopped() ) {
  4721. msg = "called";
  4722. } else {
  4723. msg = "not called";
  4724. }
  4725. $( "#stop-log" ).append( "<div>" + msg + "</div>" );
  4726. }
  4727. $( "button" ).click(function( event ) {
  4728. immediatePropStopped( event );
  4729. event.stopImmediatePropagation();
  4730. immediatePropStopped( event );
  4731. });
  4732. </script>
  4733. </body>
  4734. </html>
  4735. ```
  4736. */
  4737. isImmediatePropagationStopped(): boolean;
  4738. /**
  4739. * Returns whether event.stopPropagation() was ever called on this event object.
  4740. * @see \`{@link https://api.jquery.com/event.isPropagationStopped/ }\`
  4741. * @since 1.3
  4742. * @example ​ ````Checks whether event.stopPropagation() was called
  4743. ```html
  4744. <!doctype html>
  4745. <html lang="en">
  4746. <head>
  4747. <meta charset="utf-8">
  4748. <title>event.isPropagationStopped demo</title>
  4749. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4750. </head>
  4751. <body>
  4752. <button>click me</button>
  4753. <div id="stop-log"></div>
  4754. <script>
  4755. function propStopped( event ) {
  4756. var msg = "";
  4757. if ( event.isPropagationStopped() ) {
  4758. msg = "called";
  4759. } else {
  4760. msg = "not called";
  4761. }
  4762. $( "#stop-log" ).append( "<div>" + msg + "</div>" );
  4763. }
  4764. $( "button" ).click(function(event) {
  4765. propStopped( event );
  4766. event.stopPropagation();
  4767. propStopped( event );
  4768. });
  4769. </script>
  4770. </body>
  4771. </html>
  4772. ```
  4773. */
  4774. isPropagationStopped(): boolean;
  4775. /**
  4776. * If this method is called, the default action of the event will not be triggered.
  4777. * @see \`{@link https://api.jquery.com/event.preventDefault/ }\`
  4778. * @since 1.0
  4779. * @example ​ ````Cancel the default action (navigation) of the click.
  4780. ```html
  4781. <!doctype html>
  4782. <html lang="en">
  4783. <head>
  4784. <meta charset="utf-8">
  4785. <title>event.preventDefault demo</title>
  4786. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4787. </head>
  4788. <body>
  4789. <a href="https://jquery.com">default click action is prevented</a>
  4790. <div id="log"></div>
  4791. <script>
  4792. $( "a" ).click(function( event ) {
  4793. event.preventDefault();
  4794. $( "<div>" )
  4795. .append( "default " + event.type + " prevented" )
  4796. .appendTo( "#log" );
  4797. });
  4798. </script>
  4799. </body>
  4800. </html>
  4801. ```
  4802. */
  4803. preventDefault(): void;
  4804. /**
  4805. * Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree.
  4806. * @see \`{@link https://api.jquery.com/event.stopImmediatePropagation/ }\`
  4807. * @since 1.3
  4808. * @example ​ ````Prevents other event handlers from being called.
  4809. ```html
  4810. <!doctype html>
  4811. <html lang="en">
  4812. <head>
  4813. <meta charset="utf-8">
  4814. <title>event.stopImmediatePropagation demo</title>
  4815. <style>
  4816. p {
  4817. height: 30px;
  4818. width: 150px;
  4819. background-color: #ccf;
  4820. }
  4821. div {
  4822. height: 30px;
  4823. width: 150px;
  4824. background-color: #cfc;
  4825. }
  4826. </style>
  4827. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4828. </head>
  4829. <body>
  4830. <p>paragraph</p>
  4831. <div>division</div>
  4832. <script>
  4833. $( "p" ).click(function( event ) {
  4834. event.stopImmediatePropagation();
  4835. });
  4836. $( "p" ).click(function( event ) {
  4837. // This function won't be executed
  4838. $( this ).css( "background-color", "#f00" );
  4839. });
  4840. $( "div" ).click(function( event ) {
  4841. // This function will be executed
  4842. $( this ).css( "background-color", "#f00" );
  4843. });
  4844. </script>
  4845. </body>
  4846. </html>
  4847. ```
  4848. */
  4849. stopImmediatePropagation(): void;
  4850. /**
  4851. * Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
  4852. * @see \`{@link https://api.jquery.com/event.stopPropagation/ }\`
  4853. * @since 1.0
  4854. * @example ​ ````Kill the bubbling on the click event.
  4855. ```javascript
  4856. $( "p" ).click(function( event ) {
  4857. event.stopPropagation();
  4858. // Do something
  4859. });
  4860. ```
  4861. */
  4862. stopPropagation(): void;
  4863. }
  4864. // #endregion
  4865. /**
  4866. * Base type for jQuery events that have been triggered (including events triggered on plain objects).
  4867. */
  4868. interface TriggeredEvent<
  4869. TDelegateTarget = any,
  4870. TData = any,
  4871. TCurrentTarget = any,
  4872. TTarget = any,
  4873. > extends Event {
  4874. /**
  4875. * The current DOM element within the event bubbling phase.
  4876. * @see \`{@link https://api.jquery.com/event.currentTarget/ }\`
  4877. * @since 1.3
  4878. * @example ​ ````Alert that currentTarget matches the `this` keyword.
  4879. ```javascript
  4880. $( "p" ).click(function( event ) {
  4881. alert( event.currentTarget === this ); // true
  4882. });
  4883. ```
  4884. */
  4885. currentTarget: TCurrentTarget;
  4886. /**
  4887. * The element where the currently-called jQuery event handler was attached.
  4888. * @see \`{@link https://api.jquery.com/event.delegateTarget/ }\`
  4889. * @since 1.7
  4890. * @example ​ ````When a button in any box class is clicked, change the box&#39;s background color to red.
  4891. ```javascript
  4892. $( ".box" ).on( "click", "button", function( event ) {
  4893. $( event.delegateTarget ).css( "background-color", "red" );
  4894. });
  4895. ```
  4896. */
  4897. delegateTarget: TDelegateTarget;
  4898. /**
  4899. * The DOM element that initiated the event.
  4900. * @see \`{@link https://api.jquery.com/event.target/ }\`
  4901. * @since 1.0
  4902. * @example ​ ````Display the tag&#39;s name on click
  4903. ```html
  4904. <!doctype html>
  4905. <html lang="en">
  4906. <head>
  4907. <meta charset="utf-8">
  4908. <title>event.target demo</title>
  4909. <style>
  4910. span, strong, p {
  4911. padding: 8px;
  4912. display: block;
  4913. border: 1px solid #999;
  4914. }
  4915. </style>
  4916. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4917. </head>
  4918. <body>
  4919. <div id="log"></div>
  4920. <div>
  4921. <p>
  4922. <strong><span>click</span></strong>
  4923. </p>
  4924. </div>
  4925. <script>
  4926. $( "body" ).click(function( event ) {
  4927. $( "#log" ).html( "clicked: " + event.target.nodeName );
  4928. });
  4929. </script>
  4930. </body>
  4931. </html>
  4932. ```
  4933. * @example ​ ````Implements a simple event delegation: The click handler is added to an unordered list, and the children of its li children are hidden. Clicking one of the li children toggles (see toggle()) their children.
  4934. ```html
  4935. <!doctype html>
  4936. <html lang="en">
  4937. <head>
  4938. <meta charset="utf-8">
  4939. <title>event.target demo</title>
  4940. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4941. </head>
  4942. <body>
  4943. <ul>
  4944. <li>item 1
  4945. <ul>
  4946. <li>sub item 1-a</li>
  4947. <li>sub item 1-b</li>
  4948. </ul>
  4949. </li>
  4950. <li>item 2
  4951. <ul>
  4952. <li>sub item 2-a</li>
  4953. <li>sub item 2-b</li>
  4954. </ul>
  4955. </li>
  4956. </ul>
  4957. <script>
  4958. function handler( event ) {
  4959. var target = $( event.target );
  4960. if ( target.is( "li" ) ) {
  4961. target.children().toggle();
  4962. }
  4963. }
  4964. $( "ul" ).click( handler ).find( "ul" ).hide();
  4965. </script>
  4966. </body>
  4967. </html>
  4968. ```
  4969. */
  4970. target: TTarget;
  4971. /**
  4972. * An optional object of data passed to an event method when the current executing handler is bound.
  4973. * @see \`{@link https://api.jquery.com/event.data/ }\`
  4974. * @since 1.1
  4975. * @example ​ ````Within a for loop, pass the value of i to the .on() method so that the current iteration&#39;s value is preserved.
  4976. ```html
  4977. <!doctype html>
  4978. <html lang="en">
  4979. <head>
  4980. <meta charset="utf-8">
  4981. <title>event.data demo</title>
  4982. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  4983. </head>
  4984. <body>
  4985. <button> 0 </button>
  4986. <button> 1 </button>
  4987. <button> 2 </button>
  4988. <button> 3 </button>
  4989. <button> 4 </button>
  4990. <div id="log"></div>
  4991. <script>
  4992. var logDiv = $( "#log" );
  4993. for ( var i = 0; i < 5; i++ ) {
  4994. $( "button" ).eq( i ).on( "click", { value: i }, function( event ) {
  4995. var msgs = [
  4996. "button = " + $( this ).index(),
  4997. "event.data.value = " + event.data.value,
  4998. "i = " + i
  4999. ];
  5000. logDiv.append( msgs.join( ", " ) + "<br>" );
  5001. });
  5002. }
  5003. </script>
  5004. </body>
  5005. </html>
  5006. ```
  5007. */
  5008. data: TData;
  5009. /**
  5010. * The namespace specified when the event was triggered.
  5011. * @see \`{@link https://api.jquery.com/event.namespace/ }\`
  5012. * @since 1.4.3
  5013. * @example ​ ````Determine the event namespace used.
  5014. ```html
  5015. <!doctype html>
  5016. <html lang="en">
  5017. <head>
  5018. <meta charset="utf-8">
  5019. <title>event.namespace demo</title>
  5020. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5021. </head>
  5022. <body>
  5023. <button>display event.namespace</button>
  5024. <p></p>
  5025. <script>
  5026. $( "p" ).on( "test.something", function( event ) {
  5027. alert( event.namespace );
  5028. });
  5029. $( "button" ).click(function( event ) {
  5030. $( "p" ).trigger( "test.something" );
  5031. });
  5032. </script>
  5033. </body>
  5034. </html>
  5035. ```
  5036. */
  5037. namespace?: string | undefined;
  5038. originalEvent?: _Event | undefined;
  5039. /**
  5040. * The last value returned by an event handler that was triggered by this event, unless the value was undefined.
  5041. * @see \`{@link https://api.jquery.com/event.result/ }\`
  5042. * @since 1.3
  5043. * @example ​ ````Display previous handler&#39;s return value
  5044. ```html
  5045. <!doctype html>
  5046. <html lang="en">
  5047. <head>
  5048. <meta charset="utf-8">
  5049. <title>event.result demo</title>
  5050. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5051. </head>
  5052. <body>
  5053. <button>display event.result</button>
  5054. <p></p>
  5055. <script>
  5056. $( "button" ).click(function( event ) {
  5057. return "hey";
  5058. });
  5059. $( "button" ).click(function( event ) {
  5060. $( "p" ).html( event.result );
  5061. });
  5062. </script>
  5063. </body>
  5064. </html>
  5065. ```
  5066. */
  5067. result?: any;
  5068. }
  5069. // region Event
  5070. // #region Event
  5071. interface EventBase<
  5072. TDelegateTarget = any,
  5073. TData = any,
  5074. TCurrentTarget = any,
  5075. TTarget = any,
  5076. > extends TriggeredEvent<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5077. /**
  5078. * The other DOM element involved in the event, if any.
  5079. * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
  5080. * @since 1.1.4
  5081. * @example ​ ````On mouseout of anchors, alert the element type being entered.
  5082. ```javascript
  5083. $( "a" ).mouseout(function( event ) {
  5084. alert( event.relatedTarget.nodeName ); // "DIV"
  5085. });
  5086. ```
  5087. */
  5088. relatedTarget?: undefined;
  5089. // Event
  5090. bubbles: boolean;
  5091. cancelable: boolean;
  5092. eventPhase: number;
  5093. // UIEvent
  5094. detail: undefined;
  5095. view: undefined;
  5096. // MouseEvent
  5097. button: undefined;
  5098. buttons: undefined;
  5099. clientX: undefined;
  5100. clientY: undefined;
  5101. offsetX: undefined;
  5102. offsetY: undefined;
  5103. /**
  5104. * The mouse position relative to the left edge of the document.
  5105. * @see \`{@link https://api.jquery.com/event.pageX/ }\`
  5106. * @since 1.0.4
  5107. * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
  5108. ```html
  5109. <!doctype html>
  5110. <html lang="en">
  5111. <head>
  5112. <meta charset="utf-8">
  5113. <title>event.pageX demo</title>
  5114. <style>
  5115. body {
  5116. background-color: #eef;
  5117. }
  5118. div {
  5119. padding: 20px;
  5120. }
  5121. </style>
  5122. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5123. </head>
  5124. <body>
  5125. <div id="log"></div>
  5126. <script>
  5127. $( document ).on( "mousemove", function( event ) {
  5128. $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
  5129. });
  5130. </script>
  5131. </body>
  5132. </html>
  5133. ```
  5134. */
  5135. pageX: undefined;
  5136. /**
  5137. * The mouse position relative to the top edge of the document.
  5138. * @see \`{@link https://api.jquery.com/event.pageY/ }\`
  5139. * @since 1.0.4
  5140. * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
  5141. ```html
  5142. <!doctype html>
  5143. <html lang="en">
  5144. <head>
  5145. <meta charset="utf-8">
  5146. <title>event.pageY demo</title>
  5147. <style>
  5148. body {
  5149. background-color: #eef;
  5150. }
  5151. div {
  5152. padding: 20px;
  5153. }
  5154. </style>
  5155. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5156. </head>
  5157. <body>
  5158. <div id="log"></div>
  5159. <script>
  5160. $( document ).on( "mousemove", function( event ) {
  5161. $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
  5162. });
  5163. </script>
  5164. </body>
  5165. </html>
  5166. ```
  5167. */
  5168. pageY: undefined;
  5169. screenX: undefined;
  5170. screenY: undefined;
  5171. /** @deprecated */
  5172. toElement: undefined;
  5173. // PointerEvent
  5174. pointerId: undefined;
  5175. pointerType: undefined;
  5176. // KeyboardEvent
  5177. /** @deprecated */
  5178. char: undefined;
  5179. /** @deprecated */
  5180. charCode: undefined;
  5181. key: undefined;
  5182. /** @deprecated */
  5183. keyCode: undefined;
  5184. // TouchEvent
  5185. changedTouches: undefined;
  5186. targetTouches: undefined;
  5187. touches: undefined;
  5188. // MouseEvent, KeyboardEvent
  5189. /**
  5190. * For key or mouse events, this property indicates the specific key or button that was pressed.
  5191. * @see \`{@link https://api.jquery.com/event.which/ }\`
  5192. * @since 1.1.3
  5193. * @example ​ ````Log which key was depressed.
  5194. ```html
  5195. <!doctype html>
  5196. <html lang="en">
  5197. <head>
  5198. <meta charset="utf-8">
  5199. <title>event.which demo</title>
  5200. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5201. </head>
  5202. <body>
  5203. <input id="whichkey" value="type something">
  5204. <div id="log"></div>
  5205. <script>
  5206. $( "#whichkey" ).on( "keydown", function( event ) {
  5207. $( "#log" ).html( event.type + ": " + event.which );
  5208. });
  5209. </script>
  5210. </body>
  5211. </html>
  5212. ```
  5213. * @example ​ ````Log which mouse button was depressed.
  5214. ```html
  5215. <!doctype html>
  5216. <html lang="en">
  5217. <head>
  5218. <meta charset="utf-8">
  5219. <title>event.which demo</title>
  5220. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5221. </head>
  5222. <body>
  5223. <input id="whichkey" value="click here">
  5224. <div id="log"></div>
  5225. <script>
  5226. $( "#whichkey" ).on( "mousedown", function( event ) {
  5227. $( "#log" ).html( event.type + ": " + event.which );
  5228. });
  5229. </script>
  5230. </body>
  5231. </html>
  5232. ```
  5233. */
  5234. which: undefined;
  5235. // MouseEvent, KeyboardEvent, TouchEvent
  5236. altKey: undefined;
  5237. ctrlKey: undefined;
  5238. /**
  5239. * Indicates whether the META key was pressed when the event fired.
  5240. * @see \`{@link https://api.jquery.com/event.metaKey/ }\`
  5241. * @since 1.0.4
  5242. * @example ​ ````Determine whether the META key was pressed when the event fired.
  5243. ```html
  5244. <!doctype html>
  5245. <html lang="en">
  5246. <head>
  5247. <meta charset="utf-8">
  5248. <title>event.metaKey demo</title>
  5249. <style>
  5250. body {
  5251. background-color: #eef;
  5252. }
  5253. div {
  5254. padding: 20px;
  5255. }
  5256. </style>
  5257. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5258. </head>
  5259. <body>
  5260. <button value="Test" name="Test" id="checkMetaKey">Click me!</button>
  5261. <div id="display"></div>
  5262. <script>
  5263. $( "#checkMetaKey" ).click(function( event ) {
  5264. $( "#display" ).text( event.metaKey );
  5265. });
  5266. </script>
  5267. </body>
  5268. </html>
  5269. ```
  5270. */
  5271. metaKey: undefined;
  5272. shiftKey: undefined;
  5273. originalEvent?: _Event | undefined;
  5274. }
  5275. interface ChangeEvent<
  5276. TDelegateTarget = any,
  5277. TData = any,
  5278. TCurrentTarget = any,
  5279. TTarget = any,
  5280. > extends EventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5281. type: "change";
  5282. }
  5283. interface ResizeEvent<
  5284. TDelegateTarget = any,
  5285. TData = any,
  5286. TCurrentTarget = any,
  5287. TTarget = any,
  5288. > extends EventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5289. type: "resize";
  5290. }
  5291. interface ScrollEvent<
  5292. TDelegateTarget = any,
  5293. TData = any,
  5294. TCurrentTarget = any,
  5295. TTarget = any,
  5296. > extends EventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5297. type: "scroll";
  5298. }
  5299. interface SelectEvent<
  5300. TDelegateTarget = any,
  5301. TData = any,
  5302. TCurrentTarget = any,
  5303. TTarget = any,
  5304. > extends EventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5305. type: "select";
  5306. }
  5307. interface SubmitEvent<
  5308. TDelegateTarget = any,
  5309. TData = any,
  5310. TCurrentTarget = any,
  5311. TTarget = any,
  5312. > extends EventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5313. type: "submit";
  5314. }
  5315. // #endregion
  5316. // region UIEvent
  5317. // #region UIEvent
  5318. interface UIEventBase<
  5319. TDelegateTarget = any,
  5320. TData = any,
  5321. TCurrentTarget = any,
  5322. TTarget = any,
  5323. > extends TriggeredEvent<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5324. // Event
  5325. bubbles: boolean;
  5326. cancelable: boolean;
  5327. eventPhase: number;
  5328. // UIEvent
  5329. detail: number;
  5330. view: Window;
  5331. originalEvent?: _UIEvent | undefined;
  5332. }
  5333. // region MouseEvent
  5334. // #region MouseEvent
  5335. interface MouseEventBase<
  5336. TDelegateTarget = any,
  5337. TData = any,
  5338. TCurrentTarget = any,
  5339. TTarget = any,
  5340. > extends UIEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5341. /**
  5342. * The other DOM element involved in the event, if any.
  5343. * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
  5344. * @since 1.1.4
  5345. * @example ​ ````On mouseout of anchors, alert the element type being entered.
  5346. ```javascript
  5347. $( "a" ).mouseout(function( event ) {
  5348. alert( event.relatedTarget.nodeName ); // "DIV"
  5349. });
  5350. ```
  5351. */
  5352. relatedTarget?: EventTarget | null | undefined;
  5353. // MouseEvent
  5354. button: number;
  5355. buttons: number;
  5356. clientX: number;
  5357. clientY: number;
  5358. offsetX: number;
  5359. offsetY: number;
  5360. /**
  5361. * The mouse position relative to the left edge of the document.
  5362. * @see \`{@link https://api.jquery.com/event.pageX/ }\`
  5363. * @since 1.0.4
  5364. * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
  5365. ```html
  5366. <!doctype html>
  5367. <html lang="en">
  5368. <head>
  5369. <meta charset="utf-8">
  5370. <title>event.pageX demo</title>
  5371. <style>
  5372. body {
  5373. background-color: #eef;
  5374. }
  5375. div {
  5376. padding: 20px;
  5377. }
  5378. </style>
  5379. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5380. </head>
  5381. <body>
  5382. <div id="log"></div>
  5383. <script>
  5384. $( document ).on( "mousemove", function( event ) {
  5385. $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
  5386. });
  5387. </script>
  5388. </body>
  5389. </html>
  5390. ```
  5391. */
  5392. pageX: number;
  5393. /**
  5394. * The mouse position relative to the top edge of the document.
  5395. * @see \`{@link https://api.jquery.com/event.pageY/ }\`
  5396. * @since 1.0.4
  5397. * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
  5398. ```html
  5399. <!doctype html>
  5400. <html lang="en">
  5401. <head>
  5402. <meta charset="utf-8">
  5403. <title>event.pageY demo</title>
  5404. <style>
  5405. body {
  5406. background-color: #eef;
  5407. }
  5408. div {
  5409. padding: 20px;
  5410. }
  5411. </style>
  5412. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5413. </head>
  5414. <body>
  5415. <div id="log"></div>
  5416. <script>
  5417. $( document ).on( "mousemove", function( event ) {
  5418. $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
  5419. });
  5420. </script>
  5421. </body>
  5422. </html>
  5423. ```
  5424. */
  5425. pageY: number;
  5426. screenX: number;
  5427. screenY: number;
  5428. /** @deprecated */
  5429. toElement: Element;
  5430. // PointerEvent
  5431. pointerId: undefined;
  5432. pointerType: undefined;
  5433. // KeyboardEvent
  5434. /** @deprecated */
  5435. char: undefined;
  5436. /** @deprecated */
  5437. charCode: undefined;
  5438. key: undefined;
  5439. /** @deprecated */
  5440. keyCode: undefined;
  5441. // TouchEvent
  5442. changedTouches: undefined;
  5443. targetTouches: undefined;
  5444. touches: undefined;
  5445. // MouseEvent, KeyboardEvent
  5446. /**
  5447. * For key or mouse events, this property indicates the specific key or button that was pressed.
  5448. * @see \`{@link https://api.jquery.com/event.which/ }\`
  5449. * @since 1.1.3
  5450. * @example ​ ````Log which key was depressed.
  5451. ```html
  5452. <!doctype html>
  5453. <html lang="en">
  5454. <head>
  5455. <meta charset="utf-8">
  5456. <title>event.which demo</title>
  5457. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5458. </head>
  5459. <body>
  5460. <input id="whichkey" value="type something">
  5461. <div id="log"></div>
  5462. <script>
  5463. $( "#whichkey" ).on( "keydown", function( event ) {
  5464. $( "#log" ).html( event.type + ": " + event.which );
  5465. });
  5466. </script>
  5467. </body>
  5468. </html>
  5469. ```
  5470. * @example ​ ````Log which mouse button was depressed.
  5471. ```html
  5472. <!doctype html>
  5473. <html lang="en">
  5474. <head>
  5475. <meta charset="utf-8">
  5476. <title>event.which demo</title>
  5477. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5478. </head>
  5479. <body>
  5480. <input id="whichkey" value="click here">
  5481. <div id="log"></div>
  5482. <script>
  5483. $( "#whichkey" ).on( "mousedown", function( event ) {
  5484. $( "#log" ).html( event.type + ": " + event.which );
  5485. });
  5486. </script>
  5487. </body>
  5488. </html>
  5489. ```
  5490. */
  5491. which: number;
  5492. // MouseEvent, KeyboardEvent, TouchEvent
  5493. altKey: boolean;
  5494. ctrlKey: boolean;
  5495. /**
  5496. * Indicates whether the META key was pressed when the event fired.
  5497. * @see \`{@link https://api.jquery.com/event.metaKey/ }\`
  5498. * @since 1.0.4
  5499. * @example ​ ````Determine whether the META key was pressed when the event fired.
  5500. ```html
  5501. <!doctype html>
  5502. <html lang="en">
  5503. <head>
  5504. <meta charset="utf-8">
  5505. <title>event.metaKey demo</title>
  5506. <style>
  5507. body {
  5508. background-color: #eef;
  5509. }
  5510. div {
  5511. padding: 20px;
  5512. }
  5513. </style>
  5514. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5515. </head>
  5516. <body>
  5517. <button value="Test" name="Test" id="checkMetaKey">Click me!</button>
  5518. <div id="display"></div>
  5519. <script>
  5520. $( "#checkMetaKey" ).click(function( event ) {
  5521. $( "#display" ).text( event.metaKey );
  5522. });
  5523. </script>
  5524. </body>
  5525. </html>
  5526. ```
  5527. */
  5528. metaKey: boolean;
  5529. shiftKey: boolean;
  5530. originalEvent?: _MouseEvent | undefined;
  5531. }
  5532. interface ClickEvent<
  5533. TDelegateTarget = any,
  5534. TData = any,
  5535. TCurrentTarget = any,
  5536. TTarget = any,
  5537. > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5538. /**
  5539. * The other DOM element involved in the event, if any.
  5540. * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
  5541. * @since 1.1.4
  5542. * @example ​ ````On mouseout of anchors, alert the element type being entered.
  5543. ```javascript
  5544. $( "a" ).mouseout(function( event ) {
  5545. alert( event.relatedTarget.nodeName ); // "DIV"
  5546. });
  5547. ```
  5548. */
  5549. relatedTarget?: null | undefined;
  5550. type: "click";
  5551. }
  5552. interface ContextMenuEvent<
  5553. TDelegateTarget = any,
  5554. TData = any,
  5555. TCurrentTarget = any,
  5556. TTarget = any,
  5557. > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5558. /**
  5559. * The other DOM element involved in the event, if any.
  5560. * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
  5561. * @since 1.1.4
  5562. * @example ​ ````On mouseout of anchors, alert the element type being entered.
  5563. ```javascript
  5564. $( "a" ).mouseout(function( event ) {
  5565. alert( event.relatedTarget.nodeName ); // "DIV"
  5566. });
  5567. ```
  5568. */
  5569. relatedTarget?: null | undefined;
  5570. type: "contextmenu";
  5571. }
  5572. interface DoubleClickEvent<
  5573. TDelegateTarget = any,
  5574. TData = any,
  5575. TCurrentTarget = any,
  5576. TTarget = any,
  5577. > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5578. /**
  5579. * The other DOM element involved in the event, if any.
  5580. * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
  5581. * @since 1.1.4
  5582. * @example ​ ````On mouseout of anchors, alert the element type being entered.
  5583. ```javascript
  5584. $( "a" ).mouseout(function( event ) {
  5585. alert( event.relatedTarget.nodeName ); // "DIV"
  5586. });
  5587. ```
  5588. */
  5589. relatedTarget?: null | undefined;
  5590. type: "dblclick";
  5591. }
  5592. interface MouseDownEvent<
  5593. TDelegateTarget = any,
  5594. TData = any,
  5595. TCurrentTarget = any,
  5596. TTarget = any,
  5597. > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5598. /**
  5599. * The other DOM element involved in the event, if any.
  5600. * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
  5601. * @since 1.1.4
  5602. * @example ​ ````On mouseout of anchors, alert the element type being entered.
  5603. ```javascript
  5604. $( "a" ).mouseout(function( event ) {
  5605. alert( event.relatedTarget.nodeName ); // "DIV"
  5606. });
  5607. ```
  5608. */
  5609. relatedTarget?: null | undefined;
  5610. type: "mousedown";
  5611. }
  5612. interface MouseEnterEvent<
  5613. TDelegateTarget = any,
  5614. TData = any,
  5615. TCurrentTarget = any,
  5616. TTarget = any,
  5617. > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5618. // Special handling by jQuery.
  5619. type: "mouseover";
  5620. }
  5621. interface MouseLeaveEvent<
  5622. TDelegateTarget = any,
  5623. TData = any,
  5624. TCurrentTarget = any,
  5625. TTarget = any,
  5626. > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5627. // Special handling by jQuery.
  5628. type: "mouseout";
  5629. }
  5630. interface MouseMoveEvent<
  5631. TDelegateTarget = any,
  5632. TData = any,
  5633. TCurrentTarget = any,
  5634. TTarget = any,
  5635. > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5636. /**
  5637. * The other DOM element involved in the event, if any.
  5638. * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
  5639. * @since 1.1.4
  5640. * @example ​ ````On mouseout of anchors, alert the element type being entered.
  5641. ```javascript
  5642. $( "a" ).mouseout(function( event ) {
  5643. alert( event.relatedTarget.nodeName ); // "DIV"
  5644. });
  5645. ```
  5646. */
  5647. relatedTarget?: null | undefined;
  5648. type: "mousemove";
  5649. }
  5650. interface MouseOutEvent<
  5651. TDelegateTarget = any,
  5652. TData = any,
  5653. TCurrentTarget = any,
  5654. TTarget = any,
  5655. > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5656. type: "mouseout";
  5657. }
  5658. interface MouseOverEvent<
  5659. TDelegateTarget = any,
  5660. TData = any,
  5661. TCurrentTarget = any,
  5662. TTarget = any,
  5663. > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5664. type: "mouseover";
  5665. }
  5666. interface MouseUpEvent<
  5667. TDelegateTarget = any,
  5668. TData = any,
  5669. TCurrentTarget = any,
  5670. TTarget = any,
  5671. > extends MouseEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5672. /**
  5673. * The other DOM element involved in the event, if any.
  5674. * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
  5675. * @since 1.1.4
  5676. * @example ​ ````On mouseout of anchors, alert the element type being entered.
  5677. ```javascript
  5678. $( "a" ).mouseout(function( event ) {
  5679. alert( event.relatedTarget.nodeName ); // "DIV"
  5680. });
  5681. ```
  5682. */
  5683. relatedTarget?: null | undefined;
  5684. type: "mouseup";
  5685. }
  5686. // region DragEvent
  5687. // #region DragEvent
  5688. interface DragEventBase<
  5689. TDelegateTarget = any,
  5690. TData = any,
  5691. TCurrentTarget = any,
  5692. TTarget = any,
  5693. > extends UIEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5694. originalEvent?: _DragEvent | undefined;
  5695. }
  5696. interface DragEvent<
  5697. TDelegateTarget = any,
  5698. TData = any,
  5699. TCurrentTarget = any,
  5700. TTarget = any,
  5701. > extends DragEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5702. type: "drag";
  5703. }
  5704. interface DragEndEvent<
  5705. TDelegateTarget = any,
  5706. TData = any,
  5707. TCurrentTarget = any,
  5708. TTarget = any,
  5709. > extends DragEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5710. type: "dragend";
  5711. }
  5712. interface DragEnterEvent<
  5713. TDelegateTarget = any,
  5714. TData = any,
  5715. TCurrentTarget = any,
  5716. TTarget = any,
  5717. > extends DragEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5718. type: "dragenter";
  5719. }
  5720. interface DragExitEvent<
  5721. TDelegateTarget = any,
  5722. TData = any,
  5723. TCurrentTarget = any,
  5724. TTarget = any,
  5725. > extends DragEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5726. type: "dragexit";
  5727. }
  5728. interface DragLeaveEvent<
  5729. TDelegateTarget = any,
  5730. TData = any,
  5731. TCurrentTarget = any,
  5732. TTarget = any,
  5733. > extends DragEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5734. type: "dragleave";
  5735. }
  5736. interface DragOverEvent<
  5737. TDelegateTarget = any,
  5738. TData = any,
  5739. TCurrentTarget = any,
  5740. TTarget = any,
  5741. > extends DragEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5742. type: "dragover";
  5743. }
  5744. interface DragStartEvent<
  5745. TDelegateTarget = any,
  5746. TData = any,
  5747. TCurrentTarget = any,
  5748. TTarget = any,
  5749. > extends DragEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5750. type: "dragstart";
  5751. }
  5752. interface DropEvent<
  5753. TDelegateTarget = any,
  5754. TData = any,
  5755. TCurrentTarget = any,
  5756. TTarget = any,
  5757. > extends DragEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5758. type: "drop";
  5759. }
  5760. // #endregion
  5761. // #endregion
  5762. // region KeyboardEvent
  5763. // #region KeyboardEvent
  5764. interface KeyboardEventBase<
  5765. TDelegateTarget = any,
  5766. TData = any,
  5767. TCurrentTarget = any,
  5768. TTarget = any,
  5769. > extends UIEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5770. /**
  5771. * The other DOM element involved in the event, if any.
  5772. * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
  5773. * @since 1.1.4
  5774. * @example ​ ````On mouseout of anchors, alert the element type being entered.
  5775. ```javascript
  5776. $( "a" ).mouseout(function( event ) {
  5777. alert( event.relatedTarget.nodeName ); // "DIV"
  5778. });
  5779. ```
  5780. */
  5781. relatedTarget?: undefined;
  5782. // MouseEvent
  5783. button: undefined;
  5784. buttons: undefined;
  5785. clientX: undefined;
  5786. clientY: undefined;
  5787. offsetX: undefined;
  5788. offsetY: undefined;
  5789. /**
  5790. * The mouse position relative to the left edge of the document.
  5791. * @see \`{@link https://api.jquery.com/event.pageX/ }\`
  5792. * @since 1.0.4
  5793. * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
  5794. ```html
  5795. <!doctype html>
  5796. <html lang="en">
  5797. <head>
  5798. <meta charset="utf-8">
  5799. <title>event.pageX demo</title>
  5800. <style>
  5801. body {
  5802. background-color: #eef;
  5803. }
  5804. div {
  5805. padding: 20px;
  5806. }
  5807. </style>
  5808. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5809. </head>
  5810. <body>
  5811. <div id="log"></div>
  5812. <script>
  5813. $( document ).on( "mousemove", function( event ) {
  5814. $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
  5815. });
  5816. </script>
  5817. </body>
  5818. </html>
  5819. ```
  5820. */
  5821. pageX: undefined;
  5822. /**
  5823. * The mouse position relative to the top edge of the document.
  5824. * @see \`{@link https://api.jquery.com/event.pageY/ }\`
  5825. * @since 1.0.4
  5826. * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
  5827. ```html
  5828. <!doctype html>
  5829. <html lang="en">
  5830. <head>
  5831. <meta charset="utf-8">
  5832. <title>event.pageY demo</title>
  5833. <style>
  5834. body {
  5835. background-color: #eef;
  5836. }
  5837. div {
  5838. padding: 20px;
  5839. }
  5840. </style>
  5841. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5842. </head>
  5843. <body>
  5844. <div id="log"></div>
  5845. <script>
  5846. $( document ).on( "mousemove", function( event ) {
  5847. $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
  5848. });
  5849. </script>
  5850. </body>
  5851. </html>
  5852. ```
  5853. */
  5854. pageY: undefined;
  5855. screenX: undefined;
  5856. screenY: undefined;
  5857. /** @deprecated */
  5858. toElement: undefined;
  5859. // PointerEvent
  5860. pointerId: undefined;
  5861. pointerType: undefined;
  5862. // KeyboardEvent
  5863. /** @deprecated */
  5864. char: string | undefined;
  5865. /** @deprecated */
  5866. charCode: number;
  5867. code: string;
  5868. key: string;
  5869. /** @deprecated */
  5870. keyCode: number;
  5871. // TouchEvent
  5872. changedTouches: undefined;
  5873. targetTouches: undefined;
  5874. touches: undefined;
  5875. // MouseEvent, KeyboardEvent
  5876. /**
  5877. * For key or mouse events, this property indicates the specific key or button that was pressed.
  5878. * @see \`{@link https://api.jquery.com/event.which/ }\`
  5879. * @since 1.1.3
  5880. * @example ​ ````Log which key was depressed.
  5881. ```html
  5882. <!doctype html>
  5883. <html lang="en">
  5884. <head>
  5885. <meta charset="utf-8">
  5886. <title>event.which demo</title>
  5887. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5888. </head>
  5889. <body>
  5890. <input id="whichkey" value="type something">
  5891. <div id="log"></div>
  5892. <script>
  5893. $( "#whichkey" ).on( "keydown", function( event ) {
  5894. $( "#log" ).html( event.type + ": " + event.which );
  5895. });
  5896. </script>
  5897. </body>
  5898. </html>
  5899. ```
  5900. * @example ​ ````Log which mouse button was depressed.
  5901. ```html
  5902. <!doctype html>
  5903. <html lang="en">
  5904. <head>
  5905. <meta charset="utf-8">
  5906. <title>event.which demo</title>
  5907. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5908. </head>
  5909. <body>
  5910. <input id="whichkey" value="click here">
  5911. <div id="log"></div>
  5912. <script>
  5913. $( "#whichkey" ).on( "mousedown", function( event ) {
  5914. $( "#log" ).html( event.type + ": " + event.which );
  5915. });
  5916. </script>
  5917. </body>
  5918. </html>
  5919. ```
  5920. */
  5921. which: number;
  5922. // MouseEvent, KeyboardEvent, TouchEvent
  5923. altKey: boolean;
  5924. ctrlKey: boolean;
  5925. /**
  5926. * Indicates whether the META key was pressed when the event fired.
  5927. * @see \`{@link https://api.jquery.com/event.metaKey/ }\`
  5928. * @since 1.0.4
  5929. * @example ​ ````Determine whether the META key was pressed when the event fired.
  5930. ```html
  5931. <!doctype html>
  5932. <html lang="en">
  5933. <head>
  5934. <meta charset="utf-8">
  5935. <title>event.metaKey demo</title>
  5936. <style>
  5937. body {
  5938. background-color: #eef;
  5939. }
  5940. div {
  5941. padding: 20px;
  5942. }
  5943. </style>
  5944. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  5945. </head>
  5946. <body>
  5947. <button value="Test" name="Test" id="checkMetaKey">Click me!</button>
  5948. <div id="display"></div>
  5949. <script>
  5950. $( "#checkMetaKey" ).click(function( event ) {
  5951. $( "#display" ).text( event.metaKey );
  5952. });
  5953. </script>
  5954. </body>
  5955. </html>
  5956. ```
  5957. */
  5958. metaKey: boolean;
  5959. shiftKey: boolean;
  5960. originalEvent?: _KeyboardEvent | undefined;
  5961. }
  5962. interface KeyDownEvent<
  5963. TDelegateTarget = any,
  5964. TData = any,
  5965. TCurrentTarget = any,
  5966. TTarget = any,
  5967. > extends KeyboardEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5968. type: "keydown";
  5969. }
  5970. interface KeyPressEvent<
  5971. TDelegateTarget = any,
  5972. TData = any,
  5973. TCurrentTarget = any,
  5974. TTarget = any,
  5975. > extends KeyboardEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5976. type: "keypress";
  5977. }
  5978. interface KeyUpEvent<
  5979. TDelegateTarget = any,
  5980. TData = any,
  5981. TCurrentTarget = any,
  5982. TTarget = any,
  5983. > extends KeyboardEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5984. type: "keyup";
  5985. }
  5986. // #endregion
  5987. // region TouchEvent
  5988. // #region TouchEvent
  5989. interface TouchEventBase<
  5990. TDelegateTarget = any,
  5991. TData = any,
  5992. TCurrentTarget = any,
  5993. TTarget = any,
  5994. > extends UIEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  5995. /**
  5996. * The other DOM element involved in the event, if any.
  5997. * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
  5998. * @since 1.1.4
  5999. * @example ​ ````On mouseout of anchors, alert the element type being entered.
  6000. ```javascript
  6001. $( "a" ).mouseout(function( event ) {
  6002. alert( event.relatedTarget.nodeName ); // "DIV"
  6003. });
  6004. ```
  6005. */
  6006. relatedTarget?: undefined;
  6007. // MouseEvent
  6008. button: undefined;
  6009. buttons: undefined;
  6010. clientX: undefined;
  6011. clientY: undefined;
  6012. offsetX: undefined;
  6013. offsetY: undefined;
  6014. /**
  6015. * The mouse position relative to the left edge of the document.
  6016. * @see \`{@link https://api.jquery.com/event.pageX/ }\`
  6017. * @since 1.0.4
  6018. * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
  6019. ```html
  6020. <!doctype html>
  6021. <html lang="en">
  6022. <head>
  6023. <meta charset="utf-8">
  6024. <title>event.pageX demo</title>
  6025. <style>
  6026. body {
  6027. background-color: #eef;
  6028. }
  6029. div {
  6030. padding: 20px;
  6031. }
  6032. </style>
  6033. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6034. </head>
  6035. <body>
  6036. <div id="log"></div>
  6037. <script>
  6038. $( document ).on( "mousemove", function( event ) {
  6039. $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
  6040. });
  6041. </script>
  6042. </body>
  6043. </html>
  6044. ```
  6045. */
  6046. pageX: undefined;
  6047. /**
  6048. * The mouse position relative to the top edge of the document.
  6049. * @see \`{@link https://api.jquery.com/event.pageY/ }\`
  6050. * @since 1.0.4
  6051. * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
  6052. ```html
  6053. <!doctype html>
  6054. <html lang="en">
  6055. <head>
  6056. <meta charset="utf-8">
  6057. <title>event.pageY demo</title>
  6058. <style>
  6059. body {
  6060. background-color: #eef;
  6061. }
  6062. div {
  6063. padding: 20px;
  6064. }
  6065. </style>
  6066. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6067. </head>
  6068. <body>
  6069. <div id="log"></div>
  6070. <script>
  6071. $( document ).on( "mousemove", function( event ) {
  6072. $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
  6073. });
  6074. </script>
  6075. </body>
  6076. </html>
  6077. ```
  6078. */
  6079. pageY: undefined;
  6080. screenX: undefined;
  6081. screenY: undefined;
  6082. /** @deprecated */
  6083. toElement: undefined;
  6084. // PointerEvent
  6085. pointerId: undefined;
  6086. pointerType: undefined;
  6087. // KeyboardEvent
  6088. /** @deprecated */
  6089. char: undefined;
  6090. /** @deprecated */
  6091. charCode: undefined;
  6092. key: undefined;
  6093. /** @deprecated */
  6094. keyCode: undefined;
  6095. // TouchEvent
  6096. changedTouches: TouchList;
  6097. targetTouches: TouchList;
  6098. touches: TouchList;
  6099. // MouseEvent, KeyboardEvent
  6100. /**
  6101. * For key or mouse events, this property indicates the specific key or button that was pressed.
  6102. * @see \`{@link https://api.jquery.com/event.which/ }\`
  6103. * @since 1.1.3
  6104. * @example ​ ````Log which key was depressed.
  6105. ```html
  6106. <!doctype html>
  6107. <html lang="en">
  6108. <head>
  6109. <meta charset="utf-8">
  6110. <title>event.which demo</title>
  6111. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6112. </head>
  6113. <body>
  6114. <input id="whichkey" value="type something">
  6115. <div id="log"></div>
  6116. <script>
  6117. $( "#whichkey" ).on( "keydown", function( event ) {
  6118. $( "#log" ).html( event.type + ": " + event.which );
  6119. });
  6120. </script>
  6121. </body>
  6122. </html>
  6123. ```
  6124. * @example ​ ````Log which mouse button was depressed.
  6125. ```html
  6126. <!doctype html>
  6127. <html lang="en">
  6128. <head>
  6129. <meta charset="utf-8">
  6130. <title>event.which demo</title>
  6131. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6132. </head>
  6133. <body>
  6134. <input id="whichkey" value="click here">
  6135. <div id="log"></div>
  6136. <script>
  6137. $( "#whichkey" ).on( "mousedown", function( event ) {
  6138. $( "#log" ).html( event.type + ": " + event.which );
  6139. });
  6140. </script>
  6141. </body>
  6142. </html>
  6143. ```
  6144. */
  6145. which: undefined;
  6146. // MouseEvent, KeyboardEvent, TouchEvent
  6147. altKey: boolean;
  6148. ctrlKey: boolean;
  6149. /**
  6150. * Indicates whether the META key was pressed when the event fired.
  6151. * @see \`{@link https://api.jquery.com/event.metaKey/ }\`
  6152. * @since 1.0.4
  6153. * @example ​ ````Determine whether the META key was pressed when the event fired.
  6154. ```html
  6155. <!doctype html>
  6156. <html lang="en">
  6157. <head>
  6158. <meta charset="utf-8">
  6159. <title>event.metaKey demo</title>
  6160. <style>
  6161. body {
  6162. background-color: #eef;
  6163. }
  6164. div {
  6165. padding: 20px;
  6166. }
  6167. </style>
  6168. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6169. </head>
  6170. <body>
  6171. <button value="Test" name="Test" id="checkMetaKey">Click me!</button>
  6172. <div id="display"></div>
  6173. <script>
  6174. $( "#checkMetaKey" ).click(function( event ) {
  6175. $( "#display" ).text( event.metaKey );
  6176. });
  6177. </script>
  6178. </body>
  6179. </html>
  6180. ```
  6181. */
  6182. metaKey: boolean;
  6183. shiftKey: boolean;
  6184. originalEvent?: _TouchEvent | undefined;
  6185. }
  6186. interface TouchCancelEvent<
  6187. TDelegateTarget = any,
  6188. TData = any,
  6189. TCurrentTarget = any,
  6190. TTarget = any,
  6191. > extends TouchEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  6192. type: "touchcancel";
  6193. }
  6194. interface TouchEndEvent<
  6195. TDelegateTarget = any,
  6196. TData = any,
  6197. TCurrentTarget = any,
  6198. TTarget = any,
  6199. > extends TouchEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  6200. type: "touchend";
  6201. }
  6202. interface TouchMoveEvent<
  6203. TDelegateTarget = any,
  6204. TData = any,
  6205. TCurrentTarget = any,
  6206. TTarget = any,
  6207. > extends TouchEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  6208. type: "touchmove";
  6209. }
  6210. interface TouchStartEvent<
  6211. TDelegateTarget = any,
  6212. TData = any,
  6213. TCurrentTarget = any,
  6214. TTarget = any,
  6215. > extends TouchEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  6216. type: "touchstart";
  6217. }
  6218. // #endregion
  6219. // region FocusEvent
  6220. // #region FocusEvent
  6221. interface FocusEventBase<
  6222. TDelegateTarget = any,
  6223. TData = any,
  6224. TCurrentTarget = any,
  6225. TTarget = any,
  6226. > extends UIEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  6227. /**
  6228. * The other DOM element involved in the event, if any.
  6229. * @see \`{@link https://api.jquery.com/event.relatedTarget/ }\`
  6230. * @since 1.1.4
  6231. * @example ​ ````On mouseout of anchors, alert the element type being entered.
  6232. ```javascript
  6233. $( "a" ).mouseout(function( event ) {
  6234. alert( event.relatedTarget.nodeName ); // "DIV"
  6235. });
  6236. ```
  6237. */
  6238. relatedTarget?: EventTarget | null | undefined;
  6239. // MouseEvent
  6240. button: undefined;
  6241. buttons: undefined;
  6242. clientX: undefined;
  6243. clientY: undefined;
  6244. offsetX: undefined;
  6245. offsetY: undefined;
  6246. /**
  6247. * The mouse position relative to the left edge of the document.
  6248. * @see \`{@link https://api.jquery.com/event.pageX/ }\`
  6249. * @since 1.0.4
  6250. * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
  6251. ```html
  6252. <!doctype html>
  6253. <html lang="en">
  6254. <head>
  6255. <meta charset="utf-8">
  6256. <title>event.pageX demo</title>
  6257. <style>
  6258. body {
  6259. background-color: #eef;
  6260. }
  6261. div {
  6262. padding: 20px;
  6263. }
  6264. </style>
  6265. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6266. </head>
  6267. <body>
  6268. <div id="log"></div>
  6269. <script>
  6270. $( document ).on( "mousemove", function( event ) {
  6271. $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
  6272. });
  6273. </script>
  6274. </body>
  6275. </html>
  6276. ```
  6277. */
  6278. pageX: undefined;
  6279. /**
  6280. * The mouse position relative to the top edge of the document.
  6281. * @see \`{@link https://api.jquery.com/event.pageY/ }\`
  6282. * @since 1.0.4
  6283. * @example ​ ````Show the mouse position relative to the left and top edges of the document (within this iframe).
  6284. ```html
  6285. <!doctype html>
  6286. <html lang="en">
  6287. <head>
  6288. <meta charset="utf-8">
  6289. <title>event.pageY demo</title>
  6290. <style>
  6291. body {
  6292. background-color: #eef;
  6293. }
  6294. div {
  6295. padding: 20px;
  6296. }
  6297. </style>
  6298. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6299. </head>
  6300. <body>
  6301. <div id="log"></div>
  6302. <script>
  6303. $( document ).on( "mousemove", function( event ) {
  6304. $( "#log" ).text( "pageX: " + event.pageX + ", pageY: " + event.pageY );
  6305. });
  6306. </script>
  6307. </body>
  6308. </html>
  6309. ```
  6310. */
  6311. pageY: undefined;
  6312. screenX: undefined;
  6313. screenY: undefined;
  6314. /** @deprecated */
  6315. toElement: undefined;
  6316. // PointerEvent
  6317. pointerId: undefined;
  6318. pointerType: undefined;
  6319. // KeyboardEvent
  6320. /** @deprecated */
  6321. char: undefined;
  6322. /** @deprecated */
  6323. charCode: undefined;
  6324. key: undefined;
  6325. /** @deprecated */
  6326. keyCode: undefined;
  6327. // TouchEvent
  6328. changedTouches: undefined;
  6329. targetTouches: undefined;
  6330. touches: undefined;
  6331. // MouseEvent, KeyboardEvent
  6332. /**
  6333. * For key or mouse events, this property indicates the specific key or button that was pressed.
  6334. * @see \`{@link https://api.jquery.com/event.which/ }\`
  6335. * @since 1.1.3
  6336. * @example ​ ````Log which key was depressed.
  6337. ```html
  6338. <!doctype html>
  6339. <html lang="en">
  6340. <head>
  6341. <meta charset="utf-8">
  6342. <title>event.which demo</title>
  6343. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6344. </head>
  6345. <body>
  6346. <input id="whichkey" value="type something">
  6347. <div id="log"></div>
  6348. <script>
  6349. $( "#whichkey" ).on( "keydown", function( event ) {
  6350. $( "#log" ).html( event.type + ": " + event.which );
  6351. });
  6352. </script>
  6353. </body>
  6354. </html>
  6355. ```
  6356. * @example ​ ````Log which mouse button was depressed.
  6357. ```html
  6358. <!doctype html>
  6359. <html lang="en">
  6360. <head>
  6361. <meta charset="utf-8">
  6362. <title>event.which demo</title>
  6363. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6364. </head>
  6365. <body>
  6366. <input id="whichkey" value="click here">
  6367. <div id="log"></div>
  6368. <script>
  6369. $( "#whichkey" ).on( "mousedown", function( event ) {
  6370. $( "#log" ).html( event.type + ": " + event.which );
  6371. });
  6372. </script>
  6373. </body>
  6374. </html>
  6375. ```
  6376. */
  6377. which: undefined;
  6378. // MouseEvent, KeyboardEvent, TouchEvent
  6379. altKey: undefined;
  6380. ctrlKey: undefined;
  6381. /**
  6382. * Indicates whether the META key was pressed when the event fired.
  6383. * @see \`{@link https://api.jquery.com/event.metaKey/ }\`
  6384. * @since 1.0.4
  6385. * @example ​ ````Determine whether the META key was pressed when the event fired.
  6386. ```html
  6387. <!doctype html>
  6388. <html lang="en">
  6389. <head>
  6390. <meta charset="utf-8">
  6391. <title>event.metaKey demo</title>
  6392. <style>
  6393. body {
  6394. background-color: #eef;
  6395. }
  6396. div {
  6397. padding: 20px;
  6398. }
  6399. </style>
  6400. <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
  6401. </head>
  6402. <body>
  6403. <button value="Test" name="Test" id="checkMetaKey">Click me!</button>
  6404. <div id="display"></div>
  6405. <script>
  6406. $( "#checkMetaKey" ).click(function( event ) {
  6407. $( "#display" ).text( event.metaKey );
  6408. });
  6409. </script>
  6410. </body>
  6411. </html>
  6412. ```
  6413. */
  6414. metaKey: undefined;
  6415. shiftKey: undefined;
  6416. originalEvent?: _FocusEvent | undefined;
  6417. }
  6418. interface BlurEvent<
  6419. TDelegateTarget = any,
  6420. TData = any,
  6421. TCurrentTarget = any,
  6422. TTarget = any,
  6423. > extends FocusEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  6424. type: "blur";
  6425. }
  6426. interface FocusEvent<
  6427. TDelegateTarget = any,
  6428. TData = any,
  6429. TCurrentTarget = any,
  6430. TTarget = any,
  6431. > extends FocusEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  6432. type: "focus";
  6433. }
  6434. interface FocusInEvent<
  6435. TDelegateTarget = any,
  6436. TData = any,
  6437. TCurrentTarget = any,
  6438. TTarget = any,
  6439. > extends FocusEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  6440. type: "focusin";
  6441. }
  6442. interface FocusOutEvent<
  6443. TDelegateTarget = any,
  6444. TData = any,
  6445. TCurrentTarget = any,
  6446. TTarget = any,
  6447. > extends FocusEventBase<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  6448. type: "focusout";
  6449. }
  6450. // #endregion
  6451. // #endregion
  6452. interface TypeToTriggeredEventMap<
  6453. TDelegateTarget,
  6454. TData,
  6455. TCurrentTarget,
  6456. TTarget,
  6457. > {
  6458. // Event
  6459. change: ChangeEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6460. resize: ResizeEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6461. scroll: ScrollEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6462. select: SelectEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6463. submit: SubmitEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6464. // UIEvent
  6465. // MouseEvent
  6466. click: ClickEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6467. contextmenu: ContextMenuEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6468. dblclick: DoubleClickEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6469. mousedown: MouseDownEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6470. mouseenter: MouseEnterEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6471. mouseleave: MouseLeaveEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6472. mousemove: MouseMoveEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6473. mouseout: MouseOutEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6474. mouseover: MouseOverEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6475. mouseup: MouseUpEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6476. // DragEvent
  6477. drag: DragEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6478. dragend: DragEndEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6479. dragenter: DragEnterEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6480. dragexit: DragExitEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6481. dragleave: DragLeaveEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6482. dragover: DragOverEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6483. dragstart: DragStartEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6484. drop: DropEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6485. // KeyboardEvent
  6486. keydown: KeyDownEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6487. keypress: KeyPressEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6488. keyup: KeyUpEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6489. // TouchEvent
  6490. touchcancel: TouchCancelEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6491. touchend: TouchEndEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6492. touchmove: TouchMoveEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6493. touchstart: TouchStartEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6494. // FocusEvent
  6495. blur: BlurEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6496. focus: FocusEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6497. focusin: FocusInEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6498. focusout: FocusOutEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6499. [type: string]: TriggeredEvent<TDelegateTarget, TData, TCurrentTarget, TTarget>;
  6500. }
  6501. // Extra parameters can be passed from trigger()
  6502. type EventHandlerBase<TContext, T> = (this: TContext, t: T, ...args: any[]) => any;
  6503. type EventHandler<
  6504. TCurrentTarget,
  6505. TData = undefined,
  6506. > = EventHandlerBase<TCurrentTarget, TriggeredEvent<TCurrentTarget, TData>>;
  6507. type TypeEventHandler<
  6508. TDelegateTarget,
  6509. TData,
  6510. TCurrentTarget,
  6511. TTarget,
  6512. TType extends keyof TypeToTriggeredEventMap<TDelegateTarget, TData, TCurrentTarget, TTarget>,
  6513. > = EventHandlerBase<
  6514. TCurrentTarget,
  6515. TypeToTriggeredEventMap<TDelegateTarget, TData, TCurrentTarget, TTarget>[TType]
  6516. >;
  6517. interface TypeEventHandlers<
  6518. TDelegateTarget,
  6519. TData,
  6520. TCurrentTarget,
  6521. TTarget,
  6522. > extends _TypeEventHandlers<TDelegateTarget, TData, TCurrentTarget, TTarget> {
  6523. // No idea why it's necessary to include `object` in the union but otherwise TypeScript complains that
  6524. // derived types of Event are not assignable to Event.
  6525. [type: string]:
  6526. | TypeEventHandler<TDelegateTarget, TData, TCurrentTarget, TTarget, string>
  6527. | false
  6528. | undefined
  6529. | object;
  6530. }
  6531. type _TypeEventHandlers<
  6532. TDelegateTarget,
  6533. TData,
  6534. TCurrentTarget,
  6535. TTarget,
  6536. > = {
  6537. [TType in keyof TypeToTriggeredEventMap<TDelegateTarget, TData, TCurrentTarget, TTarget>]?:
  6538. | TypeEventHandler<TDelegateTarget, TData, TCurrentTarget, TTarget, TType>
  6539. | false
  6540. | object;
  6541. };
  6542. // region Event extensions
  6543. // #region Event extensions
  6544. interface EventExtensions {
  6545. /**
  6546. * The jQuery special event hooks are a set of per-event-name functions and properties that allow code to control the behavior of event processing within jQuery. The mechanism is similar to `fixHooks` in that the special event information is stored in `jQuery.event.special.NAME`, where `NAME` is the name of the special event. Event names are case sensitive.
  6547. *
  6548. * As with `fixHooks`, the special event hooks design assumes it will be very rare that two unrelated pieces of code want to process the same event name. Special event authors who need to modify events with existing hooks will need to take precautions to avoid introducing unwanted side-effects by clobbering those hooks.
  6549. * @see \`{@link https://learn.jquery.com/events/event-extensions/#special-event-hooks }\`
  6550. */
  6551. special: SpecialEventHooks;
  6552. }
  6553. // region Special event hooks
  6554. // #region Special event hooks
  6555. /**
  6556. * The jQuery special event hooks are a set of per-event-name functions and properties that allow code to control the behavior of event processing within jQuery. The mechanism is similar to `fixHooks` in that the special event information is stored in `jQuery.event.special.NAME`, where `NAME` is the name of the special event. Event names are case sensitive.
  6557. *
  6558. * As with `fixHooks`, the special event hooks design assumes it will be very rare that two unrelated pieces of code want to process the same event name. Special event authors who need to modify events with existing hooks will need to take precautions to avoid introducing unwanted side-effects by clobbering those hooks.
  6559. * @see \`{@link https://learn.jquery.com/events/event-extensions/#special-event-hooks }\`
  6560. */
  6561. // Workaround for TypeScript 2.3 which does not have support for weak types handling.
  6562. type SpecialEventHook<TTarget, TData> = {
  6563. /**
  6564. * Indicates whether this event type should be bubbled when the `.trigger()` method is called; by default it is `false`, meaning that a triggered event will bubble to the element's parents up to the document (if attached to a document) and then to the window. Note that defining `noBubble` on an event will effectively prevent that event from being used for delegated events with `.trigger()`.
  6565. * @see \`{@link https://learn.jquery.com/events/event-extensions/#nobubble-boolean }\`
  6566. */
  6567. noBubble: boolean;
  6568. } | {
  6569. /**
  6570. * When defined, these string properties specify that a special event should be handled like another event type until the event is delivered. The `bindType` is used if the event is attached directly, and the `delegateType` is used for delegated events. These types are generally DOM event types, and _should not_ be a special event themselves.
  6571. * @see \`{@link https://learn.jquery.com/events/event-extensions/#bindtype-string-delegatetype-string }\`
  6572. */
  6573. bindType: string;
  6574. } | {
  6575. /**
  6576. * When defined, these string properties specify that a special event should be handled like another event type until the event is delivered. The `bindType` is used if the event is attached directly, and the `delegateType` is used for delegated events. These types are generally DOM event types, and _should not_ be a special event themselves.
  6577. * @see \`{@link https://learn.jquery.com/events/event-extensions/#bindtype-string-delegatetype-string }\`
  6578. */
  6579. delegateType: string;
  6580. } | {
  6581. /**
  6582. * The setup hook is called the first time an event of a particular type is attached to an element; this provides the hook an opportunity to do processing that will apply to all events of this type on this element. The `this` keyword will be a reference to the element where the event is being attached and `eventHandle` is jQuery's event handler function. In most cases the `namespaces` argument should not be used, since it only represents the namespaces of the _first_ event being attached; subsequent events may not have this same namespaces.
  6583. *
  6584. * This hook can perform whatever processing it desires, including attaching its own event handlers to the element or to other elements and recording setup information on the element using the `jQuery.data()` method. If the setup hook wants jQuery to add a browser event (via `addEventListener` or `attachEvent`, depending on browser) it should return `false`. In all other cases, jQuery will not add the browser event, but will continue all its other bookkeeping for the event. This would be appropriate, for example, if the event was never fired by the browser but invoked by `.trigger()`. To attach the jQuery event handler in the setup hook, use the `eventHandle` argument.
  6585. * @see \`{@link https://learn.jquery.com/events/event-extensions/#setup-function-data-object-namespaces-eventhandle-function }\`
  6586. */
  6587. // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
  6588. setup(this: TTarget, data: TData, namespaces: string, eventHandle: EventHandler<TTarget, TData>): void | false;
  6589. } | {
  6590. /**
  6591. * The teardown hook is called when the final event of a particular type is removed from an element. The `this` keyword will be a reference to the element where the event is being cleaned up. This hook should return `false` if it wants jQuery to remove the event from the browser's event system (via `removeEventListener` or `detachEvent`). In most cases, the setup and teardown hooks should return the same value.
  6592. *
  6593. * If the setup hook attached event handlers or added data to an element through a mechanism such as `jQuery.data()`, the teardown hook should reverse the process and remove them. jQuery will generally remove the data and events when an element is totally removed from the document, but failing to remove data or events on teardown will cause a memory leak if the element stays in the document.
  6594. * @see \`{@link https://learn.jquery.com/events/event-extensions/#teardown-function }\`
  6595. */
  6596. // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
  6597. teardown(this: TTarget): void | false;
  6598. } | {
  6599. /**
  6600. * Each time an event handler is added to an element through an API such as `.on()`, jQuery calls this hook. The `this` keyword will be the element to which the event handler is being added, and the `handleObj` argument is as described in the section above. The return value of this hook is ignored.
  6601. * @see \`{@link https://learn.jquery.com/events/event-extensions/#add-function-handleobj }\`
  6602. */
  6603. add(this: TTarget, handleObj: HandleObject<TTarget, TData>): void;
  6604. } | {
  6605. /**
  6606. * When an event handler is removed from an element using an API such as `.off()`, this hook is called. The `this` keyword will be the element where the handler is being removed, and the `handleObj` argument is as described in the section above. The return value of this hook is ignored.
  6607. * @see \`{@link https://learn.jquery.com/events/event-extensions/#remove-function-handleobj }\`
  6608. */
  6609. remove(this: TTarget, handleObj: HandleObject<TTarget, TData>): void;
  6610. } | {
  6611. /**
  6612. * Called when the `.trigger()` or `.triggerHandler()` methods are used to trigger an event for the special type from code, as opposed to events that originate from within the browser. The `this` keyword will be the element being triggered, and the event argument will be a `jQuery.Event` object constructed from the caller's input. At minimum, the event type, data, namespace, and target properties are set on the event. The data argument represents additional data passed by `.trigger()` if present.
  6613. *
  6614. * The trigger hook is called early in the process of triggering an event, just after the `jQuery.Event` object is constructed and before any handlers have been called. It can process the triggered event in any way, for example by calling `event.stopPropagation()` or `event.preventDefault()` before returning. If the hook returns `false`, jQuery does not perform any further event triggering actions and returns immediately. Otherwise, it performs the normal trigger processing, calling any event handlers for the element and bubbling the event (unless propagation is stopped in advance or `noBubble` was specified for the special event) to call event handlers attached to parent elements.
  6615. * @see \`{@link https://learn.jquery.com/events/event-extensions/#trigger-function-event-jquery-event-data-object }\`
  6616. */
  6617. // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
  6618. trigger(this: TTarget, event: Event, data: TData): void | false;
  6619. } | {
  6620. /**
  6621. * When the `.trigger()` method finishes running all the event handlers for an event, it also looks for and runs any method on the target object by the same name unless of the handlers called `event.preventDefault()`. So, `.trigger( "submit" )` will execute the `submit()` method on the element if one exists. When a `_default` hook is specified, the hook is called just prior to checking for and executing the element's default method. If this hook returns the value `false` the element's default method will be called; otherwise it is not.
  6622. * @see \`{@link https://learn.jquery.com/events/event-extensions/#_default-function-event-jquery-event-data-object }\`
  6623. */
  6624. // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
  6625. _default(event: TriggeredEvent<TTarget, TData>, data: TData): void | false;
  6626. } | {
  6627. /**
  6628. * jQuery calls a handle hook when the event has occurred and jQuery would normally call the user's event handler specified by `.on()` or another event binding method. If the hook exists, jQuery calls it _instead_ of that event handler, passing it the event and any data passed from `.trigger()` if it was not a native event. The `this` keyword is the DOM element being handled, and `event.handleObj` property has the detailed event information.
  6629. *
  6630. * Based in the information it has, the handle hook should decide whether to call the original handler function which is in `event.handleObj.handler`. It can modify information in the event object before calling the original handler, but _must restore_ that data before returning or subsequent unrelated event handlers may act unpredictably. In most cases, the handle hook should return the result of the original handler, but that is at the discretion of the hook. The handle hook is unique in that it is the only special event function hook that is called under its original special event name when the type is mapped using `bindType` and `delegateType`. For that reason, it is almost always an error to have anything other than a handle hook present if the special event defines a `bindType` and `delegateType`, since those other hooks will never be called.
  6631. * @see \`{@link https://learn.jquery.com/events/event-extensions/#handle-function-event-jquery-event-data-object }\`
  6632. */
  6633. handle(
  6634. this: TTarget,
  6635. event: TriggeredEvent<TTarget, TData> & { handleObj: HandleObject<TTarget, TData> },
  6636. ...data: TData[]
  6637. ): void;
  6638. } | {
  6639. // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
  6640. preDispatch(this: TTarget, event: Event): false | void;
  6641. } | {
  6642. postDispatch(this: TTarget, event: Event): void;
  6643. } | {
  6644. [key: string]: any;
  6645. };
  6646. interface SpecialEventHooks {
  6647. [event: string]: SpecialEventHook<EventTarget, any>;
  6648. }
  6649. /**
  6650. * Many of the special event hook functions below are passed a `handleObj` object that provides more information about the event, how it was attached, and its current state. This object and its contents should be treated as read-only data, and only the properties below are documented for use by special event handlers.
  6651. * @see \`{@link https://learn.jquery.com/events/event-extensions/#the-handleobj-object }\`
  6652. */
  6653. interface HandleObject<TTarget, TData> {
  6654. /**
  6655. * The type of event, such as `"click"`. When special event mapping is used via `bindType` or `delegateType`, this will be the mapped type.
  6656. */
  6657. readonly type: string;
  6658. /**
  6659. * The original type name regardless of whether it was mapped via `bindType` or `delegateType`. So when a "pushy" event is mapped to "click" its `origType` would be "pushy".
  6660. */
  6661. readonly origType: string;
  6662. /**
  6663. * Namespace(s), if any, provided when the event was attached, such as `"myPlugin"`. When multiple namespaces are given, they are separated by periods and sorted in ascending alphabetical order. If no namespaces are provided, this property is an empty string.
  6664. */
  6665. readonly namespace: string;
  6666. /**
  6667. * For delegated events, this is the selector used to filter descendant elements and determine if the handler should be called. For directly bound events, this property is `null`.
  6668. */
  6669. readonly selector: string | undefined | null;
  6670. /**
  6671. * The data, if any, passed to jQuery during event binding, e.g. `{ myData: 42 }`. If the data argument was omitted or `undefined`, this property is `undefined` as well.
  6672. */
  6673. readonly data: TData;
  6674. /**
  6675. * Event handler function passed to jQuery during event binding. If `false` was passed during event binding, the handler refers to a single shared function that simply returns `false`.
  6676. */
  6677. readonly handler: EventHandler<TTarget, TData>;
  6678. }
  6679. // #endregion
  6680. // #endregion
  6681. // #endregion
  6682. interface NameValuePair {
  6683. name: string;
  6684. value: string;
  6685. }
  6686. // region Coordinates
  6687. // #region Coordinates
  6688. interface Coordinates {
  6689. left: number;
  6690. top: number;
  6691. }
  6692. // Workaround for TypeScript 2.3 which does not have support for weak types handling.
  6693. type CoordinatesPartial =
  6694. | Pick<Coordinates, "left">
  6695. | Pick<Coordinates, "top">
  6696. | { [key: string]: never };
  6697. // #endregion
  6698. // region Val hooks
  6699. // #region Val hooks
  6700. // Workaround for TypeScript 2.3 which does not have support for weak types handling.
  6701. type ValHook<TElement> = {
  6702. get(elem: TElement): any;
  6703. } | {
  6704. set(elem: TElement, value: any): any;
  6705. } | {
  6706. [key: string]: never;
  6707. };
  6708. interface ValHooks {
  6709. // Set to HTMLElement to minimize breaks but should probably be Element.
  6710. [nodeName: string]: ValHook<HTMLElement>;
  6711. }
  6712. // #endregion
  6713. type _Falsy = false | null | undefined | 0 | "" | typeof document.all;
  6714. }
  6715. declare const jQuery: JQueryStatic;
  6716. declare const $: JQueryStatic;
  6717. type _Event = Event;
  6718. type _UIEvent = UIEvent;
  6719. type _MouseEvent = MouseEvent;
  6720. type _DragEvent = DragEvent;
  6721. type _KeyboardEvent = KeyboardEvent;
  6722. type _TouchEvent = TouchEvent;
  6723. type _FocusEvent = FocusEvent;
  6724. // region ES5 compatibility
  6725. // #region ES5 compatibility
  6726. // Forward declaration of `Iterable<T>`.
  6727. // eslint-disable-next-line @typescript-eslint/no-empty-interface
  6728. interface Iterable<T> {}
  6729. interface SymbolConstructor {
  6730. /**
  6731. * A String value that is used in the creation of the default string description of an object.
  6732. * Called by the built-in method Object.prototype.toString.
  6733. */
  6734. readonly toStringTag: symbol;
  6735. }
  6736. declare var Symbol: SymbolConstructor;
  6737. // #endregion