lib.wx.api.d.ts 854 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672
  1. /*! *****************************************************************************
  2. Copyright (c) 2021 Tencent, Inc. All rights reserved.
  3. Permission is hereby granted, free of charge, to any person obtaining a copy of
  4. this software and associated documentation files (the "Software"), to deal in
  5. the Software without restriction, including without limitation the rights to
  6. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  7. of the Software, and to permit persons to whom the Software is furnished to do
  8. so, subject to the following conditions:
  9. The above copyright notice and this permission notice shall be included in all
  10. copies or substantial portions of the Software.
  11. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  12. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  13. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  14. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  15. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  16. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  17. SOFTWARE.
  18. ***************************************************************************** */
  19. declare namespace WechatMiniprogram {
  20. interface AccessFailCallbackResult {
  21. /** 错误信息
  22. *
  23. * 可选值:
  24. * - 'fail no such file or directory ${path}': 文件/目录不存在;
  25. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  26. errMsg: string
  27. }
  28. interface AccessOption {
  29. /** 要判断是否存在的文件/目录路径 (本地路径) */
  30. path: string
  31. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  32. complete?: AccessCompleteCallback
  33. /** 接口调用失败的回调函数 */
  34. fail?: AccessFailCallback
  35. /** 接口调用成功的回调函数 */
  36. success?: AccessSuccessCallback
  37. }
  38. /** 帐号信息 */
  39. interface AccountInfo {
  40. /** 小程序帐号信息 */
  41. miniProgram: MiniProgram
  42. /** 插件帐号信息(仅在插件中调用时包含这一项) */
  43. plugin: Plugin
  44. }
  45. interface AddCardOption {
  46. /** 需要添加的卡券列表 */
  47. cardList: AddCardRequestInfo[]
  48. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  49. complete?: AddCardCompleteCallback
  50. /** 接口调用失败的回调函数 */
  51. fail?: AddCardFailCallback
  52. /** 接口调用成功的回调函数 */
  53. success?: AddCardSuccessCallback
  54. }
  55. /** 需要添加的卡券列表 */
  56. interface AddCardRequestInfo {
  57. /** 卡券的扩展参数。需将 CardExt 对象 JSON 序列化为**字符串**传入 */
  58. cardExt: string
  59. /** 卡券 ID */
  60. cardId: string
  61. }
  62. /** 卡券添加结果列表 */
  63. interface AddCardResponseInfo {
  64. /** 卡券的扩展参数,结构请参考下文 */
  65. cardExt: string
  66. /** 用户领取到卡券的 ID */
  67. cardId: string
  68. /** 加密 code,为用户领取到卡券的code加密后的字符串,解密请参照:[code 解码接口](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1499332673_Unm7V) */
  69. code: string
  70. /** 是否成功 */
  71. isSuccess: boolean
  72. }
  73. interface AddCardSuccessCallbackResult {
  74. /** 卡券添加结果列表 */
  75. cardList: AddCardResponseInfo[]
  76. errMsg: string
  77. }
  78. interface AddCustomLayerOption {
  79. /** 个性化图层id */
  80. layerId: string
  81. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  82. complete?: AddCustomLayerCompleteCallback
  83. /** 接口调用失败的回调函数 */
  84. fail?: AddCustomLayerFailCallback
  85. /** 接口调用成功的回调函数 */
  86. success?: AddCustomLayerSuccessCallback
  87. }
  88. interface AddGroundOverlayOption {
  89. /** 图片覆盖的经纬度范围 */
  90. bounds: MapBounds
  91. /** 图片图层 id */
  92. id: string
  93. /** 图片路径,支持网络图片、临时路径、代码包路径 */
  94. src: string
  95. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  96. complete?: AddGroundOverlayCompleteCallback
  97. /** 接口调用失败的回调函数 */
  98. fail?: AddGroundOverlayFailCallback
  99. /** 图层透明度 */
  100. opacity?: number
  101. /** 接口调用成功的回调函数 */
  102. success?: AddGroundOverlaySuccessCallback
  103. /** 是否可见 */
  104. visible?: boolean
  105. /** 图层绘制顺序 */
  106. zIndex?: number
  107. }
  108. interface AddMarkersOption {
  109. /** 同传入 map 组件的 marker 属性 */
  110. markers: any[]
  111. /** 是否先清空地图上所有 marker */
  112. clear?: boolean
  113. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  114. complete?: AddMarkersCompleteCallback
  115. /** 接口调用失败的回调函数 */
  116. fail?: AddMarkersFailCallback
  117. /** 接口调用成功的回调函数 */
  118. success?: AddMarkersSuccessCallback
  119. }
  120. interface AddPhoneCalendarOption {
  121. /** 开始时间的 unix 时间戳 */
  122. startTime: number
  123. /** 日历事件标题 */
  124. title: string
  125. /** 是否提醒,默认 true */
  126. alarm?: boolean
  127. /** 提醒提前量,单位秒,默认 0 表示开始时提醒 */
  128. alarmOffset?: number
  129. /** 是否全天事件,默认 false */
  130. allDay?: boolean
  131. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  132. complete?: AddPhoneCalendarCompleteCallback
  133. /** 事件说明 */
  134. description?: string
  135. /** 结束时间的 unix 时间戳,默认与开始时间相同 */
  136. endTime?: string
  137. /** 接口调用失败的回调函数 */
  138. fail?: AddPhoneCalendarFailCallback
  139. /** 事件位置 */
  140. location?: string
  141. /** 接口调用成功的回调函数 */
  142. success?: AddPhoneCalendarSuccessCallback
  143. }
  144. interface AddPhoneContactOption {
  145. /** 名字 */
  146. firstName: string
  147. /** 联系地址城市 */
  148. addressCity?: string
  149. /** 联系地址国家 */
  150. addressCountry?: string
  151. /** 联系地址邮政编码 */
  152. addressPostalCode?: string
  153. /** 联系地址省份 */
  154. addressState?: string
  155. /** 联系地址街道 */
  156. addressStreet?: string
  157. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  158. complete?: AddPhoneContactCompleteCallback
  159. /** 电子邮件 */
  160. email?: string
  161. /** 接口调用失败的回调函数 */
  162. fail?: AddPhoneContactFailCallback
  163. /** 住宅地址城市 */
  164. homeAddressCity?: string
  165. /** 住宅地址国家 */
  166. homeAddressCountry?: string
  167. /** 住宅地址邮政编码 */
  168. homeAddressPostalCode?: string
  169. /** 住宅地址省份 */
  170. homeAddressState?: string
  171. /** 住宅地址街道 */
  172. homeAddressStreet?: string
  173. /** 住宅传真 */
  174. homeFaxNumber?: string
  175. /** 住宅电话 */
  176. homePhoneNumber?: string
  177. /** 公司电话 */
  178. hostNumber?: string
  179. /** 姓氏 */
  180. lastName?: string
  181. /** 中间名 */
  182. middleName?: string
  183. /** 手机号 */
  184. mobilePhoneNumber?: string
  185. /** 昵称 */
  186. nickName?: string
  187. /** 公司 */
  188. organization?: string
  189. /** 头像本地文件路径 */
  190. photoFilePath?: string
  191. /** 备注 */
  192. remark?: string
  193. /** 接口调用成功的回调函数 */
  194. success?: AddPhoneContactSuccessCallback
  195. /** 职位 */
  196. title?: string
  197. /** 网站 */
  198. url?: string
  199. /** 微信号 */
  200. weChatNumber?: string
  201. /** 工作地址城市 */
  202. workAddressCity?: string
  203. /** 工作地址国家 */
  204. workAddressCountry?: string
  205. /** 工作地址邮政编码 */
  206. workAddressPostalCode?: string
  207. /** 工作地址省份 */
  208. workAddressState?: string
  209. /** 工作地址街道 */
  210. workAddressStreet?: string
  211. /** 工作传真 */
  212. workFaxNumber?: string
  213. /** 工作电话 */
  214. workPhoneNumber?: string
  215. }
  216. interface AddPhoneRepeatCalendarOption {
  217. /** 开始时间的 unix 时间戳 (1970年1月1日开始所经过的秒数) */
  218. startTime: number
  219. /** 日历事件标题 */
  220. title: string
  221. /** 是否提醒,默认 true */
  222. alarm?: boolean
  223. /** 提醒提前量,单位秒,默认 0 表示开始时提醒 */
  224. alarmOffset?: number
  225. /** 是否全天事件,默认 false */
  226. allDay?: boolean
  227. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  228. complete?: AddPhoneRepeatCalendarCompleteCallback
  229. /** 事件说明 */
  230. description?: string
  231. /** 结束时间的 unix 时间戳,默认与开始时间相同 */
  232. endTime?: string
  233. /** 接口调用失败的回调函数 */
  234. fail?: AddPhoneRepeatCalendarFailCallback
  235. /** 事件位置 */
  236. location?: string
  237. /** 重复周期结束时间的 unix 时间戳,不填表示一直重复 */
  238. repeatEndTime?: number
  239. /** 重复周期,默认 month 每月重复 */
  240. repeatInterval?: string
  241. /** 接口调用成功的回调函数 */
  242. success?: AddPhoneRepeatCalendarSuccessCallback
  243. }
  244. interface AddServiceOption {
  245. /** 描述service的Object */
  246. service: BLEPeripheralService
  247. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  248. complete?: AddServiceCompleteCallback
  249. /** 接口调用失败的回调函数 */
  250. fail?: AddServiceFailCallback
  251. /** 接口调用成功的回调函数 */
  252. success?: AddServiceSuccessCallback
  253. }
  254. /** 广播自定义参数 */
  255. interface AdvertiseReqObj {
  256. /** 当前Service是否可连接 */
  257. connectable?: boolean
  258. /** 广播中deviceName字段,默认为空 */
  259. deviceName?: string
  260. /** 广播的制造商信息, 仅安卓支持 */
  261. manufacturerData?: ManufacturerData[]
  262. /** 要广播的serviceUuid列表 */
  263. serviceUuids?: string[]
  264. }
  265. /** animationData */
  266. interface AnimationExportResult {
  267. actions: IAnyObject[]
  268. }
  269. /** 动画效果 */
  270. interface AnimationOption {
  271. /** 动画变化时间,单位 ms */
  272. duration?: number
  273. /** 动画变化方式
  274. *
  275. * 可选值:
  276. * - 'linear': 动画从头到尾的速度是相同的;
  277. * - 'easeIn': 动画以低速开始;
  278. * - 'easeOut': 动画以低速结束;
  279. * - 'easeInOut': 动画以低速开始和结束; */
  280. timingFunc?: 'linear' | 'easeIn' | 'easeOut' | 'easeInOut'
  281. }
  282. interface AppendFileFailCallbackResult {
  283. /** 错误信息
  284. *
  285. * 可选值:
  286. * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 文件不存在;
  287. * - 'fail illegal operation on a directory, open "${filePath}"': 指定的 filePath 是一个已经存在的目录;
  288. * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限;
  289. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  290. errMsg: string
  291. }
  292. interface AppendFileOption {
  293. /** 要追加的文本或二进制数据 */
  294. data: string | ArrayBuffer
  295. /** 要追加内容的文件路径 (本地路径) */
  296. filePath: string
  297. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  298. complete?: AppendFileCompleteCallback
  299. /** 指定写入文件的字符编码
  300. *
  301. * 可选值:
  302. * - 'ascii': ;
  303. * - 'base64': ;
  304. * - 'binary': ;
  305. * - 'hex': ;
  306. * - 'ucs2': 以小端序读取;
  307. * - 'ucs-2': 以小端序读取;
  308. * - 'utf16le': 以小端序读取;
  309. * - 'utf-16le': 以小端序读取;
  310. * - 'utf-8': ;
  311. * - 'utf8': ;
  312. * - 'latin1': ; */
  313. encoding?:
  314. | 'ascii'
  315. | 'base64'
  316. | 'binary'
  317. | 'hex'
  318. | 'ucs2'
  319. | 'ucs-2'
  320. | 'utf16le'
  321. | 'utf-16le'
  322. | 'utf-8'
  323. | 'utf8'
  324. | 'latin1'
  325. /** 接口调用失败的回调函数 */
  326. fail?: AppendFileFailCallback
  327. /** 接口调用成功的回调函数 */
  328. success?: AppendFileSuccessCallback
  329. }
  330. interface AuthPrivateMessageOption {
  331. /** shareTicket。可以从 wx.onShow 中获取。详情 [shareTicket](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
  332. shareTicket: string
  333. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  334. complete?: AuthPrivateMessageCompleteCallback
  335. /** 接口调用失败的回调函数 */
  336. fail?: AuthPrivateMessageFailCallback
  337. /** 接口调用成功的回调函数 */
  338. success?: AuthPrivateMessageSuccessCallback
  339. }
  340. interface AuthPrivateMessageSuccessCallbackResult {
  341. /** 经过加密的activityId,解密后可得到原始的activityId。若解密后得到的activityId可以与开发者后台的活动id对应上则验证通过,否则表明valid字段不可靠(被篡改) 详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  342. encryptedData: string
  343. /** 错误信息 */
  344. errMsg: string
  345. /** 加密算法的初始向量,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  346. iv: string
  347. /** 验证是否通过 */
  348. valid: boolean
  349. }
  350. /** 用户授权设置信息,详情参考[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) */
  351. interface AuthSetting {
  352. /** 是否授权通讯地址,已取消此项授权,会默认返回true */
  353. 'scope.address'?: boolean
  354. /** 是否授权摄像头,对应[[camera](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html)](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html) 组件 */
  355. 'scope.camera'?: boolean
  356. /** 是否授权获取发票,已取消此项授权,会默认返回true */
  357. 'scope.invoice'?: boolean
  358. /** 是否授权发票抬头,已取消此项授权,会默认返回true */
  359. 'scope.invoiceTitle'?: boolean
  360. /** 是否授权录音功能,对应接口 [wx.startRecord](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.startRecord.html) */
  361. 'scope.record'?: boolean
  362. /** 是否授权用户信息,对应接口 [wx.getUserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html) */
  363. 'scope.userInfo'?: boolean
  364. /** 是否授权地理位置,对应接口 [wx.getLocation](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html), [wx.chooseLocation](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.chooseLocation.html) */
  365. 'scope.userLocation'?: boolean
  366. /** 是否授权微信运动步数,对应接口 [wx.getWeRunData](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.getWeRunData.html) */
  367. 'scope.werun'?: boolean
  368. /** 是否授权保存到相册 [wx.saveImageToPhotosAlbum](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html), [wx.saveVideoToPhotosAlbum](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.saveVideoToPhotosAlbum.html) */
  369. 'scope.writePhotosAlbum'?: boolean
  370. }
  371. interface AuthorizeForMiniProgramOption {
  372. /** 需要获取权限的 scope,详见 [scope 列表]((authorize#scope-列表))
  373. *
  374. * 可选值:
  375. * - 'scope.record': ;
  376. * - 'scope.writePhotosAlbum': ;
  377. * - 'scope.camera': ; */
  378. scope: 'scope.record' | 'scope.writePhotosAlbum' | 'scope.camera'
  379. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  380. complete?: AuthorizeForMiniProgramCompleteCallback
  381. /** 接口调用失败的回调函数 */
  382. fail?: AuthorizeForMiniProgramFailCallback
  383. /** 接口调用成功的回调函数 */
  384. success?: AuthorizeForMiniProgramSuccessCallback
  385. }
  386. interface AuthorizeOption {
  387. /** 需要获取权限的 scope,详见 [scope 列表]((authorize#scope-列表)) */
  388. scope: string
  389. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  390. complete?: AuthorizeCompleteCallback
  391. /** 接口调用失败的回调函数 */
  392. fail?: AuthorizeFailCallback
  393. /** 接口调用成功的回调函数 */
  394. success?: AuthorizeSuccessCallback
  395. }
  396. /** 设备特征值列表 */
  397. interface BLECharacteristic {
  398. /** 该特征值支持的操作类型 */
  399. properties: BLECharacteristicProperties
  400. /** 蓝牙设备特征值的 uuid */
  401. uuid: string
  402. }
  403. /** 该特征值支持的操作类型 */
  404. interface BLECharacteristicProperties {
  405. /** 该特征值是否支持 indicate 操作 */
  406. indicate: boolean
  407. /** 该特征值是否支持 notify 操作 */
  408. notify: boolean
  409. /** 该特征值是否支持 read 操作 */
  410. read: boolean
  411. /** 该特征值是否支持 write 操作 */
  412. write: boolean
  413. }
  414. interface BLEPeripheralServerCloseOption {
  415. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  416. complete?: SocketTaskCloseCompleteCallback
  417. /** 接口调用失败的回调函数 */
  418. fail?: SocketTaskCloseFailCallback
  419. /** 接口调用成功的回调函数 */
  420. success?: SocketTaskCloseSuccessCallback
  421. }
  422. /** 描述service的Object */
  423. interface BLEPeripheralService {
  424. /** characteristics列表 */
  425. characteristics: Characteristic[]
  426. /** service 的 uuid */
  427. uuid: string
  428. }
  429. /** 设备服务列表 */
  430. interface BLEService {
  431. /** 该服务是否为主服务 */
  432. isPrimary: boolean
  433. /** 蓝牙设备服务的 uuid */
  434. uuid: string
  435. }
  436. /** BackgroundAudioManager 实例,可通过 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 获取。
  437. *
  438. * **示例代码**
  439. *
  440. *
  441. * ```js
  442. const backgroundAudioManager = wx.getBackgroundAudioManager()
  443. backgroundAudioManager.title = '此时此刻'
  444. backgroundAudioManager.epname = '此时此刻'
  445. backgroundAudioManager.singer = '许巍'
  446. backgroundAudioManager.coverImgUrl = 'http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000'
  447. // 设置了 src 之后会自动播放
  448. backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46'
  449. ``` */
  450. interface BackgroundAudioManager {
  451. /** 音频已缓冲的时间,仅保证当前播放时间点到此时间点内容已缓冲。(只读) */
  452. buffered: number
  453. /** 封面图 URL,用于做原生音频播放器背景图。原生音频播放器中的分享功能,分享出去的卡片配图及背景也将使用该图。 */
  454. coverImgUrl: string
  455. /** 当前音频的播放位置(单位:s),只有在有合法 src 时返回。(只读) */
  456. currentTime: number
  457. /** 当前音频的长度(单位:s),只有在有合法 src 时返回。(只读) */
  458. duration: number
  459. /** 专辑名,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */
  460. epname: string
  461. /** 当前是否暂停或停止。(只读) */
  462. paused: boolean
  463. /** 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本)
  464. *
  465. * 最低基础库: `2.11.0` */
  466. playbackRate: number
  467. /** 音频协议。默认值为 'http',设置 'hls' 可以支持播放 HLS 协议的直播音频。
  468. *
  469. * 最低基础库: `1.9.94` */
  470. protocol: string
  471. /** 歌手名,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */
  472. singer: string
  473. /** 音频的数据源([2.2.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 开始支持云文件ID)。默认为空字符串,**当设置了新的 src 时,会自动开始播放**,目前支持的格式有 m4a, aac, mp3, wav。 */
  474. src: string
  475. /** 音频开始播放的位置(单位:s)。 */
  476. startTime: number
  477. /** 音频标题,用于原生音频播放器音频标题(必填)。原生音频播放器中的分享功能,分享出去的卡片标题,也将使用该值。 */
  478. title: string
  479. /** 页面链接,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */
  480. webUrl: string
  481. }
  482. interface BlueToothDevice {
  483. /** 当前蓝牙设备的信号强度 */
  484. RSSI: number
  485. /** 当前蓝牙设备的广播数据段中的 ManufacturerData 数据段。 */
  486. advertisData: ArrayBuffer
  487. /** 当前蓝牙设备的广播数据段中的 ServiceUUIDs 数据段 */
  488. advertisServiceUUIDs: string[]
  489. /** 用于区分设备的 id */
  490. deviceId: string
  491. /** 当前蓝牙设备的广播数据段中的 LocalName 数据段 */
  492. localName: string
  493. /** 蓝牙设备名称,某些设备可能没有 */
  494. name: string
  495. /** 当前蓝牙设备的广播数据段中的 ServiceData 数据段 */
  496. serviceData: IAnyObject
  497. }
  498. /** 搜索到的设备列表 */
  499. interface BluetoothDeviceInfo {
  500. /** 用于区分设备的 id */
  501. deviceId: string
  502. /** 蓝牙设备名称,某些设备可能没有 */
  503. name: string
  504. }
  505. interface BlurOption {
  506. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  507. complete?: BlurCompleteCallback
  508. /** 接口调用失败的回调函数 */
  509. fail?: BlurFailCallback
  510. /** 接口调用成功的回调函数 */
  511. success?: BlurSuccessCallback
  512. }
  513. interface BoundingClientRectCallbackResult {
  514. /** 节点的下边界坐标 */
  515. bottom: number
  516. /** 节点的 dataset */
  517. dataset: IAnyObject
  518. /** 节点的高度 */
  519. height: number
  520. /** 节点的 ID */
  521. id: string
  522. /** 节点的左边界坐标 */
  523. left: number
  524. /** 节点的右边界坐标 */
  525. right: number
  526. /** 节点的上边界坐标 */
  527. top: number
  528. /** 节点的宽度 */
  529. width: number
  530. }
  531. /** 目标边界 */
  532. interface BoundingClientRectResult {
  533. /** 下边界 */
  534. bottom: number
  535. /** 高度 */
  536. height: number
  537. /** 左边界 */
  538. left: number
  539. /** 右边界 */
  540. right: number
  541. /** 上边界 */
  542. top: number
  543. /** 宽度 */
  544. width: number
  545. }
  546. interface CameraContextStartRecordOption {
  547. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  548. complete?: StartRecordCompleteCallback
  549. /** 接口调用失败的回调函数 */
  550. fail?: StartRecordFailCallback
  551. /** 接口调用成功的回调函数 */
  552. success?: CameraContextStartRecordSuccessCallback
  553. /** 超过30s或页面 `onHide` 时会结束录像 */
  554. timeoutCallback?: StartRecordTimeoutCallback
  555. }
  556. interface CameraContextStopRecordOption {
  557. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  558. complete?: StopRecordCompleteCallback
  559. /** 启动视频压缩,压缩效果同`chooseVideo` */
  560. compressed?: boolean
  561. /** 接口调用失败的回调函数 */
  562. fail?: StopRecordFailCallback
  563. /** 接口调用成功的回调函数 */
  564. success?: CameraContextStopRecordSuccessCallback
  565. }
  566. interface CameraFrameListenerStartOption {
  567. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  568. complete?: StartCompleteCallback
  569. /** 接口调用失败的回调函数 */
  570. fail?: StartFailCallback
  571. /** 接口调用成功的回调函数 */
  572. success?: StartSuccessCallback
  573. }
  574. /** Canvas 实例,可通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取。
  575. *
  576. * **示例代码**
  577. *
  578. *
  579. *
  580. * 2D Canvas 示例
  581. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/SHfgCmmq7UcM)
  582. *
  583. * WebGL 示例
  584. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/qEGUOqmf7T8z)
  585. *
  586. * 最低基础库: `2.7.0` */
  587. interface Canvas {
  588. /** 画布高度 */
  589. height: number
  590. /** 画布宽度 */
  591. width: number
  592. }
  593. /** canvas 组件的绘图上下文。CanvasContext 是旧版的接口, 新版 Canvas 2D 接口与 Web 一致。 */
  594. interface CanvasContext {
  595. /** 填充颜色。用法同 [CanvasContext.setFillStyle()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html)。
  596. *
  597. * 最低基础库: `1.9.90` */
  598. fillStyle: string | CanvasGradient
  599. /** 当前字体样式的属性。符合 [CSS font 语法](https://developer.mozilla.org/zh-CN/docs/Web/CSS/font) 的 DOMString 字符串,至少需要提供字体大小和字体族名。默认值为 10px sans-serif。
  600. *
  601. * 最低基础库: `1.9.90` */
  602. font: string
  603. /** 全局画笔透明度。范围 0-1,0 表示完全透明,1 表示完全不透明。 */
  604. globalAlpha: number
  605. /** 在绘制新形状时应用的合成操作的类型。目前安卓版本只适用于 `fill` 填充块的合成,用于 `stroke` 线段的合成效果都是 `source-over`。
  606. *
  607. * 目前支持的操作有
  608. * - 安卓:xor, source-over, source-atop, destination-out, lighter, overlay, darken, lighten, hard-light
  609. * - iOS:xor, source-over, source-atop, destination-over, destination-out, lighter, multiply, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, saturation, luminosity
  610. *
  611. * 最低基础库: `1.9.90` */
  612. globalCompositeOperation: string
  613. /** 线条的端点样式。用法同 [CanvasContext.setLineCap()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineCap.html)。
  614. *
  615. * 最低基础库: `1.9.90` */
  616. lineCap: string
  617. /** 虚线偏移量,初始值为0
  618. *
  619. * 最低基础库: `1.9.90` */
  620. lineDashOffset: number
  621. /** 线条的交点样式。用法同 [CanvasContext.setLineJoin()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html)。
  622. *
  623. * 可选值:
  624. * - 'bevel': 斜角;
  625. * - 'round': 圆角;
  626. * - 'miter': 尖角;
  627. *
  628. * 最低基础库: `1.9.90` */
  629. lineJoin: 'bevel' | 'round' | 'miter'
  630. /** 线条的宽度。用法同 [CanvasContext.setLineWidth()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineWidth.html)。
  631. *
  632. * 最低基础库: `1.9.90` */
  633. lineWidth: number
  634. /** 最大斜接长度。用法同 [CanvasContext.setMiterLimit()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setMiterLimit.html)。
  635. *
  636. * 最低基础库: `1.9.90` */
  637. miterLimit: number
  638. /** 阴影的模糊级别
  639. *
  640. * 最低基础库: `1.9.90` */
  641. shadowBlur: number
  642. /** 阴影的颜色
  643. *
  644. * 最低基础库: `1.9.90` */
  645. shadowColor: number
  646. /** 阴影相对于形状在水平方向的偏移
  647. *
  648. * 最低基础库: `1.9.90` */
  649. shadowOffsetX: number
  650. /** 阴影相对于形状在竖直方向的偏移
  651. *
  652. * 最低基础库: `1.9.90` */
  653. shadowOffsetY: number
  654. /** 边框颜色。用法同 [CanvasContext.setStrokeStyle()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html)。
  655. *
  656. * 最低基础库: `1.9.90` */
  657. strokeStyle: string | CanvasGradient
  658. }
  659. interface CanvasGetImageDataOption {
  660. /** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件的 `canvas-id` 属性。 */
  661. canvasId: string
  662. /** 将要被提取的图像数据矩形区域的高度 */
  663. height: number
  664. /** 将要被提取的图像数据矩形区域的宽度 */
  665. width: number
  666. /** 将要被提取的图像数据矩形区域的左上角横坐标 */
  667. x: number
  668. /** 将要被提取的图像数据矩形区域的左上角纵坐标 */
  669. y: number
  670. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  671. complete?: CanvasGetImageDataCompleteCallback
  672. /** 接口调用失败的回调函数 */
  673. fail?: CanvasGetImageDataFailCallback
  674. /** 接口调用成功的回调函数 */
  675. success?: CanvasGetImageDataSuccessCallback
  676. }
  677. interface CanvasGetImageDataSuccessCallbackResult {
  678. /** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */
  679. data: Uint8ClampedArray
  680. /** 图像数据矩形的高度 */
  681. height: number
  682. /** 图像数据矩形的宽度 */
  683. width: number
  684. errMsg: string
  685. }
  686. interface CanvasPutImageDataOption {
  687. /** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件的 canvas-id 属性。 */
  688. canvasId: string
  689. /** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */
  690. data: Uint8ClampedArray
  691. /** 源图像数据矩形区域的高度 */
  692. height: number
  693. /** 源图像数据矩形区域的宽度 */
  694. width: number
  695. /** 源图像数据在目标画布中的位置偏移量(x 轴方向的偏移量) */
  696. x: number
  697. /** 源图像数据在目标画布中的位置偏移量(y 轴方向的偏移量) */
  698. y: number
  699. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  700. complete?: CanvasPutImageDataCompleteCallback
  701. /** 接口调用失败的回调函数 */
  702. fail?: CanvasPutImageDataFailCallback
  703. /** 接口调用成功的回调函数 */
  704. success?: CanvasPutImageDataSuccessCallback
  705. }
  706. interface CanvasToTempFilePathOption {
  707. /** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件实例 (canvas type="2d" 时使用该属性)。 */
  708. canvas?: IAnyObject
  709. /** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件的 canvas-id */
  710. canvasId?: string
  711. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  712. complete?: CanvasToTempFilePathCompleteCallback
  713. /** 输出的图片的高度
  714. *
  715. * 最低基础库: `1.2.0` */
  716. destHeight?: number
  717. /** 输出的图片的宽度
  718. *
  719. * 最低基础库: `1.2.0` */
  720. destWidth?: number
  721. /** 接口调用失败的回调函数 */
  722. fail?: CanvasToTempFilePathFailCallback
  723. /** 目标文件的类型
  724. *
  725. * 可选值:
  726. * - 'jpg': jpg 图片;
  727. * - 'png': png 图片;
  728. *
  729. * 最低基础库: `1.7.0` */
  730. fileType?: 'jpg' | 'png'
  731. /** 指定的画布区域的高度
  732. *
  733. * 最低基础库: `1.2.0` */
  734. height?: number
  735. /** 图片的质量,目前仅对 jpg 有效。取值范围为 (0, 1],不在范围内时当作 1.0 处理。
  736. *
  737. * 最低基础库: `1.7.0` */
  738. quality?: number
  739. /** 接口调用成功的回调函数 */
  740. success?: CanvasToTempFilePathSuccessCallback
  741. /** 指定的画布区域的宽度
  742. *
  743. * 最低基础库: `1.2.0` */
  744. width?: number
  745. /** 指定的画布区域的左上角横坐标
  746. *
  747. * 最低基础库: `1.2.0` */
  748. x?: number
  749. /** 指定的画布区域的左上角纵坐标
  750. *
  751. * 最低基础库: `1.2.0` */
  752. y?: number
  753. }
  754. interface CanvasToTempFilePathSuccessCallbackResult {
  755. /** 生成文件的临时路径 (本地路径) */
  756. tempFilePath: string
  757. errMsg: string
  758. }
  759. /** characteristics列表 */
  760. interface Characteristic {
  761. /** Characteristic 的 uuid */
  762. uuid: string
  763. /** 描述符数据 */
  764. descriptors?: CharacteristicDescriptor[]
  765. /** 特征值权限 */
  766. permission?: CharacteristicPermission
  767. /** 特征值支持的操作 */
  768. properties?: CharacteristicProperties
  769. /** 特征值对应的二进制值 */
  770. value?: ArrayBuffer
  771. }
  772. /** 描述符数据 */
  773. interface CharacteristicDescriptor {
  774. /** Descriptor 的 uuid */
  775. uuid: string
  776. /** 描述符的权限 */
  777. permission?: DescriptorPermission
  778. /** 描述符数据 */
  779. value?: ArrayBuffer
  780. }
  781. /** 特征值权限 */
  782. interface CharacteristicPermission {
  783. /** 加密读请求 */
  784. readEncryptionRequired?: boolean
  785. /** 可读 */
  786. readable?: boolean
  787. /** 加密写请求 */
  788. writeEncryptionRequired?: boolean
  789. /** 可写 */
  790. writeable?: boolean
  791. }
  792. /** 特征值支持的操作 */
  793. interface CharacteristicProperties {
  794. /** 回包 */
  795. indicate?: boolean
  796. /** 订阅 */
  797. notify?: boolean
  798. /** 读 */
  799. read?: boolean
  800. /** 写 */
  801. write?: boolean
  802. }
  803. interface CheckIsOpenAccessibilityOption {
  804. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  805. complete?: CheckIsOpenAccessibilityCompleteCallback
  806. /** 接口调用失败的回调函数 */
  807. fail?: CheckIsOpenAccessibilityFailCallback
  808. /** 接口调用成功的回调函数 */
  809. success?: CheckIsOpenAccessibilitySuccessCallback
  810. }
  811. interface CheckIsOpenAccessibilitySuccessCallbackOption {
  812. /** iOS 上开启辅助功能旁白,安卓开启 talkback 时返回 true */
  813. open: boolean
  814. }
  815. interface CheckIsSoterEnrolledInDeviceOption {
  816. /** 认证方式
  817. *
  818. * 可选值:
  819. * - 'fingerPrint': 指纹识别;
  820. * - 'facial': 人脸识别;
  821. * - 'speech': 声纹识别(暂未支持); */
  822. checkAuthMode: 'fingerPrint' | 'facial' | 'speech'
  823. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  824. complete?: CheckIsSoterEnrolledInDeviceCompleteCallback
  825. /** 接口调用失败的回调函数 */
  826. fail?: CheckIsSoterEnrolledInDeviceFailCallback
  827. /** 接口调用成功的回调函数 */
  828. success?: CheckIsSoterEnrolledInDeviceSuccessCallback
  829. }
  830. interface CheckIsSoterEnrolledInDeviceSuccessCallbackResult {
  831. /** 错误信息 */
  832. errMsg: string
  833. /** 是否已录入信息 */
  834. isEnrolled: boolean
  835. }
  836. interface CheckIsSupportSoterAuthenticationOption {
  837. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  838. complete?: CheckIsSupportSoterAuthenticationCompleteCallback
  839. /** 接口调用失败的回调函数 */
  840. fail?: CheckIsSupportSoterAuthenticationFailCallback
  841. /** 接口调用成功的回调函数 */
  842. success?: CheckIsSupportSoterAuthenticationSuccessCallback
  843. }
  844. interface CheckIsSupportSoterAuthenticationSuccessCallbackResult {
  845. /** 该设备支持的可被SOTER识别的生物识别方式
  846. *
  847. * 可选值:
  848. * - 'fingerPrint': 指纹识别;
  849. * - 'facial': 人脸识别;
  850. * - 'speech': 声纹识别(暂未支持); */
  851. supportMode: Array<'fingerPrint' | 'facial' | 'speech'>
  852. errMsg: string
  853. }
  854. interface CheckSessionOption {
  855. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  856. complete?: CheckSessionCompleteCallback
  857. /** 接口调用失败的回调函数 */
  858. fail?: CheckSessionFailCallback
  859. /** 接口调用成功的回调函数 */
  860. success?: CheckSessionSuccessCallback
  861. }
  862. interface ChooseAddressOption {
  863. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  864. complete?: ChooseAddressCompleteCallback
  865. /** 接口调用失败的回调函数 */
  866. fail?: ChooseAddressFailCallback
  867. /** 接口调用成功的回调函数 */
  868. success?: ChooseAddressSuccessCallback
  869. }
  870. interface ChooseAddressSuccessCallbackResult {
  871. /** 国标收货地址第二级地址 */
  872. cityName: string
  873. /** 国标收货地址第三级地址 */
  874. countyName: string
  875. /** 详细收货地址信息 */
  876. detailInfo: string
  877. /** 错误信息 */
  878. errMsg: string
  879. /** 收货地址国家码 */
  880. nationalCode: string
  881. /** 邮编 */
  882. postalCode: string
  883. /** 国标收货地址第一级地址 */
  884. provinceName: string
  885. /** 收货人手机号码 */
  886. telNumber: string
  887. /** 收货人姓名 */
  888. userName: string
  889. }
  890. /** 返回选择的文件的本地临时文件对象数组 */
  891. interface ChooseFile {
  892. /** 选择的文件名称 */
  893. name: string
  894. /** 本地临时文件路径 (本地路径) */
  895. path: string
  896. /** 本地临时文件大小,单位 B */
  897. size: number
  898. /** 选择的文件的会话发送时间,Unix时间戳,工具暂不支持此属性 */
  899. time: number
  900. /** 选择的文件类型
  901. *
  902. * 可选值:
  903. * - 'video': 选择了视频文件;
  904. * - 'image': 选择了图片文件;
  905. * - 'file': 选择了除图片和视频的文件; */
  906. type: 'video' | 'image' | 'file'
  907. }
  908. interface ChooseImageOption {
  909. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  910. complete?: ChooseImageCompleteCallback
  911. /** 最多可以选择的图片张数 */
  912. count?: number
  913. /** 接口调用失败的回调函数 */
  914. fail?: ChooseImageFailCallback
  915. /** 所选的图片的尺寸
  916. *
  917. * 可选值:
  918. * - 'original': 原图;
  919. * - 'compressed': 压缩图; */
  920. sizeType?: Array<'original' | 'compressed'>
  921. /** 选择图片的来源
  922. *
  923. * 可选值:
  924. * - 'album': 从相册选图;
  925. * - 'camera': 使用相机; */
  926. sourceType?: Array<'album' | 'camera'>
  927. /** 接口调用成功的回调函数 */
  928. success?: ChooseImageSuccessCallback
  929. }
  930. interface ChooseImageSuccessCallbackResult {
  931. /** 图片的本地临时文件路径列表 (本地路径) */
  932. tempFilePaths: string[]
  933. /** 图片的本地临时文件列表
  934. *
  935. * 最低基础库: `1.2.0` */
  936. tempFiles: ImageFile[]
  937. errMsg: string
  938. }
  939. interface ChooseInvoiceOption {
  940. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  941. complete?: ChooseInvoiceCompleteCallback
  942. /** 接口调用失败的回调函数 */
  943. fail?: ChooseInvoiceFailCallback
  944. /** 接口调用成功的回调函数 */
  945. success?: ChooseInvoiceSuccessCallback
  946. }
  947. interface ChooseInvoiceSuccessCallbackResult {
  948. /** 用户选中的发票信息,格式为一个 JSON 字符串,包含三个字段: card_id:所选发票卡券的 cardId,encrypt_code:所选发票卡券的加密 code,报销方可以通过 cardId 和 encryptCode 获得报销发票的信息,app_id: 发票方的 appId。 */
  949. invoiceInfo: string
  950. errMsg: string
  951. }
  952. interface ChooseInvoiceTitleOption {
  953. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  954. complete?: ChooseInvoiceTitleCompleteCallback
  955. /** 接口调用失败的回调函数 */
  956. fail?: ChooseInvoiceTitleFailCallback
  957. /** 接口调用成功的回调函数 */
  958. success?: ChooseInvoiceTitleSuccessCallback
  959. }
  960. interface ChooseInvoiceTitleSuccessCallbackResult {
  961. /** 银行账号 */
  962. bankAccount: string
  963. /** 银行名称 */
  964. bankName: string
  965. /** 单位地址 */
  966. companyAddress: string
  967. /** 错误信息 */
  968. errMsg: string
  969. /** 抬头税号 */
  970. taxNumber: string
  971. /** 手机号码 */
  972. telephone: string
  973. /** 抬头名称 */
  974. title: string
  975. /** 抬头类型
  976. *
  977. * 可选值:
  978. * - 0: 单位;
  979. * - 1: 个人; */
  980. type: 0 | 1
  981. }
  982. interface ChooseLocationOption {
  983. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  984. complete?: ChooseLocationCompleteCallback
  985. /** 接口调用失败的回调函数 */
  986. fail?: ChooseLocationFailCallback
  987. /** 目标地纬度
  988. *
  989. * 最低基础库: `2.9.0` */
  990. latitude?: number
  991. /** 目标地经度
  992. *
  993. * 最低基础库: `2.9.0` */
  994. longitude?: number
  995. /** 接口调用成功的回调函数 */
  996. success?: ChooseLocationSuccessCallback
  997. }
  998. interface ChooseLocationSuccessCallbackResult {
  999. /** 详细地址 */
  1000. address: string
  1001. /** 纬度,浮点数,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */
  1002. latitude: string
  1003. /** 经度,浮点数,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */
  1004. longitude: string
  1005. /** 位置名称 */
  1006. name: string
  1007. errMsg: string
  1008. }
  1009. interface ChooseMediaOption {
  1010. /** 仅在 sourceType 为 camera 时生效,使用前置或后置摄像头
  1011. *
  1012. * 可选值:
  1013. * - 'back': 使用后置摄像头;
  1014. * - 'front': 使用前置摄像头; */
  1015. camera?: 'back' | 'front'
  1016. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1017. complete?: ChooseMediaCompleteCallback
  1018. /** 最多可以选择的文件个数 */
  1019. count?: number
  1020. /** 接口调用失败的回调函数 */
  1021. fail?: ChooseMediaFailCallback
  1022. /** 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至 30s 之间 */
  1023. maxDuration?: number
  1024. /** 文件类型
  1025. *
  1026. * 可选值:
  1027. * - 'image': 只能拍摄图片或从相册选择图片;
  1028. * - 'video': 只能拍摄视频或从相册选择视频; */
  1029. mediaType?: Array<'image' | 'video'>
  1030. /** 仅对 mediaType 为 image 时有效,是否压缩所选文件 */
  1031. sizeType?: string[]
  1032. /** 图片和视频选择的来源
  1033. *
  1034. * 可选值:
  1035. * - 'album': 从相册选择;
  1036. * - 'camera': 使用相机拍摄; */
  1037. sourceType?: Array<'album' | 'camera'>
  1038. /** 接口调用成功的回调函数 */
  1039. success?: ChooseMediaSuccessCallback
  1040. }
  1041. interface ChooseMediaSuccessCallbackResult {
  1042. /** 本地临时文件列表 */
  1043. tempFiles: MediaFile[]
  1044. /** 文件类型,有效值有 image 、video */
  1045. type: string
  1046. errMsg: string
  1047. }
  1048. interface ChooseMessageFileOption {
  1049. /** 最多可以选择的文件个数,可以 0~100 */
  1050. count: number
  1051. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1052. complete?: ChooseMessageFileCompleteCallback
  1053. /** 根据文件拓展名过滤,仅 type==file 时有效。每一项都不能是空字符串。默认不过滤。
  1054. *
  1055. * 最低基础库: `2.6.0` */
  1056. extension?: string[]
  1057. /** 接口调用失败的回调函数 */
  1058. fail?: ChooseMessageFileFailCallback
  1059. /** 接口调用成功的回调函数 */
  1060. success?: ChooseMessageFileSuccessCallback
  1061. /** 所选的文件的类型
  1062. *
  1063. * 可选值:
  1064. * - 'all': 从所有文件选择;
  1065. * - 'video': 只能选择视频文件;
  1066. * - 'image': 只能选择图片文件;
  1067. * - 'file': 可以选择除了图片和视频之外的其它的文件; */
  1068. type?: 'all' | 'video' | 'image' | 'file'
  1069. }
  1070. interface ChooseMessageFileSuccessCallbackResult {
  1071. /** 返回选择的文件的本地临时文件对象数组 */
  1072. tempFiles: ChooseFile[]
  1073. errMsg: string
  1074. }
  1075. interface ChooseVideoOption {
  1076. /** 默认拉起的是前置或者后置摄像头。部分 Android 手机下由于系统 ROM 不支持无法生效
  1077. *
  1078. * 可选值:
  1079. * - 'back': 默认拉起后置摄像头;
  1080. * - 'front': 默认拉起前置摄像头; */
  1081. camera?: 'back' | 'front'
  1082. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1083. complete?: ChooseVideoCompleteCallback
  1084. /** 是否压缩所选择的视频文件
  1085. *
  1086. * 最低基础库: `1.6.0` */
  1087. compressed?: boolean
  1088. /** 接口调用失败的回调函数 */
  1089. fail?: ChooseVideoFailCallback
  1090. /** 拍摄视频最长拍摄时间,单位秒 */
  1091. maxDuration?: number
  1092. /** 视频选择的来源
  1093. *
  1094. * 可选值:
  1095. * - 'album': 从相册选择视频;
  1096. * - 'camera': 使用相机拍摄视频; */
  1097. sourceType?: Array<'album' | 'camera'>
  1098. /** 接口调用成功的回调函数 */
  1099. success?: ChooseVideoSuccessCallback
  1100. }
  1101. interface ChooseVideoSuccessCallbackResult {
  1102. /** 选定视频的时间长度 */
  1103. duration: number
  1104. /** 返回选定视频的高度 */
  1105. height: number
  1106. /** 选定视频的数据量大小 */
  1107. size: number
  1108. /** 选定视频的临时文件路径 (本地路径) */
  1109. tempFilePath: string
  1110. /** 返回选定视频的宽度 */
  1111. width: number
  1112. errMsg: string
  1113. }
  1114. interface ClearOption {
  1115. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1116. complete?: ClearCompleteCallback
  1117. /** 接口调用失败的回调函数 */
  1118. fail?: ClearFailCallback
  1119. /** 接口调用成功的回调函数 */
  1120. success?: ClearSuccessCallback
  1121. }
  1122. interface ClearStorageOption {
  1123. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1124. complete?: ClearStorageCompleteCallback
  1125. /** 接口调用失败的回调函数 */
  1126. fail?: ClearStorageFailCallback
  1127. /** 接口调用成功的回调函数 */
  1128. success?: ClearStorageSuccessCallback
  1129. }
  1130. interface CloseBLEConnectionOption {
  1131. /** 用于区分设备的 id */
  1132. deviceId: string
  1133. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1134. complete?: CloseBLEConnectionCompleteCallback
  1135. /** 接口调用失败的回调函数 */
  1136. fail?: CloseBLEConnectionFailCallback
  1137. /** 接口调用成功的回调函数 */
  1138. success?: CloseBLEConnectionSuccessCallback
  1139. }
  1140. interface CloseBluetoothAdapterOption {
  1141. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1142. complete?: CloseBluetoothAdapterCompleteCallback
  1143. /** 接口调用失败的回调函数 */
  1144. fail?: CloseBluetoothAdapterFailCallback
  1145. /** 接口调用成功的回调函数 */
  1146. success?: CloseBluetoothAdapterSuccessCallback
  1147. }
  1148. interface CloseSocketOption {
  1149. /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */
  1150. code?: number
  1151. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1152. complete?: CloseSocketCompleteCallback
  1153. /** 接口调用失败的回调函数 */
  1154. fail?: CloseSocketFailCallback
  1155. /** 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于 123 字节的 UTF-8 文本(不是字符)。 */
  1156. reason?: string
  1157. /** 接口调用成功的回调函数 */
  1158. success?: CloseSocketSuccessCallback
  1159. }
  1160. /** 颜色。可以用以下几种方式来表示 canvas 中使用的颜色:
  1161. *
  1162. * - RGB 颜色: 如 `'rgb(255, 0, 0)'`
  1163. * - RGBA 颜色:如 `'rgba(255, 0, 0, 0.3)'`
  1164. * - 16 进制颜色: 如 `'#FF0000'`
  1165. * - 预定义的颜色: 如 `'red'`
  1166. *
  1167. * 其中预定义颜色有以下148个:
  1168. * *注意**: Color Name 大小写不敏感
  1169. *
  1170. * | Color Name | HEX |
  1171. * | -------------------- | ------- |
  1172. * | AliceBlue | #F0F8FF |
  1173. * | AntiqueWhite | #FAEBD7 |
  1174. * | Aqua | #00FFFF |
  1175. * | Aquamarine | #7FFFD4 |
  1176. * | Azure | #F0FFFF |
  1177. * | Beige | #F5F5DC |
  1178. * | Bisque | #FFE4C4 |
  1179. * | Black | #000000 |
  1180. * | BlanchedAlmond | #FFEBCD |
  1181. * | Blue | #0000FF |
  1182. * | BlueViolet | #8A2BE2 |
  1183. * | Brown | #A52A2A |
  1184. * | BurlyWood | #DEB887 |
  1185. * | CadetBlue | #5F9EA0 |
  1186. * | Chartreuse | #7FFF00 |
  1187. * | Chocolate | #D2691E |
  1188. * | Coral | #FF7F50 |
  1189. * | CornflowerBlue | #6495ED |
  1190. * | Cornsilk | #FFF8DC |
  1191. * | Crimson | #DC143C |
  1192. * | Cyan | #00FFFF |
  1193. * | DarkBlue | #00008B |
  1194. * | DarkCyan | #008B8B |
  1195. * | DarkGoldenRod | #B8860B |
  1196. * | DarkGray | #A9A9A9 |
  1197. * | DarkGrey | #A9A9A9 |
  1198. * | DarkGreen | #006400 |
  1199. * | DarkKhaki | #BDB76B |
  1200. * | DarkMagenta | #8B008B |
  1201. * | DarkOliveGreen | #556B2F |
  1202. * | DarkOrange | #FF8C00 |
  1203. * | DarkOrchid | #9932CC |
  1204. * | DarkRed | #8B0000 |
  1205. * | DarkSalmon | #E9967A |
  1206. * | DarkSeaGreen | #8FBC8F |
  1207. * | DarkSlateBlue | #483D8B |
  1208. * | DarkSlateGray | #2F4F4F |
  1209. * | DarkSlateGrey | #2F4F4F |
  1210. * | DarkTurquoise | #00CED1 |
  1211. * | DarkViolet | #9400D3 |
  1212. * | DeepPink | #FF1493 |
  1213. * | DeepSkyBlue | #00BFFF |
  1214. * | DimGray | #696969 |
  1215. * | DimGrey | #696969 |
  1216. * | DodgerBlue | #1E90FF |
  1217. * | FireBrick | #B22222 |
  1218. * | FloralWhite | #FFFAF0 |
  1219. * | ForestGreen | #228B22 |
  1220. * | Fuchsia | #FF00FF |
  1221. * | Gainsboro | #DCDCDC |
  1222. * | GhostWhite | #F8F8FF |
  1223. * | Gold | #FFD700 |
  1224. * | GoldenRod | #DAA520 |
  1225. * | Gray | #808080 |
  1226. * | Grey | #808080 |
  1227. * | Green | #008000 |
  1228. * | GreenYellow | #ADFF2F |
  1229. * | HoneyDew | #F0FFF0 |
  1230. * | HotPink | #FF69B4 |
  1231. * | IndianRed | #CD5C5C |
  1232. * | Indigo | #4B0082 |
  1233. * | Ivory | #FFFFF0 |
  1234. * | Khaki | #F0E68C |
  1235. * | Lavender | #E6E6FA |
  1236. * | LavenderBlush | #FFF0F5 |
  1237. * | LawnGreen | #7CFC00 |
  1238. * | LemonChiffon | #FFFACD |
  1239. * | LightBlue | #ADD8E6 |
  1240. * | LightCoral | #F08080 |
  1241. * | LightCyan | #E0FFFF |
  1242. * | LightGoldenRodYellow | #FAFAD2 |
  1243. * | LightGray | #D3D3D3 |
  1244. * | LightGrey | #D3D3D3 |
  1245. * | LightGreen | #90EE90 |
  1246. * | LightPink | #FFB6C1 |
  1247. * | LightSalmon | #FFA07A |
  1248. * | LightSeaGreen | #20B2AA |
  1249. * | LightSkyBlue | #87CEFA |
  1250. * | LightSlateGray | #778899 |
  1251. * | LightSlateGrey | #778899 |
  1252. * | LightSteelBlue | #B0C4DE |
  1253. * | LightYellow | #FFFFE0 |
  1254. * | Lime | #00FF00 |
  1255. * | LimeGreen | #32CD32 |
  1256. * | Linen | #FAF0E6 |
  1257. * | Magenta | #FF00FF |
  1258. * | Maroon | #800000 |
  1259. * | MediumAquaMarine | #66CDAA |
  1260. * | MediumBlue | #0000CD |
  1261. * | MediumOrchid | #BA55D3 |
  1262. * | MediumPurple | #9370DB |
  1263. * | MediumSeaGreen | #3CB371 |
  1264. * | MediumSlateBlue | #7B68EE |
  1265. * | MediumSpringGreen | #00FA9A |
  1266. * | MediumTurquoise | #48D1CC |
  1267. * | MediumVioletRed | #C71585 |
  1268. * | MidnightBlue | #191970 |
  1269. * | MintCream | #F5FFFA |
  1270. * | MistyRose | #FFE4E1 |
  1271. * | Moccasin | #FFE4B5 |
  1272. * | NavajoWhite | #FFDEAD |
  1273. * | Navy | #000080 |
  1274. * | OldLace | #FDF5E6 |
  1275. * | Olive | #808000 |
  1276. * | OliveDrab | #6B8E23 |
  1277. * | Orange | #FFA500 |
  1278. * | OrangeRed | #FF4500 |
  1279. * | Orchid | #DA70D6 |
  1280. * | PaleGoldenRod | #EEE8AA |
  1281. * | PaleGreen | #98FB98 |
  1282. * | PaleTurquoise | #AFEEEE |
  1283. * | PaleVioletRed | #DB7093 |
  1284. * | PapayaWhip | #FFEFD5 |
  1285. * | PeachPuff | #FFDAB9 |
  1286. * | Peru | #CD853F |
  1287. * | Pink | #FFC0CB |
  1288. * | Plum | #DDA0DD |
  1289. * | PowderBlue | #B0E0E6 |
  1290. * | Purple | #800080 |
  1291. * | RebeccaPurple | #663399 |
  1292. * | Red | #FF0000 |
  1293. * | RosyBrown | #BC8F8F |
  1294. * | RoyalBlue | #4169E1 |
  1295. * | SaddleBrown | #8B4513 |
  1296. * | Salmon | #FA8072 |
  1297. * | SandyBrown | #F4A460 |
  1298. * | SeaGreen | #2E8B57 |
  1299. * | SeaShell | #FFF5EE |
  1300. * | Sienna | #A0522D |
  1301. * | Silver | #C0C0C0 |
  1302. * | SkyBlue | #87CEEB |
  1303. * | SlateBlue | #6A5ACD |
  1304. * | SlateGray | #708090 |
  1305. * | SlateGrey | #708090 |
  1306. * | Snow | #FFFAFA |
  1307. * | SpringGreen | #00FF7F |
  1308. * | SteelBlue | #4682B4 |
  1309. * | Tan | #D2B48C |
  1310. * | Teal | #008080 |
  1311. * | Thistle | #D8BFD8 |
  1312. * | Tomato | #FF6347 |
  1313. * | Turquoise | #40E0D0 |
  1314. * | Violet | #EE82EE |
  1315. * | Wheat | #F5DEB3 |
  1316. * | White | #FFFFFF |
  1317. * | WhiteSmoke | #F5F5F5 |
  1318. * | Yellow | #FFFF00 |
  1319. * | YellowGreen | #9ACD32 | */
  1320. interface Color {}
  1321. interface CompressImageOption {
  1322. /** 图片路径,图片的路径,支持本地路径、代码包路径 */
  1323. src: string
  1324. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1325. complete?: CompressImageCompleteCallback
  1326. /** 接口调用失败的回调函数 */
  1327. fail?: CompressImageFailCallback
  1328. /** 压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效)。 */
  1329. quality?: number
  1330. /** 接口调用成功的回调函数 */
  1331. success?: CompressImageSuccessCallback
  1332. }
  1333. interface CompressImageSuccessCallbackResult {
  1334. /** 压缩后图片的临时文件路径 (本地路径) */
  1335. tempFilePath: string
  1336. errMsg: string
  1337. }
  1338. interface CompressVideoOption {
  1339. /** 码率,单位 kbps */
  1340. bitrate: number
  1341. /** 帧率 */
  1342. fps: number
  1343. /** 压缩质量
  1344. *
  1345. * 可选值:
  1346. * - 'low': 低;
  1347. * - 'medium': 中;
  1348. * - 'high': 高; */
  1349. quality: 'low' | 'medium' | 'high'
  1350. /** 相对于原视频的分辨率比例,取值范围(0, 1] */
  1351. resolution: number
  1352. /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */
  1353. src: string
  1354. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1355. complete?: CompressVideoCompleteCallback
  1356. /** 接口调用失败的回调函数 */
  1357. fail?: CompressVideoFailCallback
  1358. /** 接口调用成功的回调函数 */
  1359. success?: CompressVideoSuccessCallback
  1360. }
  1361. interface CompressVideoSuccessCallbackResult {
  1362. /** 压缩后的大小,单位 kB */
  1363. size: string
  1364. /** 压缩后的临时文件地址 */
  1365. tempFilePath: string
  1366. errMsg: string
  1367. }
  1368. interface ConnectOption {
  1369. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1370. complete?: ConnectCompleteCallback
  1371. /** 接口调用失败的回调函数 */
  1372. fail?: ConnectFailCallback
  1373. /** 接口调用成功的回调函数 */
  1374. success?: ConnectSuccessCallback
  1375. }
  1376. interface ConnectSocketOption {
  1377. /** 开发者服务器 wss 接口地址 */
  1378. url: string
  1379. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1380. complete?: ConnectSocketCompleteCallback
  1381. /** 接口调用失败的回调函数 */
  1382. fail?: ConnectSocketFailCallback
  1383. /** HTTP Header,Header 中不能设置 Referer */
  1384. header?: IAnyObject
  1385. /** 是否开启压缩扩展
  1386. *
  1387. * 最低基础库: `2.8.0` */
  1388. perMessageDeflate?: boolean
  1389. /** 子协议数组
  1390. *
  1391. * 最低基础库: `1.4.0` */
  1392. protocols?: string[]
  1393. /** 接口调用成功的回调函数 */
  1394. success?: ConnectSocketSuccessCallback
  1395. /** 建立 TCP 连接的时候的 TCP_NODELAY 设置
  1396. *
  1397. * 最低基础库: `2.4.0` */
  1398. tcpNoDelay?: boolean
  1399. /** 超时时间,单位为毫秒
  1400. *
  1401. * 最低基础库: `2.10.0` */
  1402. timeout?: number
  1403. }
  1404. interface ConnectWifiOption {
  1405. /** Wi-Fi 设备 SSID */
  1406. SSID: string
  1407. /** Wi-Fi 设备密码 */
  1408. password: string
  1409. /** Wi-Fi 设备 BSSID */
  1410. BSSID?: string
  1411. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1412. complete?: ConnectWifiCompleteCallback
  1413. /** 接口调用失败的回调函数 */
  1414. fail?: ConnectWifiFailCallback
  1415. /** 跳转到系统设置页进行连接,仅安卓生效
  1416. *
  1417. * 最低基础库: `2.12.0` */
  1418. maunal?: boolean
  1419. /** 接口调用成功的回调函数 */
  1420. success?: ConnectWifiSuccessCallback
  1421. }
  1422. interface ContextCallbackResult {
  1423. /** 节点对应的 Context 对象 */
  1424. context: IAnyObject
  1425. }
  1426. interface CopyFileFailCallbackResult {
  1427. /** 错误信息
  1428. *
  1429. * 可选值:
  1430. * - 'fail permission denied, copyFile ${srcPath} -> ${destPath}': 指定目标文件路径没有写权限;
  1431. * - 'fail no such file or directory, copyFile ${srcPath} -> ${destPath}': 源文件不存在,或目标文件路径的上层目录不存在;
  1432. * - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足;
  1433. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  1434. errMsg: string
  1435. }
  1436. interface CopyFileOption {
  1437. /** 目标文件路径,支持本地路径 */
  1438. destPath: string
  1439. /** 源文件路径,支持本地路径 */
  1440. srcPath: string
  1441. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1442. complete?: CopyFileCompleteCallback
  1443. /** 接口调用失败的回调函数 */
  1444. fail?: CopyFileFailCallback
  1445. /** 接口调用成功的回调函数 */
  1446. success?: CopyFileSuccessCallback
  1447. }
  1448. interface CreateBLEConnectionOption {
  1449. /** 用于区分设备的 id */
  1450. deviceId: string
  1451. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1452. complete?: CreateBLEConnectionCompleteCallback
  1453. /** 接口调用失败的回调函数 */
  1454. fail?: CreateBLEConnectionFailCallback
  1455. /** 接口调用成功的回调函数 */
  1456. success?: CreateBLEConnectionSuccessCallback
  1457. /** 超时时间,单位ms,不填表示不会超时 */
  1458. timeout?: number
  1459. }
  1460. interface CreateBLEPeripheralServerOption {
  1461. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1462. complete?: CreateBLEPeripheralServerCompleteCallback
  1463. /** 接口调用失败的回调函数 */
  1464. fail?: CreateBLEPeripheralServerFailCallback
  1465. /** 接口调用成功的回调函数 */
  1466. success?: CreateBLEPeripheralServerSuccessCallback
  1467. }
  1468. interface CreateBLEPeripheralServerSuccessCallbackResult {
  1469. /** [BLEPeripheralServer](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.html)
  1470. *
  1471. * 外围设备的服务端。 */
  1472. server: BLEPeripheralServer
  1473. errMsg: string
  1474. }
  1475. /** 选项 */
  1476. interface CreateIntersectionObserverOption {
  1477. /** 初始的相交比例,如果调用时检测到的相交比例与这个值不相等且达到阈值,则会触发一次监听器的回调函数。 */
  1478. initialRatio?: number
  1479. /** 是否同时观测多个目标节点(而非一个),如果设为 true ,observe 的 targetSelector 将选中多个节点(注意:同时选中过多节点将影响渲染性能)
  1480. *
  1481. * 最低基础库: `2.0.0` */
  1482. observeAll?: boolean
  1483. /** 一个数值数组,包含所有阈值。 */
  1484. thresholds?: number[]
  1485. }
  1486. interface CreateInterstitialAdOption {
  1487. /** 广告单元 id */
  1488. adUnitId: string
  1489. }
  1490. interface CreateMediaRecorderOption {
  1491. /** 指定录制的时长(s),到达自动停止。最大 7200,最小 5 */
  1492. duration?: number
  1493. /** 视频 fps */
  1494. fps?: number
  1495. /** 视频关键帧间隔 */
  1496. gop?: number
  1497. /** 视频比特率(kbps),最小值 600,最大值 3000 */
  1498. videoBitsPerSecond?: number
  1499. }
  1500. interface CreateRewardedVideoAdOption {
  1501. /** 广告单元 id */
  1502. adUnitId: string
  1503. /** 是否启用多例模式,默认为false
  1504. *
  1505. * 最低基础库: `2.8.0` */
  1506. multiton?: boolean
  1507. }
  1508. /** 可选参数 */
  1509. interface CreateWorkerOption {
  1510. /** 是否使用实验worker。在iOS下,实验worker的JS运行效率比非实验worker提升近十倍,如需在worker内进行重度计算的建议开启此选项。
  1511. *
  1512. * 最低基础库: `2.13.0` */
  1513. useExperimentalWorker?: boolean
  1514. }
  1515. /** 弹幕内容 */
  1516. interface Danmu {
  1517. /** 弹幕文字 */
  1518. text: string
  1519. /** 弹幕颜色 */
  1520. color?: string
  1521. }
  1522. /** 可选的字体描述符 */
  1523. interface DescOption {
  1524. /** 字体样式,可选值为 normal / italic / oblique */
  1525. style?: string
  1526. /** 设置小型大写字母的字体显示文本,可选值为 normal / small-caps / inherit */
  1527. variant?: string
  1528. /** 字体粗细,可选值为 normal / bold / 100 / 200../ 900 */
  1529. weight?: string
  1530. }
  1531. /** 描述符的权限 */
  1532. interface DescriptorPermission {
  1533. /** 读 */
  1534. read?: boolean
  1535. /** 写 */
  1536. write?: boolean
  1537. }
  1538. /** 指定 marker 移动到的目标点 */
  1539. interface DestinationOption {
  1540. /** 纬度 */
  1541. latitude: number
  1542. /** 经度 */
  1543. longitude: number
  1544. }
  1545. interface DisableAlertBeforeUnloadOption {
  1546. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1547. complete?: DisableAlertBeforeUnloadCompleteCallback
  1548. /** 接口调用失败的回调函数 */
  1549. fail?: DisableAlertBeforeUnloadFailCallback
  1550. /** 接口调用成功的回调函数 */
  1551. success?: DisableAlertBeforeUnloadSuccessCallback
  1552. }
  1553. interface DownloadFileOption {
  1554. /** 下载资源的 url */
  1555. url: string
  1556. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1557. complete?: DownloadFileCompleteCallback
  1558. /** 接口调用失败的回调函数 */
  1559. fail?: DownloadFileFailCallback
  1560. /** 指定文件下载后存储的路径 (本地路径)
  1561. *
  1562. * 最低基础库: `1.8.0` */
  1563. filePath?: string
  1564. /** HTTP 请求的 Header,Header 中不能设置 Referer */
  1565. header?: IAnyObject
  1566. /** 接口调用成功的回调函数 */
  1567. success?: DownloadFileSuccessCallback
  1568. /** 超时时间,单位为毫秒
  1569. *
  1570. * 最低基础库: `2.10.0` */
  1571. timeout?: number
  1572. }
  1573. interface DownloadFileSuccessCallbackResult {
  1574. /** 用户文件路径 (本地路径)。传入 filePath 时会返回,跟传入的 filePath 一致 */
  1575. filePath: string
  1576. /** 网络请求过程中一些调试信息
  1577. *
  1578. * 最低基础库: `2.10.4` */
  1579. profile: DownloadProfile
  1580. /** 开发者服务器返回的 HTTP 状态码 */
  1581. statusCode: number
  1582. /** 临时文件路径 (本地路径)。没传入 filePath 指定文件存储路径时会返回,下载后的文件会存储到一个临时文件 */
  1583. tempFilePath: string
  1584. errMsg: string
  1585. }
  1586. /** 网络请求过程中一些调试信息
  1587. *
  1588. * 最低基础库: `2.10.4` */
  1589. interface DownloadProfile {
  1590. /** SSL建立完成的时间,如果不是安全连接,则值为 0 */
  1591. SSLconnectionEnd: number
  1592. /** SSL建立连接的时间,如果不是安全连接,则值为 0 */
  1593. SSLconnectionStart: number
  1594. /** HTTP(TCP) 完成建立连接的时间(完成握手),如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接完成的时间。注意这里握手结束,包括安全连接建立完成、SOCKS 授权通过 */
  1595. connectEnd: number
  1596. /** HTTP(TCP) 开始建立连接的时间,如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接开始的时间 */
  1597. connectStart: number
  1598. /** DNS 域名查询完成的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
  1599. domainLookupEnd: number
  1600. /** DNS 域名查询开始的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
  1601. domainLookupStart: number
  1602. /** 评估当前网络下载的kbps */
  1603. downstreamThroughputKbpsEstimate: number
  1604. /** 评估的网络状态 slow 2g/2g/3g/4g */
  1605. estimate_nettype: string
  1606. /** 组件准备好使用 HTTP 请求抓取资源的时间,这发生在检查本地缓存之前 */
  1607. fetchStart: number
  1608. /** 协议层根据多个请求评估当前网络的 rtt(仅供参考) */
  1609. httpRttEstimate: number
  1610. /** 当前请求的IP */
  1611. peerIP: string
  1612. /** 当前请求的端口 */
  1613. port: number
  1614. /** 收到字节数 */
  1615. receivedBytedCount: number
  1616. /** 最后一个 HTTP 重定向完成时的时间。有跳转且是同域名内部的重定向才算,否则值为 0 */
  1617. redirectEnd: number
  1618. /** 第一个 HTTP 重定向发生时的时间。有跳转且是同域名内的重定向才算,否则值为 0 */
  1619. redirectStart: number
  1620. /** HTTP请求读取真实文档结束的时间 */
  1621. requestEnd: number
  1622. /** HTTP请求读取真实文档开始的时间(完成建立连接),包括从本地读取缓存。连接错误重连时,这里显示的也是新建立连接的时间 */
  1623. requestStart: number
  1624. /** HTTP 响应全部接收完成的时间(获取到最后一个字节),包括从本地读取缓存 */
  1625. responseEnd: number
  1626. /** HTTP 开始接收响应的时间(获取到第一个字节),包括从本地读取缓存 */
  1627. responseStart: number
  1628. /** 当次请求连接过程中实时 rtt */
  1629. rtt: number
  1630. /** 发送的字节数 */
  1631. sendBytesCount: number
  1632. /** 是否复用连接 */
  1633. socketReused: boolean
  1634. /** 当前网络的实际下载kbps */
  1635. throughputKbps: number
  1636. /** 传输层根据多个请求评估的当前网络的 rtt(仅供参考) */
  1637. transportRttEstimate: number
  1638. }
  1639. interface DownloadTaskOnProgressUpdateCallbackResult {
  1640. /** 下载进度百分比 */
  1641. progress: number
  1642. /** 预期需要下载的数据总长度,单位 Bytes */
  1643. totalBytesExpectedToWrite: number
  1644. /** 已经下载的数据长度,单位 Bytes */
  1645. totalBytesWritten: number
  1646. }
  1647. interface EnableAlertBeforeUnloadOption {
  1648. /** 询问对话框内容 */
  1649. message: string
  1650. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1651. complete?: EnableAlertBeforeUnloadCompleteCallback
  1652. /** 接口调用失败的回调函数 */
  1653. fail?: EnableAlertBeforeUnloadFailCallback
  1654. /** 接口调用成功的回调函数 */
  1655. success?: EnableAlertBeforeUnloadSuccessCallback
  1656. }
  1657. interface ExitFullScreenOption {
  1658. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1659. complete?: ExitFullScreenCompleteCallback
  1660. /** 接口调用失败的回调函数 */
  1661. fail?: ExitFullScreenFailCallback
  1662. /** 接口调用成功的回调函数 */
  1663. success?: ExitFullScreenSuccessCallback
  1664. }
  1665. interface ExitPictureInPictureOption {
  1666. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1667. complete?: ExitPictureInPictureCompleteCallback
  1668. /** 接口调用失败的回调函数 */
  1669. fail?: ExitPictureInPictureFailCallback
  1670. /** 接口调用成功的回调函数 */
  1671. success?: ExitPictureInPictureSuccessCallback
  1672. }
  1673. interface ExitVoIPChatOption {
  1674. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1675. complete?: ExitVoIPChatCompleteCallback
  1676. /** 接口调用失败的回调函数 */
  1677. fail?: ExitVoIPChatFailCallback
  1678. /** 接口调用成功的回调函数 */
  1679. success?: ExitVoIPChatSuccessCallback
  1680. }
  1681. interface ExtractDataSourceOption {
  1682. /** 视频源地址,只支持本地文件 */
  1683. source: string
  1684. }
  1685. interface Fields {
  1686. /** 指定样式名列表,返回节点对应样式名的当前值
  1687. *
  1688. * 最低基础库: `2.1.0` */
  1689. computedStyle?: string[]
  1690. /** 是否返回节点对应的 Context 对象
  1691. *
  1692. * 最低基础库: `2.4.2` */
  1693. context?: boolean
  1694. /** 是否返回节点 dataset */
  1695. dataset?: boolean
  1696. /** 是否返回节点 id */
  1697. id?: boolean
  1698. /** 是否返回节点 mark */
  1699. mark?: boolean
  1700. /** 是否返回节点对应的 Node 实例
  1701. *
  1702. * 最低基础库: `2.7.0` */
  1703. node?: boolean
  1704. /** 指定属性名列表,返回节点对应属性名的当前属性值(只能获得组件文档中标注的常规属性值,id class style 和事件绑定的属性值不可获取) */
  1705. properties?: string[]
  1706. /** 是否返回节点布局位置(`left` `right` `top` `bottom`) */
  1707. rect?: boolean
  1708. /** 否 是否返回节点的 `scrollLeft` `scrollTop`,节点必须是 `scroll-view` 或者 `viewport` */
  1709. scrollOffset?: boolean
  1710. /** 是否返回节点尺寸(`width` `height`) */
  1711. size?: boolean
  1712. }
  1713. interface FileItem {
  1714. /** 文件保存时的时间戳,从1970/01/01 08:00:00 到当前时间的秒数 */
  1715. createTime: number
  1716. /** 文件路径 (本地路径) */
  1717. filePath: string
  1718. /** 本地文件大小,以字节为单位 */
  1719. size: number
  1720. }
  1721. interface FileSystemManagerGetFileInfoOption {
  1722. /** 要读取的文件路径 (本地路径) */
  1723. filePath: string
  1724. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1725. complete?: GetFileInfoCompleteCallback
  1726. /** 接口调用失败的回调函数 */
  1727. fail?: FileSystemManagerGetFileInfoFailCallback
  1728. /** 接口调用成功的回调函数 */
  1729. success?: FileSystemManagerGetFileInfoSuccessCallback
  1730. }
  1731. interface FileSystemManagerGetFileInfoSuccessCallbackResult {
  1732. /** 文件大小,以字节为单位 */
  1733. size: number
  1734. errMsg: string
  1735. }
  1736. interface FileSystemManagerGetSavedFileListOption {
  1737. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1738. complete?: GetSavedFileListCompleteCallback
  1739. /** 接口调用失败的回调函数 */
  1740. fail?: GetSavedFileListFailCallback
  1741. /** 接口调用成功的回调函数 */
  1742. success?: FileSystemManagerGetSavedFileListSuccessCallback
  1743. }
  1744. interface FileSystemManagerGetSavedFileListSuccessCallbackResult {
  1745. /** 文件数组 */
  1746. fileList: FileItem[]
  1747. errMsg: string
  1748. }
  1749. interface FileSystemManagerRemoveSavedFileOption {
  1750. /** 需要删除的文件路径 (本地路径) */
  1751. filePath: string
  1752. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1753. complete?: RemoveSavedFileCompleteCallback
  1754. /** 接口调用失败的回调函数 */
  1755. fail?: FileSystemManagerRemoveSavedFileFailCallback
  1756. /** 接口调用成功的回调函数 */
  1757. success?: RemoveSavedFileSuccessCallback
  1758. }
  1759. interface FileSystemManagerSaveFileOption {
  1760. /** 临时存储文件路径 (本地路径) */
  1761. tempFilePath: string
  1762. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1763. complete?: SaveFileCompleteCallback
  1764. /** 接口调用失败的回调函数 */
  1765. fail?: FileSystemManagerSaveFileFailCallback
  1766. /** 要存储的文件路径 (本地路径) */
  1767. filePath?: string
  1768. /** 接口调用成功的回调函数 */
  1769. success?: SaveFileSuccessCallback
  1770. }
  1771. /** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */
  1772. interface ForwardMaterials {
  1773. /** 文件名 */
  1774. name: string
  1775. /** 文件路径(如果是webview则是url) */
  1776. path: string
  1777. /** 文件大小 */
  1778. size: number
  1779. /** 文件的mimetype类型 */
  1780. type: string
  1781. }
  1782. /** 视频帧数据,若取不到则返回 null。当缓冲区为空的时候可能暂停取不到数据。 */
  1783. interface FrameDataOptions {
  1784. /** 帧数据 */
  1785. data: ArrayBuffer
  1786. /** 帧数据高度 */
  1787. height: number
  1788. /** 帧原始 dts */
  1789. pkDts: number
  1790. /** 帧原始 pts */
  1791. pkPts: number
  1792. /** 帧数据宽度 */
  1793. width: number
  1794. }
  1795. interface FromScreenLocationOption {
  1796. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1797. complete?: FromScreenLocationCompleteCallback
  1798. /** 接口调用失败的回调函数 */
  1799. fail?: FromScreenLocationFailCallback
  1800. /** 接口调用成功的回调函数 */
  1801. success?: FromScreenLocationSuccessCallback
  1802. }
  1803. interface GetAtqaOption {
  1804. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1805. complete?: GetAtqaCompleteCallback
  1806. /** 接口调用失败的回调函数 */
  1807. fail?: GetAtqaFailCallback
  1808. /** 接口调用成功的回调函数 */
  1809. success?: GetAtqaSuccessCallback
  1810. }
  1811. interface GetAtqaSuccessCallbackResult {
  1812. /** 返回 ATQA/SENS_RES 数据 */
  1813. atqa: ArrayBuffer
  1814. errMsg: string
  1815. }
  1816. interface GetAvailableAudioSourcesOption {
  1817. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1818. complete?: GetAvailableAudioSourcesCompleteCallback
  1819. /** 接口调用失败的回调函数 */
  1820. fail?: GetAvailableAudioSourcesFailCallback
  1821. /** 接口调用成功的回调函数 */
  1822. success?: GetAvailableAudioSourcesSuccessCallback
  1823. }
  1824. interface GetAvailableAudioSourcesSuccessCallbackResult {
  1825. /** 支持的音频输入源列表,可在 [RecorderManager.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.start.html) 接口中使用。返回值定义参考 https://developer.android.com/reference/kotlin/android/media/MediaRecorder.AudioSource
  1826. *
  1827. * 可选值:
  1828. * - 'auto': 自动设置,默认使用手机麦克风,插上耳麦后自动切换使用耳机麦克风,所有平台适用;
  1829. * - 'buildInMic': 手机麦克风,仅限 iOS;
  1830. * - 'headsetMic': 耳机麦克风,仅限 iOS;
  1831. * - 'mic': 麦克风(没插耳麦时是手机麦克风,插耳麦时是耳机麦克风),仅限 Android;
  1832. * - 'camcorder': 同 mic,适用于录制音视频内容,仅限 Android;
  1833. * - 'voice_communication': 同 mic,适用于实时沟通,仅限 Android;
  1834. * - 'voice_recognition': 同 mic,适用于语音识别,仅限 Android; */
  1835. audioSources: Array<
  1836. | 'auto'
  1837. | 'buildInMic'
  1838. | 'headsetMic'
  1839. | 'mic'
  1840. | 'camcorder'
  1841. | 'voice_communication'
  1842. | 'voice_recognition'
  1843. >
  1844. errMsg: string
  1845. }
  1846. interface GetBLEDeviceCharacteristicsOption {
  1847. /** 蓝牙设备 id */
  1848. deviceId: string
  1849. /** 蓝牙服务 uuid,需要使用 `getBLEDeviceServices` 获取 */
  1850. serviceId: string
  1851. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1852. complete?: GetBLEDeviceCharacteristicsCompleteCallback
  1853. /** 接口调用失败的回调函数 */
  1854. fail?: GetBLEDeviceCharacteristicsFailCallback
  1855. /** 接口调用成功的回调函数 */
  1856. success?: GetBLEDeviceCharacteristicsSuccessCallback
  1857. }
  1858. interface GetBLEDeviceCharacteristicsSuccessCallbackResult {
  1859. /** 设备特征值列表 */
  1860. characteristics: BLECharacteristic[]
  1861. errMsg: string
  1862. }
  1863. interface GetBLEDeviceRSSIOption {
  1864. /** 蓝牙设备 id */
  1865. deviceId: string
  1866. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1867. complete?: GetBLEDeviceRSSICompleteCallback
  1868. /** 接口调用失败的回调函数 */
  1869. fail?: GetBLEDeviceRSSIFailCallback
  1870. /** 接口调用成功的回调函数 */
  1871. success?: GetBLEDeviceRSSISuccessCallback
  1872. }
  1873. interface GetBLEDeviceRSSISuccessCallbackResult {
  1874. /** 信号强度 */
  1875. RSSI: number
  1876. errMsg: string
  1877. }
  1878. interface GetBLEDeviceServicesOption {
  1879. /** 蓝牙设备 id */
  1880. deviceId: string
  1881. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1882. complete?: GetBLEDeviceServicesCompleteCallback
  1883. /** 接口调用失败的回调函数 */
  1884. fail?: GetBLEDeviceServicesFailCallback
  1885. /** 接口调用成功的回调函数 */
  1886. success?: GetBLEDeviceServicesSuccessCallback
  1887. }
  1888. interface GetBLEDeviceServicesSuccessCallbackResult {
  1889. /** 设备服务列表 */
  1890. services: BLEService[]
  1891. errMsg: string
  1892. }
  1893. interface GetBackgroundAudioPlayerStateOption {
  1894. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1895. complete?: GetBackgroundAudioPlayerStateCompleteCallback
  1896. /** 接口调用失败的回调函数 */
  1897. fail?: GetBackgroundAudioPlayerStateFailCallback
  1898. /** 接口调用成功的回调函数 */
  1899. success?: GetBackgroundAudioPlayerStateSuccessCallback
  1900. }
  1901. interface GetBackgroundAudioPlayerStateSuccessCallbackResult {
  1902. /** 选定音频的播放位置(单位:s),只有在音乐播放中时返回 */
  1903. currentPosition: number
  1904. /** 歌曲数据链接,只有在音乐播放中时返回 */
  1905. dataUrl: string
  1906. /** 音频的下载进度百分比,只有在音乐播放中时返回 */
  1907. downloadPercent: number
  1908. /** 选定音频的长度(单位:s),只有在音乐播放中时返回 */
  1909. duration: number
  1910. /** 播放状态
  1911. *
  1912. * 可选值:
  1913. * - 0: 暂停中;
  1914. * - 1: 播放中;
  1915. * - 2: 没有音乐播放; */
  1916. status: 0 | 1 | 2
  1917. errMsg: string
  1918. }
  1919. interface GetBackgroundFetchDataOption {
  1920. /** 取值为 periodic */
  1921. fetchType: string
  1922. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1923. complete?: GetBackgroundFetchDataCompleteCallback
  1924. /** 接口调用失败的回调函数 */
  1925. fail?: GetBackgroundFetchDataFailCallback
  1926. /** 接口调用成功的回调函数 */
  1927. success?: GetBackgroundFetchDataSuccessCallback
  1928. }
  1929. interface GetBackgroundFetchTokenOption {
  1930. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1931. complete?: GetBackgroundFetchTokenCompleteCallback
  1932. /** 接口调用失败的回调函数 */
  1933. fail?: GetBackgroundFetchTokenFailCallback
  1934. /** 接口调用成功的回调函数 */
  1935. success?: GetBackgroundFetchTokenSuccessCallback
  1936. }
  1937. interface GetBatteryInfoOption {
  1938. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1939. complete?: GetBatteryInfoCompleteCallback
  1940. /** 接口调用失败的回调函数 */
  1941. fail?: GetBatteryInfoFailCallback
  1942. /** 接口调用成功的回调函数 */
  1943. success?: GetBatteryInfoSuccessCallback
  1944. }
  1945. interface GetBatteryInfoSuccessCallbackResult {
  1946. /** 是否正在充电中 */
  1947. isCharging: boolean
  1948. /** 设备电量,范围 1 - 100 */
  1949. level: string
  1950. errMsg: string
  1951. }
  1952. interface GetBatteryInfoSyncResult {
  1953. /** 是否正在充电中 */
  1954. isCharging: boolean
  1955. /** 设备电量,范围 1 - 100 */
  1956. level: string
  1957. }
  1958. interface GetBeaconsOption {
  1959. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1960. complete?: GetBeaconsCompleteCallback
  1961. /** 接口调用失败的回调函数 */
  1962. fail?: GetBeaconsFailCallback
  1963. /** 接口调用成功的回调函数 */
  1964. success?: GetBeaconsSuccessCallback
  1965. }
  1966. interface GetBeaconsSuccessCallbackResult {
  1967. /** iBeacon 设备列表 */
  1968. beacons: IBeaconInfo[]
  1969. errMsg: string
  1970. }
  1971. interface GetBluetoothAdapterStateOption {
  1972. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1973. complete?: GetBluetoothAdapterStateCompleteCallback
  1974. /** 接口调用失败的回调函数 */
  1975. fail?: GetBluetoothAdapterStateFailCallback
  1976. /** 接口调用成功的回调函数 */
  1977. success?: GetBluetoothAdapterStateSuccessCallback
  1978. }
  1979. interface GetBluetoothAdapterStateSuccessCallbackResult {
  1980. /** 蓝牙适配器是否可用 */
  1981. available: boolean
  1982. /** 是否正在搜索设备 */
  1983. discovering: boolean
  1984. errMsg: string
  1985. }
  1986. interface GetBluetoothDevicesOption {
  1987. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1988. complete?: GetBluetoothDevicesCompleteCallback
  1989. /** 接口调用失败的回调函数 */
  1990. fail?: GetBluetoothDevicesFailCallback
  1991. /** 接口调用成功的回调函数 */
  1992. success?: GetBluetoothDevicesSuccessCallback
  1993. }
  1994. interface GetBluetoothDevicesSuccessCallbackResult {
  1995. /** uuid 对应的的已连接设备列表 */
  1996. devices: BlueToothDevice[]
  1997. errMsg: string
  1998. }
  1999. interface GetCenterLocationOption {
  2000. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2001. complete?: GetCenterLocationCompleteCallback
  2002. /** 接口调用失败的回调函数 */
  2003. fail?: GetCenterLocationFailCallback
  2004. /** 接口调用成功的回调函数 */
  2005. success?: GetCenterLocationSuccessCallback
  2006. }
  2007. interface GetCenterLocationSuccessCallbackResult {
  2008. /** 纬度 */
  2009. latitude: number
  2010. /** 经度 */
  2011. longitude: number
  2012. errMsg: string
  2013. }
  2014. interface GetClipboardDataOption {
  2015. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2016. complete?: GetClipboardDataCompleteCallback
  2017. /** 接口调用失败的回调函数 */
  2018. fail?: GetClipboardDataFailCallback
  2019. /** 接口调用成功的回调函数 */
  2020. success?: GetClipboardDataSuccessCallback
  2021. }
  2022. interface GetClipboardDataSuccessCallbackOption {
  2023. /** 剪贴板的内容 */
  2024. data: string
  2025. }
  2026. interface GetConnectedBluetoothDevicesOption {
  2027. /** 蓝牙设备主 service 的 uuid 列表 */
  2028. services: string[]
  2029. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2030. complete?: GetConnectedBluetoothDevicesCompleteCallback
  2031. /** 接口调用失败的回调函数 */
  2032. fail?: GetConnectedBluetoothDevicesFailCallback
  2033. /** 接口调用成功的回调函数 */
  2034. success?: GetConnectedBluetoothDevicesSuccessCallback
  2035. }
  2036. interface GetConnectedBluetoothDevicesSuccessCallbackResult {
  2037. /** 搜索到的设备列表 */
  2038. devices: BluetoothDeviceInfo[]
  2039. errMsg: string
  2040. }
  2041. interface GetConnectedWifiOption {
  2042. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2043. complete?: GetConnectedWifiCompleteCallback
  2044. /** 接口调用失败的回调函数 */
  2045. fail?: GetConnectedWifiFailCallback
  2046. /** 接口调用成功的回调函数 */
  2047. success?: GetConnectedWifiSuccessCallback
  2048. }
  2049. interface GetConnectedWifiSuccessCallbackResult {
  2050. /** [WifiInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/WifiInfo.html)
  2051. *
  2052. * Wi-Fi 信息 */
  2053. wifi: WifiInfo
  2054. errMsg: string
  2055. }
  2056. interface GetContentsOption {
  2057. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2058. complete?: GetContentsCompleteCallback
  2059. /** 接口调用失败的回调函数 */
  2060. fail?: GetContentsFailCallback
  2061. /** 接口调用成功的回调函数 */
  2062. success?: GetContentsSuccessCallback
  2063. }
  2064. interface GetContentsSuccessCallbackResult {
  2065. /** 表示内容的delta对象 */
  2066. delta: IAnyObject
  2067. /** 带标签的HTML内容 */
  2068. html: string
  2069. /** 纯文本内容 */
  2070. text: string
  2071. errMsg: string
  2072. }
  2073. interface GetExtConfigOption {
  2074. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2075. complete?: GetExtConfigCompleteCallback
  2076. /** 接口调用失败的回调函数 */
  2077. fail?: GetExtConfigFailCallback
  2078. /** 接口调用成功的回调函数 */
  2079. success?: GetExtConfigSuccessCallback
  2080. }
  2081. interface GetExtConfigSuccessCallbackResult {
  2082. /** 第三方平台自定义的数据 */
  2083. extConfig: IAnyObject
  2084. errMsg: string
  2085. }
  2086. interface GetFileInfoFailCallbackResult {
  2087. /** 错误信息
  2088. *
  2089. * 可选值:
  2090. * - 'fail file not exist': 指定的 filePath 找不到文件; */
  2091. errMsg: string
  2092. }
  2093. interface GetGroupEnterInfoOption {
  2094. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2095. complete?: GetGroupEnterInfoCompleteCallback
  2096. /** 接口调用失败的回调函数 */
  2097. fail?: GetGroupEnterInfoFailCallback
  2098. /** 接口调用成功的回调函数 */
  2099. success?: GetGroupEnterInfoSuccessCallback
  2100. }
  2101. interface GetGroupEnterInfoSuccessCallbackResult {
  2102. /** 敏感数据对应的云 ID,开通[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud)
  2103. *
  2104. * 最低基础库: `2.7.0` */
  2105. cloudID: string
  2106. /** 包括敏感数据在内的完整转发信息的加密数据,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  2107. encryptedData: string
  2108. /** 错误信息 */
  2109. errMsg: string
  2110. /** 加密算法的初始向量,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  2111. iv: string
  2112. }
  2113. interface GetHCEStateOption {
  2114. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2115. complete?: GetHCEStateCompleteCallback
  2116. /** 接口调用失败的回调函数 */
  2117. fail?: GetHCEStateFailCallback
  2118. /** 接口调用成功的回调函数 */
  2119. success?: GetHCEStateSuccessCallback
  2120. }
  2121. interface GetHistoricalBytesOption {
  2122. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2123. complete?: GetHistoricalBytesCompleteCallback
  2124. /** 接口调用失败的回调函数 */
  2125. fail?: GetHistoricalBytesFailCallback
  2126. /** 接口调用成功的回调函数 */
  2127. success?: GetHistoricalBytesSuccessCallback
  2128. }
  2129. interface GetHistoricalBytesSuccessCallbackResult {
  2130. /** 返回历史二进制数据 */
  2131. histBytes: ArrayBuffer
  2132. errMsg: string
  2133. }
  2134. interface GetImageInfoOption {
  2135. /** 图片的路径,支持网络路径、本地路径、代码包路径 */
  2136. src: string
  2137. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2138. complete?: GetImageInfoCompleteCallback
  2139. /** 接口调用失败的回调函数 */
  2140. fail?: GetImageInfoFailCallback
  2141. /** 接口调用成功的回调函数 */
  2142. success?: GetImageInfoSuccessCallback
  2143. }
  2144. interface GetImageInfoSuccessCallbackResult {
  2145. /** 图片原始高度,单位px。不考虑旋转。 */
  2146. height: number
  2147. /** [拍照时设备方向](http://sylvana.net/jpegcrop/exif_orientation.html)
  2148. *
  2149. * 可选值:
  2150. * - 'up': 默认方向(手机横持拍照),对应 Exif 中的 1。或无 orientation 信息。;
  2151. * - 'up-mirrored': 同 up,但镜像翻转,对应 Exif 中的 2;
  2152. * - 'down': 旋转180度,对应 Exif 中的 3;
  2153. * - 'down-mirrored': 同 down,但镜像翻转,对应 Exif 中的 4;
  2154. * - 'left-mirrored': 同 left,但镜像翻转,对应 Exif 中的 5;
  2155. * - 'right': 顺时针旋转90度,对应 Exif 中的 6;
  2156. * - 'right-mirrored': 同 right,但镜像翻转,对应 Exif 中的 7;
  2157. * - 'left': 逆时针旋转90度,对应 Exif 中的 8;
  2158. *
  2159. * 最低基础库: `1.9.90` */
  2160. orientation:
  2161. | 'up'
  2162. | 'up-mirrored'
  2163. | 'down'
  2164. | 'down-mirrored'
  2165. | 'left-mirrored'
  2166. | 'right'
  2167. | 'right-mirrored'
  2168. | 'left'
  2169. /** 图片的本地路径 */
  2170. path: string
  2171. /** 图片格式
  2172. *
  2173. * 最低基础库: `1.9.90` */
  2174. type: string
  2175. /** 图片原始宽度,单位px。不考虑旋转。 */
  2176. width: number
  2177. errMsg: string
  2178. }
  2179. interface GetLocationOption {
  2180. /** 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度
  2181. *
  2182. * 最低基础库: `1.6.0` */
  2183. altitude?: string
  2184. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2185. complete?: GetLocationCompleteCallback
  2186. /** 接口调用失败的回调函数 */
  2187. fail?: GetLocationFailCallback
  2188. /** 高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果
  2189. *
  2190. * 最低基础库: `2.9.0` */
  2191. highAccuracyExpireTime?: number
  2192. /** 开启高精度定位
  2193. *
  2194. * 最低基础库: `2.9.0` */
  2195. isHighAccuracy?: boolean
  2196. /** 接口调用成功的回调函数 */
  2197. success?: GetLocationSuccessCallback
  2198. /** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标 */
  2199. type?: string
  2200. }
  2201. interface GetLocationSuccessCallbackResult {
  2202. /** 位置的精确度 */
  2203. accuracy: number
  2204. /** 高度,单位 m
  2205. *
  2206. * 最低基础库: `1.2.0` */
  2207. altitude: number
  2208. /** 水平精度,单位 m
  2209. *
  2210. * 最低基础库: `1.2.0` */
  2211. horizontalAccuracy: number
  2212. /** 纬度,范围为 -90~90,负数表示南纬 */
  2213. latitude: number
  2214. /** 经度,范围为 -180~180,负数表示西经 */
  2215. longitude: number
  2216. /** 速度,单位 m/s */
  2217. speed: number
  2218. /** 垂直精度,单位 m(Android 无法获取,返回 0)
  2219. *
  2220. * 最低基础库: `1.2.0` */
  2221. verticalAccuracy: number
  2222. errMsg: string
  2223. }
  2224. interface GetLogManagerOption {
  2225. /** 取值为0/1,取值为0表示是否会把 `App`、`Page` 的生命周期函数和 `wx` 命名空间下的函数调用写入日志,取值为1则不会。默认值是 0
  2226. *
  2227. * 最低基础库: `2.3.2` */
  2228. level?: number
  2229. }
  2230. interface GetMaxTransceiveLengthOption {
  2231. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2232. complete?: GetMaxTransceiveLengthCompleteCallback
  2233. /** 接口调用失败的回调函数 */
  2234. fail?: GetMaxTransceiveLengthFailCallback
  2235. /** 接口调用成功的回调函数 */
  2236. success?: GetMaxTransceiveLengthSuccessCallback
  2237. }
  2238. interface GetMaxTransceiveLengthSuccessCallbackResult {
  2239. /** 最大传输长度 */
  2240. length: number
  2241. errMsg: string
  2242. }
  2243. interface GetNetworkTypeOption {
  2244. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2245. complete?: GetNetworkTypeCompleteCallback
  2246. /** 接口调用失败的回调函数 */
  2247. fail?: GetNetworkTypeFailCallback
  2248. /** 接口调用成功的回调函数 */
  2249. success?: GetNetworkTypeSuccessCallback
  2250. }
  2251. interface GetNetworkTypeSuccessCallbackResult {
  2252. /** 网络类型
  2253. *
  2254. * 可选值:
  2255. * - 'wifi': wifi 网络;
  2256. * - '2g': 2g 网络;
  2257. * - '3g': 3g 网络;
  2258. * - '4g': 4g 网络;
  2259. * - '5g': 5g 网络;
  2260. * - 'unknown': Android 下不常见的网络类型;
  2261. * - 'none': 无网络; */
  2262. networkType: 'wifi' | '2g' | '3g' | '4g' | '5g' | 'unknown' | 'none'
  2263. errMsg: string
  2264. }
  2265. interface GetRandomValuesOption {
  2266. /** 整数,生成随机数的字节数,最大 1048576 */
  2267. length: number
  2268. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2269. complete?: GetRandomValuesCompleteCallback
  2270. /** 接口调用失败的回调函数 */
  2271. fail?: GetRandomValuesFailCallback
  2272. /** 接口调用成功的回调函数 */
  2273. success?: GetRandomValuesSuccessCallback
  2274. }
  2275. interface GetRandomValuesSuccessCallbackResult {
  2276. /** 随机数内容,长度为传入的字节数 */
  2277. randomValues: ArrayBuffer
  2278. errMsg: string
  2279. }
  2280. interface GetRegionOption {
  2281. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2282. complete?: GetRegionCompleteCallback
  2283. /** 接口调用失败的回调函数 */
  2284. fail?: GetRegionFailCallback
  2285. /** 接口调用成功的回调函数 */
  2286. success?: GetRegionSuccessCallback
  2287. }
  2288. interface GetRegionSuccessCallbackResult {
  2289. /** 东北角经纬度 */
  2290. northeast: MapPostion
  2291. /** 西南角经纬度 */
  2292. southwest: MapPostion
  2293. errMsg: string
  2294. }
  2295. interface GetRotateOption {
  2296. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2297. complete?: GetRotateCompleteCallback
  2298. /** 接口调用失败的回调函数 */
  2299. fail?: GetRotateFailCallback
  2300. /** 接口调用成功的回调函数 */
  2301. success?: GetRotateSuccessCallback
  2302. }
  2303. interface GetRotateSuccessCallbackResult {
  2304. /** 旋转角 */
  2305. rotate: number
  2306. errMsg: string
  2307. }
  2308. interface GetSakOption {
  2309. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2310. complete?: GetSakCompleteCallback
  2311. /** 接口调用失败的回调函数 */
  2312. fail?: GetSakFailCallback
  2313. /** 接口调用成功的回调函数 */
  2314. success?: GetSakSuccessCallback
  2315. }
  2316. interface GetSakSuccessCallbackResult {
  2317. /** 返回 SAK/SEL_RES 数据 */
  2318. sak: number
  2319. errMsg: string
  2320. }
  2321. interface GetSavedFileInfoOption {
  2322. /** 文件路径 (本地路径) */
  2323. filePath: string
  2324. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2325. complete?: GetSavedFileInfoCompleteCallback
  2326. /** 接口调用失败的回调函数 */
  2327. fail?: GetSavedFileInfoFailCallback
  2328. /** 接口调用成功的回调函数 */
  2329. success?: GetSavedFileInfoSuccessCallback
  2330. }
  2331. interface GetSavedFileInfoSuccessCallbackResult {
  2332. /** 文件保存时的时间戳,从1970/01/01 08:00:00 到该时刻的秒数 */
  2333. createTime: number
  2334. /** 文件大小,单位 B */
  2335. size: number
  2336. errMsg: string
  2337. }
  2338. interface GetScaleOption {
  2339. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2340. complete?: GetScaleCompleteCallback
  2341. /** 接口调用失败的回调函数 */
  2342. fail?: GetScaleFailCallback
  2343. /** 接口调用成功的回调函数 */
  2344. success?: GetScaleSuccessCallback
  2345. }
  2346. interface GetScaleSuccessCallbackResult {
  2347. /** 缩放值 */
  2348. scale: number
  2349. errMsg: string
  2350. }
  2351. interface GetScreenBrightnessOption {
  2352. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2353. complete?: GetScreenBrightnessCompleteCallback
  2354. /** 接口调用失败的回调函数 */
  2355. fail?: GetScreenBrightnessFailCallback
  2356. /** 接口调用成功的回调函数 */
  2357. success?: GetScreenBrightnessSuccessCallback
  2358. }
  2359. interface GetScreenBrightnessSuccessCallbackOption {
  2360. /** 屏幕亮度值,范围 0 ~ 1,0 最暗,1 最亮 */
  2361. value: number
  2362. }
  2363. interface GetSelectedTextRangeOption {
  2364. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2365. complete?: GetSelectedTextRangeCompleteCallback
  2366. /** 接口调用失败的回调函数 */
  2367. fail?: GetSelectedTextRangeFailCallback
  2368. /** 接口调用成功的回调函数 */
  2369. success?: GetSelectedTextRangeSuccessCallback
  2370. }
  2371. interface GetSelectedTextRangeSuccessCallbackResult {
  2372. /** 输入框光标结束位置 */
  2373. end: number
  2374. /** 输入框光标起始位置 */
  2375. start: number
  2376. errMsg: string
  2377. }
  2378. interface GetSelectionTextOption {
  2379. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2380. complete?: GetSelectionTextCompleteCallback
  2381. /** 接口调用失败的回调函数 */
  2382. fail?: GetSelectionTextFailCallback
  2383. /** 接口调用成功的回调函数 */
  2384. success?: GetSelectionTextSuccessCallback
  2385. }
  2386. interface GetSelectionTextSuccessCallbackResult {
  2387. /** 纯文本内容 */
  2388. text: string
  2389. errMsg: string
  2390. }
  2391. interface GetSettingOption {
  2392. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2393. complete?: GetSettingCompleteCallback
  2394. /** 接口调用失败的回调函数 */
  2395. fail?: GetSettingFailCallback
  2396. /** 接口调用成功的回调函数 */
  2397. success?: GetSettingSuccessCallback
  2398. /** 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。
  2399. *
  2400. * 最低基础库: `2.10.1` */
  2401. withSubscriptions?: boolean
  2402. }
  2403. interface GetSettingSuccessCallbackResult {
  2404. /** [AuthSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/AuthSetting.html)
  2405. *
  2406. * 用户授权结果 */
  2407. authSetting: AuthSetting
  2408. /** [SubscriptionsSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/SubscriptionsSetting.html)
  2409. *
  2410. * 用户订阅消息设置,接口参数`withSubscriptions`值为`true`时才会返回。
  2411. *
  2412. * 最低基础库: `2.10.1` */
  2413. subscriptionsSetting: SubscriptionsSetting
  2414. /** [AuthSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/AuthSetting.html)
  2415. *
  2416. * 在插件中调用时,当前宿主小程序的用户授权结果 */
  2417. miniprogramAuthSetting?: AuthSetting
  2418. errMsg: string
  2419. }
  2420. interface GetShareInfoOption {
  2421. /** shareTicket */
  2422. shareTicket: string
  2423. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2424. complete?: GetShareInfoCompleteCallback
  2425. /** 接口调用失败的回调函数 */
  2426. fail?: GetShareInfoFailCallback
  2427. /** 接口调用成功的回调函数 */
  2428. success?: GetShareInfoSuccessCallback
  2429. /** 超时时间,单位 ms
  2430. *
  2431. * 最低基础库: `1.9.90` */
  2432. timeout?: number
  2433. }
  2434. interface GetSkewOption {
  2435. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2436. complete?: GetSkewCompleteCallback
  2437. /** 接口调用失败的回调函数 */
  2438. fail?: GetSkewFailCallback
  2439. /** 接口调用成功的回调函数 */
  2440. success?: GetSkewSuccessCallback
  2441. }
  2442. interface GetSkewSuccessCallbackResult {
  2443. /** 倾斜角 */
  2444. skew: number
  2445. errMsg: string
  2446. }
  2447. interface GetStorageInfoOption {
  2448. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2449. complete?: GetStorageInfoCompleteCallback
  2450. /** 接口调用失败的回调函数 */
  2451. fail?: GetStorageInfoFailCallback
  2452. /** 接口调用成功的回调函数 */
  2453. success?: GetStorageInfoSuccessCallback
  2454. }
  2455. interface GetStorageInfoSuccessCallbackOption {
  2456. /** 当前占用的空间大小, 单位 KB */
  2457. currentSize: number
  2458. /** 当前 storage 中所有的 key */
  2459. keys: string[]
  2460. /** 限制的空间大小,单位 KB */
  2461. limitSize: number
  2462. }
  2463. interface GetStorageInfoSyncOption {
  2464. /** 当前占用的空间大小, 单位 KB */
  2465. currentSize: number
  2466. /** 当前 storage 中所有的 key */
  2467. keys: string[]
  2468. /** 限制的空间大小,单位 KB */
  2469. limitSize: number
  2470. }
  2471. interface GetStorageOption<T = any> {
  2472. /** 本地缓存中指定的 key */
  2473. key: string
  2474. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2475. complete?: GetStorageCompleteCallback
  2476. /** 接口调用失败的回调函数 */
  2477. fail?: GetStorageFailCallback
  2478. /** 接口调用成功的回调函数 */
  2479. success?: GetStorageSuccessCallback<T>
  2480. }
  2481. interface GetStorageSuccessCallbackResult<T = any> {
  2482. /** key对应的内容 */
  2483. data: T
  2484. errMsg: string
  2485. }
  2486. interface GetSystemInfoAsyncOption {
  2487. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2488. complete?: GetSystemInfoAsyncCompleteCallback
  2489. /** 接口调用失败的回调函数 */
  2490. fail?: GetSystemInfoAsyncFailCallback
  2491. /** 接口调用成功的回调函数 */
  2492. success?: GetSystemInfoAsyncSuccessCallback
  2493. }
  2494. interface GetSystemInfoOption {
  2495. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2496. complete?: GetSystemInfoCompleteCallback
  2497. /** 接口调用失败的回调函数 */
  2498. fail?: GetSystemInfoFailCallback
  2499. /** 接口调用成功的回调函数 */
  2500. success?: GetSystemInfoSuccessCallback
  2501. }
  2502. interface GetUserInfoOption {
  2503. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2504. complete?: GetUserInfoCompleteCallback
  2505. /** 接口调用失败的回调函数 */
  2506. fail?: GetUserInfoFailCallback
  2507. /** 显示用户信息的语言
  2508. *
  2509. * 可选值:
  2510. * - 'en': 英文;
  2511. * - 'zh_CN': 简体中文;
  2512. * - 'zh_TW': 繁体中文; */
  2513. lang?: 'en' | 'zh_CN' | 'zh_TW'
  2514. /** 接口调用成功的回调函数 */
  2515. success?: GetUserInfoSuccessCallback
  2516. /** 是否带上登录态信息。当 withCredentials 为 true 时,要求此前有调用过 wx.login 且登录态尚未过期,此时返回的数据会包含 encryptedData, iv 等敏感信息;当 withCredentials 为 false 时,不要求有登录态,返回的数据不包含 encryptedData, iv 等敏感信息。 */
  2517. withCredentials?: boolean
  2518. }
  2519. interface GetUserInfoSuccessCallbackResult {
  2520. /** 敏感数据对应的云 ID,开通[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html)的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud)
  2521. *
  2522. * 最低基础库: `2.7.0` */
  2523. cloudID: string
  2524. /** 包括敏感数据在内的完整用户信息的加密数据,详见 [用户数据的签名验证和加解密]((signature#加密数据解密算法)) */
  2525. encryptedData: string
  2526. /** 加密算法的初始向量,详见 [用户数据的签名验证和加解密]((signature#加密数据解密算法)) */
  2527. iv: string
  2528. /** 不包括敏感信息的原始数据字符串,用于计算签名 */
  2529. rawData: string
  2530. /** 使用 sha1( rawData + sessionkey ) 得到字符串,用于校验用户信息,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  2531. signature: string
  2532. /** [UserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/UserInfo.html)
  2533. *
  2534. * 用户信息对象,不包含 openid 等敏感信息 */
  2535. userInfo: UserInfo
  2536. errMsg: string
  2537. }
  2538. interface GetUserProfileOption {
  2539. /** 声明获取用户个人信息后的用途,不超过30个字符 */
  2540. desc: string
  2541. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2542. complete?: GetUserProfileCompleteCallback
  2543. /** 接口调用失败的回调函数 */
  2544. fail?: GetUserProfileFailCallback
  2545. /** 显示用户信息的语言
  2546. *
  2547. * 可选值:
  2548. * - 'en': 英文;
  2549. * - 'zh_CN': 简体中文;
  2550. * - 'zh_TW': 繁体中文; */
  2551. lang?: 'en' | 'zh_CN' | 'zh_TW'
  2552. /** 接口调用成功的回调函数 */
  2553. success?: GetUserProfileSuccessCallback
  2554. }
  2555. interface GetUserProfileSuccessCallbackResult {
  2556. /** [UserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/UserInfo.html)
  2557. *
  2558. * 用户信息对象 */
  2559. userInfo: UserInfo
  2560. errMsg: string
  2561. signature?: string
  2562. }
  2563. interface GetVideoInfoOption {
  2564. /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */
  2565. src: string
  2566. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2567. complete?: GetVideoInfoCompleteCallback
  2568. /** 接口调用失败的回调函数 */
  2569. fail?: GetVideoInfoFailCallback
  2570. /** 接口调用成功的回调函数 */
  2571. success?: GetVideoInfoSuccessCallback
  2572. }
  2573. interface GetVideoInfoSuccessCallbackResult {
  2574. /** 视频码率,单位 kbps */
  2575. bitrate: number
  2576. /** 视频长度 */
  2577. duration: number
  2578. /** 视频帧率 */
  2579. fps: number
  2580. /** 视频的长,单位 px */
  2581. height: number
  2582. /** 画面方向
  2583. *
  2584. * 可选值:
  2585. * - 'up': 默认;
  2586. * - 'down': 180度旋转;
  2587. * - 'left': 逆时针旋转90度;
  2588. * - 'right': 顺时针旋转90度;
  2589. * - 'up-mirrored': 同up,但水平翻转;
  2590. * - 'down-mirrored': 同down,但水平翻转;
  2591. * - 'left-mirrored': 同left,但垂直翻转;
  2592. * - 'right-mirrored': 同right,但垂直翻转; */
  2593. orientation:
  2594. | 'up'
  2595. | 'down'
  2596. | 'left'
  2597. | 'right'
  2598. | 'up-mirrored'
  2599. | 'down-mirrored'
  2600. | 'left-mirrored'
  2601. | 'right-mirrored'
  2602. /** 视频大小,单位 kB */
  2603. size: number
  2604. /** 视频格式 */
  2605. type: string
  2606. /** 视频的宽,单位 px */
  2607. width: number
  2608. errMsg: string
  2609. }
  2610. interface GetWeRunDataOption {
  2611. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2612. complete?: GetWeRunDataCompleteCallback
  2613. /** 接口调用失败的回调函数 */
  2614. fail?: GetWeRunDataFailCallback
  2615. /** 接口调用成功的回调函数 */
  2616. success?: GetWeRunDataSuccessCallback
  2617. }
  2618. interface GetWeRunDataSuccessCallbackResult {
  2619. /** 敏感数据对应的云 ID,开通云开发的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud)
  2620. *
  2621. * 最低基础库: `2.7.0` */
  2622. cloudID: string
  2623. /** 包括敏感数据在内的完整用户信息的加密数据,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html)。解密后得到的数据结构见后文 */
  2624. encryptedData: string
  2625. /** 加密算法的初始向量,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  2626. iv: string
  2627. errMsg: string
  2628. }
  2629. interface GetWifiListOption {
  2630. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2631. complete?: GetWifiListCompleteCallback
  2632. /** 接口调用失败的回调函数 */
  2633. fail?: GetWifiListFailCallback
  2634. /** 接口调用成功的回调函数 */
  2635. success?: GetWifiListSuccessCallback
  2636. }
  2637. interface HideHomeButtonOption {
  2638. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2639. complete?: HideHomeButtonCompleteCallback
  2640. /** 接口调用失败的回调函数 */
  2641. fail?: HideHomeButtonFailCallback
  2642. /** 接口调用成功的回调函数 */
  2643. success?: HideHomeButtonSuccessCallback
  2644. }
  2645. interface HideKeyboardOption {
  2646. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2647. complete?: HideKeyboardCompleteCallback
  2648. /** 接口调用失败的回调函数 */
  2649. fail?: HideKeyboardFailCallback
  2650. /** 接口调用成功的回调函数 */
  2651. success?: HideKeyboardSuccessCallback
  2652. }
  2653. interface HideLoadingOption {
  2654. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2655. complete?: HideLoadingCompleteCallback
  2656. /** 接口调用失败的回调函数 */
  2657. fail?: HideLoadingFailCallback
  2658. /** 接口调用成功的回调函数 */
  2659. success?: HideLoadingSuccessCallback
  2660. }
  2661. interface HideNavigationBarLoadingOption {
  2662. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2663. complete?: HideNavigationBarLoadingCompleteCallback
  2664. /** 接口调用失败的回调函数 */
  2665. fail?: HideNavigationBarLoadingFailCallback
  2666. /** 接口调用成功的回调函数 */
  2667. success?: HideNavigationBarLoadingSuccessCallback
  2668. }
  2669. interface HideShareMenuOption {
  2670. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2671. complete?: HideShareMenuCompleteCallback
  2672. /** 接口调用失败的回调函数 */
  2673. fail?: HideShareMenuFailCallback
  2674. /** 本接口为 Beta 版本,暂只在 Android 平台支持。需要隐藏的转发按钮名称列表,默认['shareAppMessage', 'shareTimeline']。按钮名称合法值包含 "shareAppMessage"、"shareTimeline" 两种
  2675. *
  2676. * 最低基础库: `2.11.3` */
  2677. menus?: string[]
  2678. /** 接口调用成功的回调函数 */
  2679. success?: HideShareMenuSuccessCallback
  2680. }
  2681. interface HideTabBarOption {
  2682. /** 是否需要动画效果 */
  2683. animation?: boolean
  2684. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2685. complete?: HideTabBarCompleteCallback
  2686. /** 接口调用失败的回调函数 */
  2687. fail?: HideTabBarFailCallback
  2688. /** 接口调用成功的回调函数 */
  2689. success?: HideTabBarSuccessCallback
  2690. }
  2691. interface HideTabBarRedDotOption {
  2692. /** tabBar 的哪一项,从左边算起 */
  2693. index: number
  2694. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2695. complete?: HideTabBarRedDotCompleteCallback
  2696. /** 接口调用失败的回调函数 */
  2697. fail?: HideTabBarRedDotFailCallback
  2698. /** 接口调用成功的回调函数 */
  2699. success?: HideTabBarRedDotSuccessCallback
  2700. }
  2701. interface HideToastOption {
  2702. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2703. complete?: HideToastCompleteCallback
  2704. /** 接口调用失败的回调函数 */
  2705. fail?: HideToastFailCallback
  2706. /** 接口调用成功的回调函数 */
  2707. success?: HideToastSuccessCallback
  2708. }
  2709. interface IBeaconInfo {
  2710. /** iBeacon 设备的距离 */
  2711. accuracy: number
  2712. /** iBeacon 设备的主 id */
  2713. major: string
  2714. /** iBeacon 设备的次 id */
  2715. minor: string
  2716. /** 表示设备距离的枚举值 */
  2717. proximity: number
  2718. /** 表示设备的信号强度 */
  2719. rssi: number
  2720. /** iBeacon 设备广播的 uuid */
  2721. uuid: string
  2722. }
  2723. /** 图片对象
  2724. *
  2725. * 最低基础库: `2.7.0` */
  2726. interface Image {
  2727. /** 图片的真实高度 */
  2728. height: number
  2729. /** 图片加载发生错误后触发的回调函数 */
  2730. onerror: (...args: any[]) => any
  2731. /** 图片加载完成后触发的回调函数 */
  2732. onload: (...args: any[]) => any
  2733. /** 图片的 URL。v2.11.0 起支持传递 base64 Data URI */
  2734. src: string
  2735. /** 图片的真实宽度 */
  2736. width: number
  2737. }
  2738. /** ImageData 对象
  2739. *
  2740. * 最低基础库: `2.9.0` */
  2741. interface ImageData {
  2742. /** 一维数组,包含以 RGBA 顺序的数据,数据使用 0 至 255(包含)的整数表示 */
  2743. data: Uint8ClampedArray
  2744. /** 使用像素描述 ImageData 的实际高度 */
  2745. height: number
  2746. /** 使用像素描述 ImageData 的实际宽度 */
  2747. width: number
  2748. }
  2749. /** 图片的本地临时文件列表
  2750. *
  2751. * 最低基础库: `1.2.0` */
  2752. interface ImageFile {
  2753. /** 本地临时文件路径 (本地路径) */
  2754. path: string
  2755. /** 本地临时文件大小,单位 B */
  2756. size: number
  2757. }
  2758. interface IncludePointsOption {
  2759. /** 要显示在可视区域内的坐标点列表 */
  2760. points: MapPostion[]
  2761. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2762. complete?: IncludePointsCompleteCallback
  2763. /** 接口调用失败的回调函数 */
  2764. fail?: IncludePointsFailCallback
  2765. /** 坐标点形成的矩形边缘到地图边缘的距离,单位像素。格式为[上,右,下,左],安卓上只能识别数组第一项,上下左右的padding一致。开发者工具暂不支持padding参数。 */
  2766. padding?: number[]
  2767. /** 接口调用成功的回调函数 */
  2768. success?: IncludePointsSuccessCallback
  2769. }
  2770. interface InitMarkerClusterOption {
  2771. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2772. complete?: InitMarkerClusterCompleteCallback
  2773. /** 启用默认的聚合样式 */
  2774. enableDefaultStyle?: boolean
  2775. /** 接口调用失败的回调函数 */
  2776. fail?: InitMarkerClusterFailCallback
  2777. /** 聚合算法的可聚合距离,即距离小于该值的点会聚合至一起,以像素为单位 */
  2778. gridSize?: boolean
  2779. /** 接口调用成功的回调函数 */
  2780. success?: InitMarkerClusterSuccessCallback
  2781. /** 点击已经聚合的标记点时是否实现聚合分离 */
  2782. zoomOnClick?: boolean
  2783. }
  2784. /** InnerAudioContext 实例,可通过 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 接口获取实例。注意,音频播放过程中,可能被系统中断,可通过 [wx.onAudioInterruptionBegin](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAudioInterruptionBegin.html)、[wx.onAudioInterruptionEnd](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAudioInterruptionEnd.html)事件来处理这种情况。
  2785. *
  2786. * **支持格式**
  2787. *
  2788. *
  2789. * | 格式 | iOS | Android |
  2790. * | ---- | ---- | ------- |
  2791. * | flac | x | √ |
  2792. * | m4a | √ | √ |
  2793. * | ogg | x | √ |
  2794. * | ape | x | √ |
  2795. * | amr | x | √ |
  2796. * | wma | x | √ |
  2797. * | wav | √ | √ |
  2798. * | mp3 | √ | √ |
  2799. * | mp4 | x | √ |
  2800. * | aac | √ | √ |
  2801. * | aiff | √ | x |
  2802. * | caf | √ | x |
  2803. *
  2804. * **示例代码**
  2805. *
  2806. *
  2807. * ```js
  2808. const innerAudioContext = wx.createInnerAudioContext()
  2809. innerAudioContext.autoplay = true
  2810. innerAudioContext.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46'
  2811. innerAudioContext.onPlay(() => {
  2812. console.log('开始播放')
  2813. })
  2814. innerAudioContext.onError((res) => {
  2815. console.log(res.errMsg)
  2816. console.log(res.errCode)
  2817. })
  2818. ``` */
  2819. interface InnerAudioContext {
  2820. /** 是否自动开始播放,默认为 `false` */
  2821. autoplay: boolean
  2822. /** 音频缓冲的时间点,仅保证当前播放时间点到此时间点内容已缓冲(只读) */
  2823. buffered: number
  2824. /** 当前音频的播放位置(单位 s)。只有在当前有合法的 src 时返回,时间保留小数点后 6 位(只读) */
  2825. currentTime: number
  2826. /** 当前音频的长度(单位 s)。只有在当前有合法的 src 时返回(只读) */
  2827. duration: number
  2828. /** 是否循环播放,默认为 `false` */
  2829. loop: boolean
  2830. /** 是否遵循系统静音开关,默认为 `true`。当此参数为 `false` 时,即使用户打开了静音开关,也能继续发出声音。从 2.3.0 版本开始此参数不生效,使用 [wx.setInnerAudioOption](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.setInnerAudioOption.html) 接口统一设置。 */
  2831. obeyMuteSwitch: boolean
  2832. /** 当前是是否暂停或停止状态(只读) */
  2833. paused: boolean
  2834. /** 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本)
  2835. *
  2836. * 最低基础库: `2.11.0` */
  2837. playbackRate: number
  2838. /** 音频资源的地址,用于直接播放。[2.2.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 开始支持云文件ID */
  2839. src: string
  2840. /** 开始播放的位置(单位:s),默认为 0 */
  2841. startTime: number
  2842. /** 音量。范围 0~1。默认为 1
  2843. *
  2844. * 最低基础库: `1.9.90` */
  2845. volume: number
  2846. }
  2847. interface InnerAudioContextOnErrorCallbackResult {
  2848. /**
  2849. *
  2850. * 可选值:
  2851. * - 10001: 系统错误;
  2852. * - 10002: 网络错误;
  2853. * - 10003: 文件错误;
  2854. * - 10004: 格式错误;
  2855. * - -1: 未知错误; */
  2856. errCode: 10001 | 10002 | 10003 | 10004 | -1
  2857. errMsg: string
  2858. }
  2859. interface InsertDividerOption {
  2860. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2861. complete?: InsertDividerCompleteCallback
  2862. /** 接口调用失败的回调函数 */
  2863. fail?: InsertDividerFailCallback
  2864. /** 接口调用成功的回调函数 */
  2865. success?: InsertDividerSuccessCallback
  2866. }
  2867. interface InsertImageOption {
  2868. /** 图片地址,仅支持 http(s)、base64、云图片(2.8.0)、临时文件(2.8.3)。 */
  2869. src: string
  2870. /** 图像无法显示时的替代文本 */
  2871. alt?: string
  2872. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2873. complete?: InsertImageCompleteCallback
  2874. /** data 被序列化为 name=value;name1=value2 的格式挂在属性 data-custom 上 */
  2875. data?: IAnyObject
  2876. /** 添加到图片 img 标签上的类名 */
  2877. extClass?: string
  2878. /** 接口调用失败的回调函数 */
  2879. fail?: InsertImageFailCallback
  2880. /** 图片高度 (pixels/百分比) */
  2881. height?: string
  2882. /** 接口调用成功的回调函数 */
  2883. success?: InsertImageSuccessCallback
  2884. /** 图片宽度(pixels/百分比) */
  2885. width?: string
  2886. }
  2887. interface InsertTextOption {
  2888. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2889. complete?: InsertTextCompleteCallback
  2890. /** 接口调用失败的回调函数 */
  2891. fail?: InsertTextFailCallback
  2892. /** 接口调用成功的回调函数 */
  2893. success?: InsertTextSuccessCallback
  2894. /** 文本内容 */
  2895. text?: string
  2896. }
  2897. interface IntersectionObserverObserveCallbackResult {
  2898. /** 目标边界 */
  2899. boundingClientRect: BoundingClientRectResult
  2900. /** 相交比例 */
  2901. intersectionRatio: number
  2902. /** 相交区域的边界 */
  2903. intersectionRect: IntersectionRectResult
  2904. /** 参照区域的边界 */
  2905. relativeRect: RelativeRectResult
  2906. /** 相交检测时的时间戳 */
  2907. time: number
  2908. }
  2909. /** 相交区域的边界 */
  2910. interface IntersectionRectResult {
  2911. /** 下边界 */
  2912. bottom: number
  2913. /** 高度 */
  2914. height: number
  2915. /** 左边界 */
  2916. left: number
  2917. /** 右边界 */
  2918. right: number
  2919. /** 上边界 */
  2920. top: number
  2921. /** 宽度 */
  2922. width: number
  2923. }
  2924. interface InterstitialAdOnErrorCallbackResult {
  2925. /** 错误码
  2926. *
  2927. * 可选值:
  2928. * - 1000: 后端接口调用失败;
  2929. * - 1001: 参数错误;
  2930. * - 1002: 广告单元无效;
  2931. * - 1003: 内部错误;
  2932. * - 1004: 无合适的广告;
  2933. * - 1005: 广告组件审核中;
  2934. * - 1006: 广告组件被驳回;
  2935. * - 1007: 广告组件被封禁;
  2936. * - 1008: 广告单元已关闭; */
  2937. errCode: 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008
  2938. /** 错误信息 */
  2939. errMsg: string
  2940. }
  2941. interface IsConnectedOption {
  2942. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2943. complete?: IsConnectedCompleteCallback
  2944. /** 接口调用失败的回调函数 */
  2945. fail?: IsConnectedFailCallback
  2946. /** 接口调用成功的回调函数 */
  2947. success?: IsConnectedSuccessCallback
  2948. }
  2949. interface JoinVoIPChatOption {
  2950. /** 小游戏内此房间/群聊的 ID。同一时刻传入相同 groupId 的用户会进入到同个实时语音房间。 */
  2951. groupId: string
  2952. /** 验证所需的随机字符串 */
  2953. nonceStr: string
  2954. /** 签名,用于验证小游戏的身份 */
  2955. signature: string
  2956. /** 验证所需的时间戳 */
  2957. timeStamp: number
  2958. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2959. complete?: JoinVoIPChatCompleteCallback
  2960. /** 接口调用失败的回调函数 */
  2961. fail?: JoinVoIPChatFailCallback
  2962. /** 静音设置 */
  2963. muteConfig?: MuteConfig
  2964. /** 房间类型
  2965. *
  2966. * 可选值:
  2967. * - 'voice': 音频房间,用于语音通话;
  2968. * - 'video': 视频房间,结合 [voip-room](https://developers.weixin.qq.com/miniprogram/dev/component/voip-room.html) 组件可显示成员画面; */
  2969. roomType?: 'voice' | 'video'
  2970. /** 接口调用成功的回调函数 */
  2971. success?: JoinVoIPChatSuccessCallback
  2972. }
  2973. interface JoinVoIPChatSuccessCallbackResult {
  2974. /** 错误码 */
  2975. errCode: number
  2976. /** 调用结果 */
  2977. errMsg: string
  2978. /** 在此通话中的成员 openId 名单 */
  2979. openIdList: string[]
  2980. }
  2981. /** 启动参数 */
  2982. interface LaunchOptionsApp {
  2983. /** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */
  2984. forwardMaterials: ForwardMaterials[]
  2985. /** 启动小程序的路径 (代码包路径) */
  2986. path: string
  2987. /** 启动小程序的 query 参数 */
  2988. query: IAnyObject
  2989. /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
  2990. referrerInfo: ReferrerInfo
  2991. /** 启动小程序的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */
  2992. scene: number
  2993. /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
  2994. shareTicket?: string
  2995. }
  2996. interface LivePlayerContextRequestFullScreenOption {
  2997. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  2998. complete?: RequestFullScreenCompleteCallback
  2999. /** 设置全屏时的方向
  3000. *
  3001. * 可选值:
  3002. * - 0: 正常竖向;
  3003. * - 90: 屏幕逆时针90度;
  3004. * - -90: 屏幕顺时针90度; */
  3005. direction?: 0 | 90 | -90
  3006. /** 接口调用失败的回调函数 */
  3007. fail?: RequestFullScreenFailCallback
  3008. /** 接口调用成功的回调函数 */
  3009. success?: RequestFullScreenSuccessCallback
  3010. }
  3011. interface LivePlayerContextSnapshotOption {
  3012. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3013. complete?: SnapshotCompleteCallback
  3014. /** 接口调用失败的回调函数 */
  3015. fail?: SnapshotFailCallback
  3016. /** 图片的质量,默认原图。有效值为 raw、compressed
  3017. *
  3018. * 最低基础库: `2.10.0` */
  3019. quality?: string
  3020. /** 接口调用成功的回调函数 */
  3021. success?: LivePlayerContextSnapshotSuccessCallback
  3022. }
  3023. interface LivePlayerContextSnapshotSuccessCallbackResult {
  3024. /** 图片的高度 */
  3025. height: string
  3026. /** 图片文件的临时路径 (本地路径) */
  3027. tempImagePath: string
  3028. /** 图片的宽度 */
  3029. width: string
  3030. errMsg: string
  3031. }
  3032. interface LivePusherContextSnapshotOption {
  3033. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3034. complete?: SnapshotCompleteCallback
  3035. /** 接口调用失败的回调函数 */
  3036. fail?: SnapshotFailCallback
  3037. /** 图片的质量,默认原图。有效值为 raw、compressed
  3038. *
  3039. * 最低基础库: `2.10.0` */
  3040. quality?: string
  3041. /** 接口调用成功的回调函数 */
  3042. success?: LivePusherContextSnapshotSuccessCallback
  3043. }
  3044. interface LivePusherContextSnapshotSuccessCallbackResult {
  3045. /** 图片的高度 */
  3046. height: string
  3047. /** 图片文件的临时路径 */
  3048. tempImagePath: string
  3049. /** 图片的宽度 */
  3050. width: string
  3051. errMsg: string
  3052. }
  3053. interface LoadFontFaceCompleteCallbackResult {
  3054. /** 加载字体结果 */
  3055. status: string
  3056. }
  3057. interface LoadFontFaceOption {
  3058. /** 定义的字体名称 */
  3059. family: string
  3060. /** 字体资源的地址。建议格式为 TTF 和 WOFF,WOFF2 在低版本的iOS上会不兼容。 */
  3061. source: string
  3062. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3063. complete?: LoadFontFaceCompleteCallback
  3064. /** 可选的字体描述符 */
  3065. desc?: DescOption
  3066. /** 接口调用失败的回调函数 */
  3067. fail?: LoadFontFaceFailCallback
  3068. /** 是否全局生效
  3069. *
  3070. * 最低基础库: `2.10.0` */
  3071. global?: boolean
  3072. /** 字体作用范围,可选值为 webview / native,默认 webview,设置 native 可在 Canvas 2D 下使用 */
  3073. scopes?: any[]
  3074. /** 接口调用成功的回调函数 */
  3075. success?: LoadFontFaceSuccessCallback
  3076. }
  3077. interface LoginOption {
  3078. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3079. complete?: LoginCompleteCallback
  3080. /** 接口调用失败的回调函数 */
  3081. fail?: LoginFailCallback
  3082. /** 接口调用成功的回调函数 */
  3083. success?: LoginSuccessCallback
  3084. /** 超时时间,单位ms
  3085. *
  3086. * 最低基础库: `1.9.90` */
  3087. timeout?: number
  3088. }
  3089. interface LoginSuccessCallbackResult {
  3090. /** 用户登录凭证(有效期五分钟)。开发者需要在开发者服务器后台调用 [auth.code2Session](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/login/auth.code2Session.html),使用 code 换取 openid 和 session_key 等信息 */
  3091. code: string
  3092. errMsg: string
  3093. }
  3094. interface MakeBluetoothPairOption {
  3095. /** 蓝牙设备 id */
  3096. deviceId: string
  3097. /** pin 码,Base64 格式。 */
  3098. pin: string
  3099. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3100. complete?: MakeBluetoothPairCompleteCallback
  3101. /** 接口调用失败的回调函数 */
  3102. fail?: MakeBluetoothPairFailCallback
  3103. /** 接口调用成功的回调函数 */
  3104. success?: MakeBluetoothPairSuccessCallback
  3105. /** 超时时间 */
  3106. timeout?: number
  3107. }
  3108. interface MakePhoneCallOption {
  3109. /** 需要拨打的电话号码 */
  3110. phoneNumber: string
  3111. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3112. complete?: MakePhoneCallCompleteCallback
  3113. /** 接口调用失败的回调函数 */
  3114. fail?: MakePhoneCallFailCallback
  3115. /** 接口调用成功的回调函数 */
  3116. success?: MakePhoneCallSuccessCallback
  3117. }
  3118. /** 广播的制造商信息, 仅安卓支持 */
  3119. interface ManufacturerData {
  3120. /** 制造商ID,0x 开头的十六进制 */
  3121. manufacturerId: string
  3122. /** 制造商信息 */
  3123. manufacturerSpecificData?: ArrayBuffer
  3124. }
  3125. /** 图片覆盖的经纬度范围 */
  3126. interface MapBounds {
  3127. /** 东北角经纬度 */
  3128. northeast: MapPostion
  3129. /** 西南角经纬度 */
  3130. southwest: MapPostion
  3131. }
  3132. interface MapPostion {
  3133. /** 纬度 */
  3134. latitude: number
  3135. /** 经度 */
  3136. longitude: number
  3137. }
  3138. /** 用来扩展(或收缩)参照节点布局区域的边界 */
  3139. interface Margins {
  3140. /** 节点布局区域的下边界 */
  3141. bottom?: number
  3142. /** 节点布局区域的左边界 */
  3143. left?: number
  3144. /** 节点布局区域的右边界 */
  3145. right?: number
  3146. /** 节点布局区域的上边界 */
  3147. top?: number
  3148. }
  3149. /** MediaAudioPlayer 实例,可通过 [wx.createMediaAudioPlayer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createMediaAudioPlayer.html) 接口获取实例。 */
  3150. interface MediaAudioPlayer {
  3151. /** 音量。范围 0~1。默认为 1 */
  3152. volume: number
  3153. }
  3154. /** 本地临时文件列表 */
  3155. interface MediaFile {
  3156. /** 视频的时间长度 */
  3157. duration: number
  3158. /** 视频的高度 */
  3159. height: number
  3160. /** 本地临时文件大小,单位 B */
  3161. size: number
  3162. /** 本地临时文件路径 (本地路径) */
  3163. tempFilePath: string
  3164. /** 视频缩略图临时文件路径 */
  3165. thumbTempFilePath: string
  3166. /** 视频的宽度 */
  3167. width: number
  3168. }
  3169. interface MediaQueryObserverObserveCallbackResult {
  3170. /** 页面的当前状态是否满足所指定的 media query */
  3171. matches: boolean
  3172. }
  3173. /** 需要预览的资源列表 */
  3174. interface MediaSource {
  3175. /** 图片或视频的地址 */
  3176. url: string
  3177. /** 视频的封面图片 */
  3178. poster?: string
  3179. /** 资源的类型,默认为图片
  3180. *
  3181. * 可选值:
  3182. * - 'image': 图片;
  3183. * - 'video': 视频; */
  3184. type?: 'image' | 'video'
  3185. }
  3186. /** 可通过 [MediaContainer.extractDataSource](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.extractDataSource.html) 返回。
  3187. *
  3188. * [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) 音频或视频轨道,可以对轨道进行一些操作
  3189. *
  3190. * 最低基础库: `2.9.0` */
  3191. interface MediaTrack {
  3192. /** 轨道长度,只读 */
  3193. duration: number
  3194. /** 轨道类型,只读
  3195. *
  3196. * 可选值:
  3197. * - 'audio': 音频轨道;
  3198. * - 'video': 视频轨道; */
  3199. kind: 'audio' | 'video'
  3200. /** 音量,音频轨道下有效,可写 */
  3201. volume: number
  3202. }
  3203. /** 小程序帐号信息 */
  3204. interface MiniProgram {
  3205. /** 小程序 appId */
  3206. appId: string
  3207. /** 小程序版本
  3208. *
  3209. * 可选值:
  3210. * - 'develop': 开发版;
  3211. * - 'trial': 体验版;
  3212. * - 'release': 正式版;
  3213. *
  3214. * 最低基础库: `2.10.0` */
  3215. envVersion: 'develop' | 'trial' | 'release'
  3216. /** 线上小程序版本号
  3217. *
  3218. * 最低基础库: `2.10.2` */
  3219. version: string
  3220. }
  3221. interface MkdirFailCallbackResult {
  3222. /** 错误信息
  3223. *
  3224. * 可选值:
  3225. * - 'fail no such file or directory ${dirPath}': 上级目录不存在;
  3226. * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限;
  3227. * - 'fail file already exists ${dirPath}': 有同名文件或目录;
  3228. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  3229. errMsg: string
  3230. }
  3231. interface MkdirOption {
  3232. /** 创建的目录路径 (本地路径) */
  3233. dirPath: string
  3234. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3235. complete?: MkdirCompleteCallback
  3236. /** 接口调用失败的回调函数 */
  3237. fail?: MkdirFailCallback
  3238. /** 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。
  3239. *
  3240. * 最低基础库: `2.3.0` */
  3241. recursive?: boolean
  3242. /** 接口调用成功的回调函数 */
  3243. success?: MkdirSuccessCallback
  3244. }
  3245. interface MoveAlongOption {
  3246. /** 平滑移动的时间 */
  3247. duration: number
  3248. /** 指定 marker */
  3249. markerId: number
  3250. /** 移动路径的坐标串,坐标点格式 `{longitude, latitude}` */
  3251. path: any[]
  3252. /** 根据路径方向自动改变 marker 的旋转角度 */
  3253. autoRotate?: boolean
  3254. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3255. complete?: MoveAlongCompleteCallback
  3256. /** 接口调用失败的回调函数 */
  3257. fail?: MoveAlongFailCallback
  3258. /** 接口调用成功的回调函数 */
  3259. success?: MoveAlongSuccessCallback
  3260. }
  3261. interface MoveToLocationOption {
  3262. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3263. complete?: MoveToLocationCompleteCallback
  3264. /** 接口调用失败的回调函数 */
  3265. fail?: MoveToLocationFailCallback
  3266. /** 纬度
  3267. *
  3268. * 最低基础库: `2.8.0` */
  3269. latitude?: number
  3270. /** 经度
  3271. *
  3272. * 最低基础库: `2.8.0` */
  3273. longitude?: number
  3274. /** 接口调用成功的回调函数 */
  3275. success?: MoveToLocationSuccessCallback
  3276. }
  3277. /** 静音设置 */
  3278. interface MuteConfig {
  3279. /** 是否静音耳机 */
  3280. muteEarphone?: boolean
  3281. /** 是否静音麦克风 */
  3282. muteMicrophone?: boolean
  3283. }
  3284. interface MuteOption {
  3285. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3286. complete?: MuteCompleteCallback
  3287. /** 接口调用失败的回调函数 */
  3288. fail?: MuteFailCallback
  3289. /** 接口调用成功的回调函数 */
  3290. success?: MuteSuccessCallback
  3291. }
  3292. /**
  3293. *
  3294. * 最低基础库: `2.11.2` */
  3295. interface NFCAdapter {
  3296. /** 标签类型枚举 */
  3297. tech: TechType
  3298. }
  3299. interface NavigateBackMiniProgramOption {
  3300. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3301. complete?: NavigateBackMiniProgramCompleteCallback
  3302. /** 需要返回给上一个小程序的数据,上一个小程序可在 `App.onShow` 中获取到这份数据。 [详情](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html)。 */
  3303. extraData?: IAnyObject
  3304. /** 接口调用失败的回调函数 */
  3305. fail?: NavigateBackMiniProgramFailCallback
  3306. /** 接口调用成功的回调函数 */
  3307. success?: NavigateBackMiniProgramSuccessCallback
  3308. }
  3309. interface NavigateBackOption {
  3310. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3311. complete?: NavigateBackCompleteCallback
  3312. /** 返回的页面数,如果 delta 大于现有页面数,则返回到首页。 */
  3313. delta?: number
  3314. /** 接口调用失败的回调函数 */
  3315. fail?: NavigateBackFailCallback
  3316. /** 接口调用成功的回调函数 */
  3317. success?: NavigateBackSuccessCallback
  3318. }
  3319. interface NavigateToMiniProgramOption {
  3320. /** 要打开的小程序 appId */
  3321. appId: string
  3322. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3323. complete?: NavigateToMiniProgramCompleteCallback
  3324. /** 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版。
  3325. *
  3326. * 可选值:
  3327. * - 'develop': 开发版;
  3328. * - 'trial': 体验版;
  3329. * - 'release': 正式版; */
  3330. envVersion?: 'develop' | 'trial' | 'release'
  3331. /** 需要传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据。如果跳转的是小游戏,可以在 [wx.onShow](#)、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到这份数据数据。 */
  3332. extraData?: IAnyObject
  3333. /** 接口调用失败的回调函数 */
  3334. fail?: NavigateToMiniProgramFailCallback
  3335. /** 打开的页面路径,如果为空则打开首页。path 中 ? 后面的部分会成为 query,在小程序的 `App.onLaunch`、`App.onShow` 和 `Page.onLoad` 的回调函数或小游戏的 [wx.onShow](#) 回调函数、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到 query 数据。对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。 */
  3336. path?: string
  3337. /** 接口调用成功的回调函数 */
  3338. success?: NavigateToMiniProgramSuccessCallback
  3339. }
  3340. interface NavigateToOption {
  3341. /** 需要跳转的应用内非 tabBar 的页面的路径 (代码包路径), 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' */
  3342. url: string
  3343. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3344. complete?: NavigateToCompleteCallback
  3345. /** 页面间通信接口,用于监听被打开页面发送到当前页面的数据。基础库 2.7.3 开始支持。 */
  3346. events?: IAnyObject
  3347. /** 接口调用失败的回调函数 */
  3348. fail?: NavigateToFailCallback
  3349. /** 接口调用成功的回调函数 */
  3350. success?: NavigateToSuccessCallback
  3351. }
  3352. interface NavigateToSuccessCallbackResult {
  3353. /** [EventChannel](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.html)
  3354. *
  3355. * 和被打开页面进行通信 */
  3356. eventChannel: EventChannel
  3357. errMsg: string
  3358. }
  3359. interface NdefCloseOption {
  3360. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3361. complete?: NdefCloseCompleteCallback
  3362. /** 接口调用失败的回调函数 */
  3363. fail?: NdefCloseFailCallback
  3364. /** 接口调用成功的回调函数 */
  3365. success?: NdefCloseSuccessCallback
  3366. }
  3367. interface NodeCallbackResult {
  3368. /** 节点对应的 Node 实例 */
  3369. node: IAnyObject
  3370. }
  3371. interface NotifyBLECharacteristicValueChangeOption {
  3372. /** 蓝牙特征值的 uuid */
  3373. characteristicId: string
  3374. /** 蓝牙设备 id */
  3375. deviceId: string
  3376. /** 蓝牙特征值对应服务的 uuid */
  3377. serviceId: string
  3378. /** 是否启用 notify */
  3379. state: boolean
  3380. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3381. complete?: NotifyBLECharacteristicValueChangeCompleteCallback
  3382. /** 接口调用失败的回调函数 */
  3383. fail?: NotifyBLECharacteristicValueChangeFailCallback
  3384. /** 接口调用成功的回调函数 */
  3385. success?: NotifyBLECharacteristicValueChangeSuccessCallback
  3386. }
  3387. /** media query 描述符 */
  3388. interface ObserveDescriptor {
  3389. /** 页面高度( px 为单位) */
  3390. height: number
  3391. /** 页面最大高度( px 为单位) */
  3392. maxHeight: number
  3393. /** 页面最大宽度( px 为单位) */
  3394. maxWidth: number
  3395. /** 页面最小高度( px 为单位) */
  3396. minHeight: number
  3397. /** 页面最小宽度( px 为单位) */
  3398. minWidth: number
  3399. /** 屏幕方向( `landscape` 或 `portrait` ) */
  3400. orientation: string
  3401. /** 页面宽度( px 为单位) */
  3402. width: number
  3403. }
  3404. interface OnAccelerometerChangeCallbackResult {
  3405. /** X 轴 */
  3406. x: number
  3407. /** Y 轴 */
  3408. y: number
  3409. /** Z 轴 */
  3410. z: number
  3411. }
  3412. interface OnAppShowCallbackResult {
  3413. /** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */
  3414. forwardMaterials: ForwardMaterials[]
  3415. /** 小程序切前台的路径 (代码包路径) */
  3416. path: string
  3417. /** 小程序切前台的 query 参数 */
  3418. query: IAnyObject
  3419. /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
  3420. referrerInfo: ReferrerInfo
  3421. /** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */
  3422. scene: number
  3423. /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
  3424. shareTicket?: string
  3425. }
  3426. interface OnBLECharacteristicValueChangeCallbackResult {
  3427. /** 蓝牙特征值的 uuid */
  3428. characteristicId: string
  3429. /** 蓝牙设备 id */
  3430. deviceId: string
  3431. /** 蓝牙特征值对应服务的 uuid */
  3432. serviceId: string
  3433. /** 特征值最新的值 */
  3434. value: ArrayBuffer
  3435. }
  3436. interface OnBLEConnectionStateChangeCallbackResult {
  3437. /** 是否处于已连接状态 */
  3438. connected: boolean
  3439. /** 蓝牙设备ID */
  3440. deviceId: string
  3441. }
  3442. interface OnBLEPeripheralConnectionStateChangedCallbackResult {
  3443. /** 连接目前状态 */
  3444. connected: boolean
  3445. /** 连接状态变化的设备 id */
  3446. deviceId: string
  3447. /** server 的 uuid */
  3448. serverId: string
  3449. }
  3450. interface OnBackgroundFetchDataCallbackResult {
  3451. /** 缓存数据类别 (periodic) */
  3452. fetchType: string
  3453. /** 缓存数据 */
  3454. fetchedData: string
  3455. /** 客户端拿到缓存数据的时间戳 */
  3456. timeStamp: number
  3457. }
  3458. interface OnBeaconServiceChangeCallbackResult {
  3459. /** 服务目前是否可用 */
  3460. available: boolean
  3461. /** 目前是否处于搜索状态 */
  3462. discovering: boolean
  3463. }
  3464. interface OnBeaconUpdateCallbackResult {
  3465. /** 当前搜寻到的所有 iBeacon 设备列表 */
  3466. beacons: IBeaconInfo[]
  3467. }
  3468. interface OnBluetoothAdapterStateChangeCallbackResult {
  3469. /** 蓝牙适配器是否可用 */
  3470. available: boolean
  3471. /** 蓝牙适配器是否处于搜索状态 */
  3472. discovering: boolean
  3473. }
  3474. interface OnBluetoothDeviceFoundCallbackResult {
  3475. /** 新搜索到的设备列表 */
  3476. devices: BlueToothDevice[]
  3477. }
  3478. interface OnCameraFrameCallbackResult {
  3479. /** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */
  3480. data: ArrayBuffer
  3481. /** 图像数据矩形的高度 */
  3482. height: number
  3483. /** 图像数据矩形的宽度 */
  3484. width: number
  3485. }
  3486. interface OnCharacteristicReadRequestCallbackResult {
  3487. /** 唯一标识码,调用 writeCharacteristicValue 时使用 */
  3488. callbackId: number
  3489. /** characteristic对应的uuid */
  3490. characteristicId: string
  3491. /** service对应的uuid */
  3492. serviceId: string
  3493. }
  3494. interface OnCharacteristicSubscribedCallbackResult {
  3495. /** characteristic对应的uuid */
  3496. characteristicId: string
  3497. /** service对应的uuid */
  3498. serviceId: string
  3499. }
  3500. interface OnCharacteristicWriteRequestCallbackResult {
  3501. /** 唯一标识码,调用 writeCharacteristicValue 时使用 */
  3502. callbackId: number
  3503. /** characteristic对应的uuid */
  3504. characteristicId: string
  3505. /** service对应的uuid */
  3506. serviceId: string
  3507. /** 请求写入的特征值数据 */
  3508. value: ArrayBuffer
  3509. }
  3510. interface OnCheckForUpdateCallbackResult {
  3511. /** 是否有新版本 */
  3512. hasUpdate: boolean
  3513. }
  3514. interface OnCompassChangeCallbackResult {
  3515. /** 精度
  3516. *
  3517. * 最低基础库: `2.4.0` */
  3518. accuracy: number | string
  3519. /** 面对的方向度数 */
  3520. direction: number
  3521. }
  3522. interface OnCopyUrlCallbackResult {
  3523. /** 用短链打开小程序时当前页面携带的查询字符串。小程序中使用时,应在进入页面时调用 `wx.onCopyUrl` 自定义 `query`,退出页面时调用 `wx.offCopyUrl`,防止影响其它页面。 */
  3524. query: string
  3525. }
  3526. interface OnDeviceMotionChangeCallbackResult {
  3527. /** 当 手机坐标 X/Y 和 地球 X/Y 重合时,绕着 Z 轴转动的夹角为 alpha,范围值为 [0, 2*PI)。逆时针转动为正。 */
  3528. alpha: number
  3529. /** 当手机坐标 Y/Z 和地球 Y/Z 重合时,绕着 X 轴转动的夹角为 beta。范围值为 [-1*PI, PI) 。顶部朝着地球表面转动为正。也有可能朝着用户为正。 */
  3530. beta: number
  3531. /** 当手机 X/Z 和地球 X/Z 重合时,绕着 Y 轴转动的夹角为 gamma。范围值为 [-1*PI/2, PI/2)。右边朝着地球表面转动为正。 */
  3532. gamma: number
  3533. }
  3534. interface OnDiscoveredCallbackResult {
  3535. /** NdefMessage 数组,消息格式为 {id: ArrayBuffer, type: ArrayBuffer, payload: ArrayBuffer} */
  3536. messages: any[]
  3537. /** tech 数组,用于匹配NFC卡片具体可以使用什么标准(NfcA等实例)处理 */
  3538. techs: any[]
  3539. }
  3540. interface OnFrameRecordedCallbackResult {
  3541. /** 录音分片数据 */
  3542. frameBuffer: ArrayBuffer
  3543. /** 当前帧是否正常录音结束前的最后一帧 */
  3544. isLastFrame: boolean
  3545. }
  3546. interface OnGetWifiListCallbackResult {
  3547. /** Wi-Fi 列表数据 */
  3548. wifiList: WifiInfo[]
  3549. }
  3550. interface OnGyroscopeChangeCallbackResult {
  3551. /** x 轴的角速度 */
  3552. x: number
  3553. /** y 轴的角速度 */
  3554. y: number
  3555. /** z 轴的角速度 */
  3556. z: number
  3557. }
  3558. interface OnHCEMessageCallbackResult {
  3559. /** `messageType=1` 时 ,客户端接收到 NFC 设备的指令 */
  3560. data: ArrayBuffer
  3561. /** 消息类型
  3562. *
  3563. * 可选值:
  3564. * - 1: HCE APDU Command类型,小程序需对此指令进行处理,并调用 sendHCEMessage 接口返回处理指令;
  3565. * - 2: 设备离场事件类型; */
  3566. messageType: 1 | 2
  3567. /** `messageType=2` 时,原因 */
  3568. reason: number
  3569. }
  3570. interface OnHeadersReceivedCallbackResult {
  3571. /** 开发者服务器返回的 HTTP Response Header */
  3572. header: IAnyObject
  3573. }
  3574. interface OnKeyboardHeightChangeCallbackResult {
  3575. /** 键盘高度 */
  3576. height: number
  3577. }
  3578. interface OnLocalServiceFoundCallbackResult {
  3579. /** 服务的 ip 地址 */
  3580. ip: string
  3581. /** 服务的端口 */
  3582. port: number
  3583. /** 服务的名称 */
  3584. serviceName: string
  3585. /** 服务的类型 */
  3586. serviceType: string
  3587. }
  3588. interface OnLocalServiceLostCallbackResult {
  3589. /** 服务的名称 */
  3590. serviceName: string
  3591. /** 服务的类型 */
  3592. serviceType: string
  3593. }
  3594. interface OnLocationChangeCallbackResult {
  3595. /** 位置的精确度 */
  3596. accuracy: number
  3597. /** 高度,单位 m
  3598. *
  3599. * 最低基础库: `1.2.0` */
  3600. altitude: number
  3601. /** 水平精度,单位 m
  3602. *
  3603. * 最低基础库: `1.2.0` */
  3604. horizontalAccuracy: number
  3605. /** 纬度,范围为 -90~90,负数表示南纬 */
  3606. latitude: number
  3607. /** 经度,范围为 -180~180,负数表示西经 */
  3608. longitude: number
  3609. /** 速度,单位 m/s */
  3610. speed: number
  3611. /** 垂直精度,单位 m(Android 无法获取,返回 0)
  3612. *
  3613. * 最低基础库: `1.2.0` */
  3614. verticalAccuracy: number
  3615. }
  3616. interface OnMemoryWarningCallbackResult {
  3617. /** 内存告警等级,只有 Android 才有,对应系统宏定义
  3618. *
  3619. * 可选值:
  3620. * - 5: TRIM_MEMORY_RUNNING_MODERATE;
  3621. * - 10: TRIM_MEMORY_RUNNING_LOW;
  3622. * - 15: TRIM_MEMORY_RUNNING_CRITICAL; */
  3623. level: 5 | 10 | 15
  3624. }
  3625. interface OnNetworkStatusChangeCallbackResult {
  3626. /** 当前是否有网络连接 */
  3627. isConnected: boolean
  3628. /** 网络类型
  3629. *
  3630. * 可选值:
  3631. * - 'wifi': wifi 网络;
  3632. * - '2g': 2g 网络;
  3633. * - '3g': 3g 网络;
  3634. * - '4g': 4g 网络;
  3635. * - 'unknown': Android 下不常见的网络类型;
  3636. * - 'none': 无网络; */
  3637. networkType: 'wifi' | '2g' | '3g' | '4g' | 'unknown' | 'none'
  3638. }
  3639. interface OnOpenCallbackResult {
  3640. /** 连接成功的 HTTP 响应 Header
  3641. *
  3642. * 最低基础库: `2.0.0` */
  3643. header: IAnyObject
  3644. /** 网络请求过程中一些调试信息
  3645. *
  3646. * 最低基础库: `2.10.4` */
  3647. profile: SocketProfile
  3648. }
  3649. interface OnPageNotFoundCallbackResult {
  3650. /** 是否本次启动的首个页面(例如从分享等入口进来,首个页面是开发者配置的分享页面) */
  3651. isEntryPage: boolean
  3652. /** 不存在页面的路径 (代码包路径) */
  3653. path: string
  3654. /** 打开不存在页面的 query 参数 */
  3655. query: IAnyObject
  3656. }
  3657. interface OnSocketOpenCallbackResult {
  3658. /** 连接成功的 HTTP 响应 Header
  3659. *
  3660. * 最低基础库: `2.0.0` */
  3661. header: IAnyObject
  3662. }
  3663. interface OnStopCallbackResult {
  3664. /** 录音总时长,单位:ms */
  3665. duration: number
  3666. /** 录音文件大小,单位:Byte */
  3667. fileSize: number
  3668. /** 录音文件的临时路径 (本地路径) */
  3669. tempFilePath: string
  3670. }
  3671. interface OnThemeChangeCallbackResult {
  3672. /** 系统当前的主题,取值为`light`或`dark`
  3673. *
  3674. * 可选值:
  3675. * - 'dark': 深色主题;
  3676. * - 'light': 浅色主题; */
  3677. theme: 'dark' | 'light'
  3678. }
  3679. interface OnUnhandledRejectionCallbackResult {
  3680. /** 被拒绝的 Promise 对象 */
  3681. promise: Promise<any>
  3682. /** 拒绝原因,一般是一个 Error 对象 */
  3683. reason: string
  3684. }
  3685. interface OnVoIPChatInterruptedCallbackResult {
  3686. /** 错误码 */
  3687. errCode: number
  3688. /** 调用结果(错误原因) */
  3689. errMsg: string
  3690. }
  3691. interface OnVoIPChatMembersChangedCallbackResult {
  3692. /** 错误码 */
  3693. errCode: number
  3694. /** 调用结果 */
  3695. errMsg: string
  3696. /** 还在实时语音通话中的成员 openId 名单 */
  3697. openIdList: string[]
  3698. }
  3699. interface OnVoIPChatSpeakersChangedCallbackResult {
  3700. /** 错误码 */
  3701. errCode: number
  3702. /** 调用结果(错误原因) */
  3703. errMsg: string
  3704. /** 还在实时语音通话中的成员 openId 名单 */
  3705. openIdList: string[]
  3706. }
  3707. interface OnVoIPVideoMembersChangedCallbackResult {
  3708. /** 错误码 */
  3709. errCode: number
  3710. /** 调用结果 */
  3711. errMsg: string
  3712. /** 开启视频的成员名单 */
  3713. openIdList: string[]
  3714. }
  3715. interface OnWifiConnectedCallbackResult {
  3716. /** [WifiInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/WifiInfo.html)
  3717. *
  3718. * Wi-Fi 信息 */
  3719. wifi: WifiInfo
  3720. }
  3721. interface OnWindowResizeCallbackResult {
  3722. size: Size
  3723. }
  3724. interface OpenBluetoothAdapterOption {
  3725. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3726. complete?: OpenBluetoothAdapterCompleteCallback
  3727. /** 接口调用失败的回调函数 */
  3728. fail?: OpenBluetoothAdapterFailCallback
  3729. /** 蓝牙模式,可作为主/从设备,仅 iOS 需要。
  3730. *
  3731. * 可选值:
  3732. * - 'central': 主机模式;
  3733. * - 'peripheral': 从机模式;
  3734. *
  3735. * 最低基础库: `2.10.0` */
  3736. mode?: 'central' | 'peripheral'
  3737. /** 接口调用成功的回调函数 */
  3738. success?: OpenBluetoothAdapterSuccessCallback
  3739. }
  3740. interface OpenCardOption {
  3741. /** 需要打开的卡券列表 */
  3742. cardList: OpenCardRequestInfo[]
  3743. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3744. complete?: OpenCardCompleteCallback
  3745. /** 接口调用失败的回调函数 */
  3746. fail?: OpenCardFailCallback
  3747. /** 接口调用成功的回调函数 */
  3748. success?: OpenCardSuccessCallback
  3749. }
  3750. /** 需要打开的卡券列表 */
  3751. interface OpenCardRequestInfo {
  3752. /** 卡券 ID */
  3753. cardId: string
  3754. /** 由 [wx.addCard](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/card/wx.addCard.html) 的返回对象中的加密 code 通过解密后得到,解密请参照:[code 解码接口](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1499332673_Unm7V) */
  3755. code: string
  3756. }
  3757. interface OpenDocumentOption {
  3758. /** 文件路径 (本地路径) ,可通过 downloadFile 获得 */
  3759. filePath: string
  3760. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3761. complete?: OpenDocumentCompleteCallback
  3762. /** 接口调用失败的回调函数 */
  3763. fail?: OpenDocumentFailCallback
  3764. /** 文件类型,指定文件类型打开文件
  3765. *
  3766. * 可选值:
  3767. * - 'doc': doc 格式;
  3768. * - 'docx': docx 格式;
  3769. * - 'xls': xls 格式;
  3770. * - 'xlsx': xlsx 格式;
  3771. * - 'ppt': ppt 格式;
  3772. * - 'pptx': pptx 格式;
  3773. * - 'pdf': pdf 格式;
  3774. *
  3775. * 最低基础库: `1.4.0` */
  3776. fileType?: 'doc' | 'docx' | 'xls' | 'xlsx' | 'ppt' | 'pptx' | 'pdf'
  3777. /** 是否显示右上角菜单
  3778. *
  3779. * 最低基础库: `2.11.0` */
  3780. showMenu?: boolean
  3781. /** 接口调用成功的回调函数 */
  3782. success?: OpenDocumentSuccessCallback
  3783. }
  3784. interface OpenLocationOption {
  3785. /** 纬度,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */
  3786. latitude: number
  3787. /** 经度,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */
  3788. longitude: number
  3789. /** 地址的详细说明 */
  3790. address?: string
  3791. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3792. complete?: OpenLocationCompleteCallback
  3793. /** 接口调用失败的回调函数 */
  3794. fail?: OpenLocationFailCallback
  3795. /** 位置名 */
  3796. name?: string
  3797. /** 缩放比例,范围5~18 */
  3798. scale?: number
  3799. /** 接口调用成功的回调函数 */
  3800. success?: OpenLocationSuccessCallback
  3801. }
  3802. interface OpenMapAppOption {
  3803. /** 目的地名称 */
  3804. destination: string
  3805. /** 目的地纬度 */
  3806. latitude: number
  3807. /** 目的地经度 */
  3808. longitude: number
  3809. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3810. complete?: OpenMapAppCompleteCallback
  3811. /** 接口调用失败的回调函数 */
  3812. fail?: OpenMapAppFailCallback
  3813. /** 接口调用成功的回调函数 */
  3814. success?: OpenMapAppSuccessCallback
  3815. }
  3816. interface OpenSettingOption {
  3817. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3818. complete?: OpenSettingCompleteCallback
  3819. /** 接口调用失败的回调函数 */
  3820. fail?: OpenSettingFailCallback
  3821. /** 接口调用成功的回调函数 */
  3822. success?: OpenSettingSuccessCallback
  3823. /** 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。
  3824. *
  3825. * 最低基础库: `2.10.3` */
  3826. withSubscriptions?: boolean
  3827. }
  3828. interface OpenSettingSuccessCallbackResult {
  3829. /** [AuthSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/AuthSetting.html)
  3830. *
  3831. * 用户授权结果 */
  3832. authSetting: AuthSetting
  3833. /** [SubscriptionsSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/SubscriptionsSetting.html)
  3834. *
  3835. * 用户订阅消息设置,接口参数`withSubscriptions`值为`true`时才会返回。
  3836. *
  3837. * 最低基础库: `2.10.3` */
  3838. subscriptionsSetting: SubscriptionsSetting
  3839. errMsg: string
  3840. }
  3841. interface OpenVideoEditorOption {
  3842. /** 视频源的路径,只支持本地路径 */
  3843. filePath: string
  3844. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3845. complete?: OpenVideoEditorCompleteCallback
  3846. /** 接口调用失败的回调函数 */
  3847. fail?: OpenVideoEditorFailCallback
  3848. /** 接口调用成功的回调函数 */
  3849. success?: OpenVideoEditorSuccessCallback
  3850. }
  3851. interface OpenVideoEditorSuccessCallbackResult {
  3852. /** 剪辑后生成的视频文件的时长,单位毫秒(ms) */
  3853. duration: number
  3854. /** 剪辑后生成的视频文件大小,单位字节数(byte) */
  3855. size: number
  3856. /** 编辑后生成的视频文件的临时路径 */
  3857. tempFilePath: string
  3858. /** 编辑后生成的缩略图文件的临时路径 */
  3859. tempThumbPath: string
  3860. errMsg: string
  3861. }
  3862. interface PageScrollToOption {
  3863. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3864. complete?: PageScrollToCompleteCallback
  3865. /** 滚动动画的时长,单位 ms */
  3866. duration?: number
  3867. /** 接口调用失败的回调函数 */
  3868. fail?: PageScrollToFailCallback
  3869. /** 滚动到页面的目标位置,单位 px */
  3870. scrollTop?: number
  3871. /** 选择器
  3872. *
  3873. * 最低基础库: `2.7.3` */
  3874. selector?: string
  3875. /** 接口调用成功的回调函数 */
  3876. success?: PageScrollToSuccessCallback
  3877. }
  3878. /** Canvas 2D API 的接口 Path2D 用来声明路径,此路径稍后会被CanvasRenderingContext2D 对象使用。CanvasRenderingContext2D 接口的 路径方法 也存在于 Path2D 这个接口中,允许你在 canvas 中根据需要创建可以保留并重用的路径。
  3879. *
  3880. * 最低基础库: `2.11.0` */
  3881. interface Path2D {}
  3882. interface PauseBGMOption {
  3883. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3884. complete?: PauseBGMCompleteCallback
  3885. /** 接口调用失败的回调函数 */
  3886. fail?: PauseBGMFailCallback
  3887. /** 接口调用成功的回调函数 */
  3888. success?: PauseBGMSuccessCallback
  3889. }
  3890. interface PauseBackgroundAudioOption {
  3891. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3892. complete?: PauseBackgroundAudioCompleteCallback
  3893. /** 接口调用失败的回调函数 */
  3894. fail?: PauseBackgroundAudioFailCallback
  3895. /** 接口调用成功的回调函数 */
  3896. success?: PauseBackgroundAudioSuccessCallback
  3897. }
  3898. interface PauseOption {
  3899. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3900. complete?: PauseCompleteCallback
  3901. /** 接口调用失败的回调函数 */
  3902. fail?: PauseFailCallback
  3903. /** 接口调用成功的回调函数 */
  3904. success?: PauseSuccessCallback
  3905. }
  3906. interface PauseVoiceOption {
  3907. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3908. complete?: PauseVoiceCompleteCallback
  3909. /** 接口调用失败的回调函数 */
  3910. fail?: PauseVoiceFailCallback
  3911. /** 接口调用成功的回调函数 */
  3912. success?: PauseVoiceSuccessCallback
  3913. }
  3914. /** PerformanceObserver 对象, 用于监听性能相关事件
  3915. *
  3916. * 最低基础库: `2.11.0` */
  3917. interface PerformanceObserver {
  3918. /** 获取当前支持的所有性能指标类型 */
  3919. supportedEntryTypes: any[]
  3920. }
  3921. interface PlayBGMOption {
  3922. /** 加入背景混音的资源地址 */
  3923. url: string
  3924. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3925. complete?: PlayBGMCompleteCallback
  3926. /** 接口调用失败的回调函数 */
  3927. fail?: PlayBGMFailCallback
  3928. /** 接口调用成功的回调函数 */
  3929. success?: PlayBGMSuccessCallback
  3930. }
  3931. interface PlayBackgroundAudioOption {
  3932. /** 音乐链接,目前支持的格式有 m4a, aac, mp3, wav */
  3933. dataUrl: string
  3934. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3935. complete?: PlayBackgroundAudioCompleteCallback
  3936. /** 封面URL */
  3937. coverImgUrl?: string
  3938. /** 接口调用失败的回调函数 */
  3939. fail?: PlayBackgroundAudioFailCallback
  3940. /** 接口调用成功的回调函数 */
  3941. success?: PlayBackgroundAudioSuccessCallback
  3942. /** 音乐标题 */
  3943. title?: string
  3944. }
  3945. interface PlayOption {
  3946. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3947. complete?: PlayCompleteCallback
  3948. /** 接口调用失败的回调函数 */
  3949. fail?: PlayFailCallback
  3950. /** 接口调用成功的回调函数 */
  3951. success?: PlaySuccessCallback
  3952. }
  3953. interface PlayVoiceOption {
  3954. /** 需要播放的语音文件的文件路径 (本地路径) */
  3955. filePath: string
  3956. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3957. complete?: PlayVoiceCompleteCallback
  3958. /** 指定播放时长,到达指定的播放时长后会自动停止播放,单位:秒
  3959. *
  3960. * 最低基础库: `1.6.0` */
  3961. duration?: number
  3962. /** 接口调用失败的回调函数 */
  3963. fail?: PlayVoiceFailCallback
  3964. /** 接口调用成功的回调函数 */
  3965. success?: PlayVoiceSuccessCallback
  3966. }
  3967. /** 插件帐号信息(仅在插件中调用时包含这一项) */
  3968. interface Plugin {
  3969. /** 插件 appId */
  3970. appId: string
  3971. /** 插件版本号 */
  3972. version: string
  3973. }
  3974. interface PreviewImageOption {
  3975. /** 需要预览的图片链接列表。[2.2.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起支持云文件ID。 */
  3976. urls: string[]
  3977. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3978. complete?: PreviewImageCompleteCallback
  3979. /** 当前显示图片的链接 */
  3980. current?: string
  3981. /** 接口调用失败的回调函数 */
  3982. fail?: PreviewImageFailCallback
  3983. /** 是否显示长按菜单
  3984. *
  3985. * 最低基础库: `2.13.0` */
  3986. showmenu?: boolean
  3987. /** 接口调用成功的回调函数 */
  3988. success?: PreviewImageSuccessCallback
  3989. }
  3990. interface PreviewMediaOption {
  3991. /** 需要预览的资源列表 */
  3992. sources: MediaSource[]
  3993. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3994. complete?: PreviewMediaCompleteCallback
  3995. /** 当前显示的资源序号 */
  3996. current?: number
  3997. /** 接口调用失败的回调函数 */
  3998. fail?: PreviewMediaFailCallback
  3999. /** 是否显示长按菜单
  4000. *
  4001. * 最低基础库: `2.13.0` */
  4002. showmenu?: boolean
  4003. /** 接口调用成功的回调函数 */
  4004. success?: PreviewMediaSuccessCallback
  4005. }
  4006. interface ReLaunchOption {
  4007. /** 需要跳转的应用内页面路径 (代码包路径),路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2' */
  4008. url: string
  4009. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4010. complete?: ReLaunchCompleteCallback
  4011. /** 接口调用失败的回调函数 */
  4012. fail?: ReLaunchFailCallback
  4013. /** 接口调用成功的回调函数 */
  4014. success?: ReLaunchSuccessCallback
  4015. }
  4016. interface ReadBLECharacteristicValueOption {
  4017. /** 蓝牙特征值的 uuid */
  4018. characteristicId: string
  4019. /** 蓝牙设备 id */
  4020. deviceId: string
  4021. /** 蓝牙特征值对应服务的 uuid */
  4022. serviceId: string
  4023. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4024. complete?: ReadBLECharacteristicValueCompleteCallback
  4025. /** 接口调用失败的回调函数 */
  4026. fail?: ReadBLECharacteristicValueFailCallback
  4027. /** 接口调用成功的回调函数 */
  4028. success?: ReadBLECharacteristicValueSuccessCallback
  4029. }
  4030. interface ReadFileFailCallbackResult {
  4031. /** 错误信息
  4032. *
  4033. * 可选值:
  4034. * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 所在目录不存在;
  4035. * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有读权限;
  4036. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  4037. errMsg: string
  4038. }
  4039. interface ReadFileOption {
  4040. /** 要读取的文件的路径 (本地路径) */
  4041. filePath: string
  4042. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4043. complete?: ReadFileCompleteCallback
  4044. /** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
  4045. *
  4046. * 可选值:
  4047. * - 'ascii': ;
  4048. * - 'base64': ;
  4049. * - 'binary': ;
  4050. * - 'hex': ;
  4051. * - 'ucs2': 以小端序读取;
  4052. * - 'ucs-2': 以小端序读取;
  4053. * - 'utf16le': 以小端序读取;
  4054. * - 'utf-16le': 以小端序读取;
  4055. * - 'utf-8': ;
  4056. * - 'utf8': ;
  4057. * - 'latin1': ; */
  4058. encoding?:
  4059. | 'ascii'
  4060. | 'base64'
  4061. | 'binary'
  4062. | 'hex'
  4063. | 'ucs2'
  4064. | 'ucs-2'
  4065. | 'utf16le'
  4066. | 'utf-16le'
  4067. | 'utf-8'
  4068. | 'utf8'
  4069. | 'latin1'
  4070. /** 接口调用失败的回调函数 */
  4071. fail?: ReadFileFailCallback
  4072. /** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte
  4073. *
  4074. * 最低基础库: `2.10.0` */
  4075. length?: number
  4076. /** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte
  4077. *
  4078. * 最低基础库: `2.10.0` */
  4079. position?: number
  4080. /** 接口调用成功的回调函数 */
  4081. success?: ReadFileSuccessCallback
  4082. }
  4083. interface ReadFileSuccessCallbackResult {
  4084. /** 文件内容 */
  4085. data: string | ArrayBuffer
  4086. errMsg: string
  4087. }
  4088. interface ReaddirFailCallbackResult {
  4089. /** 错误信息
  4090. *
  4091. * 可选值:
  4092. * - 'fail no such file or directory ${dirPath}': 目录不存在;
  4093. * - 'fail not a directory ${dirPath}': dirPath 不是目录;
  4094. * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有读权限;
  4095. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  4096. errMsg: string
  4097. }
  4098. interface ReaddirOption {
  4099. /** 要读取的目录路径 (本地路径) */
  4100. dirPath: string
  4101. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4102. complete?: ReaddirCompleteCallback
  4103. /** 接口调用失败的回调函数 */
  4104. fail?: ReaddirFailCallback
  4105. /** 接口调用成功的回调函数 */
  4106. success?: ReaddirSuccessCallback
  4107. }
  4108. interface ReaddirSuccessCallbackResult {
  4109. /** 指定目录下的文件名数组。 */
  4110. files: string[]
  4111. errMsg: string
  4112. }
  4113. interface RecorderManagerStartOption {
  4114. /** 指定录音的音频输入源,可通过 [wx.getAvailableAudioSources()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.getAvailableAudioSources.html) 获取当前可用的音频源
  4115. *
  4116. * 可选值:
  4117. * - 'auto': 自动设置,默认使用手机麦克风,插上耳麦后自动切换使用耳机麦克风,所有平台适用;
  4118. * - 'buildInMic': 手机麦克风,仅限 iOS;
  4119. * - 'headsetMic': 有线耳机麦克风,仅限 iOS;
  4120. * - 'mic': 麦克风(没插耳麦时是手机麦克风,插耳麦时是耳机麦克风),仅限 Android;
  4121. * - 'camcorder': 同 mic,适用于录制音视频内容,仅限 Android;
  4122. * - 'voice_communication': 同 mic,适用于实时沟通,仅限 Android;
  4123. * - 'voice_recognition': 同 mic,适用于语音识别,仅限 Android;
  4124. *
  4125. * 最低基础库: `2.1.0` */
  4126. audioSource?:
  4127. | 'auto'
  4128. | 'buildInMic'
  4129. | 'headsetMic'
  4130. | 'mic'
  4131. | 'camcorder'
  4132. | 'voice_communication'
  4133. | 'voice_recognition'
  4134. /** 录音的时长,单位 ms,最大值 600000(10 分钟) */
  4135. duration?: number
  4136. /** 编码码率,有效值见下表格 */
  4137. encodeBitRate?: number
  4138. /** 音频格式
  4139. *
  4140. * 可选值:
  4141. * - 'mp3': mp3 格式;
  4142. * - 'aac': aac 格式;
  4143. * - 'wav': wav 格式;
  4144. * - 'PCM': pcm 格式; */
  4145. format?: 'mp3' | 'aac' | 'wav' | 'PCM'
  4146. /** 指定帧大小,单位 KB。传入 frameSize 后,每录制指定帧大小的内容后,会回调录制的文件内容,不指定则不会回调。暂仅支持 mp3 格式。 */
  4147. frameSize?: number
  4148. /** 录音通道数
  4149. *
  4150. * 可选值:
  4151. * - 1: 1 个通道;
  4152. * - 2: 2 个通道; */
  4153. numberOfChannels?: 1 | 2
  4154. /** 采样率
  4155. *
  4156. * 可选值:
  4157. * - 8000: 8000 采样率;
  4158. * - 11025: 11025 采样率;
  4159. * - 12000: 12000 采样率;
  4160. * - 16000: 16000 采样率;
  4161. * - 22050: 22050 采样率;
  4162. * - 24000: 24000 采样率;
  4163. * - 32000: 32000 采样率;
  4164. * - 44100: 44100 采样率;
  4165. * - 48000: 48000 采样率; */
  4166. sampleRate?:
  4167. | 8000
  4168. | 11025
  4169. | 12000
  4170. | 16000
  4171. | 22050
  4172. | 24000
  4173. | 32000
  4174. | 44100
  4175. | 48000
  4176. }
  4177. /** 菜单按钮的布局位置信息 */
  4178. interface Rect {
  4179. /** 下边界坐标,单位:px */
  4180. bottom: number
  4181. /** 高度,单位:px */
  4182. height: number
  4183. /** 左边界坐标,单位:px */
  4184. left: number
  4185. /** 右边界坐标,单位:px */
  4186. right: number
  4187. /** 上边界坐标,单位:px */
  4188. top: number
  4189. /** 宽度,单位:px */
  4190. width: number
  4191. }
  4192. interface RedirectToOption {
  4193. /** 需要跳转的应用内非 tabBar 的页面的路径 (代码包路径), 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' */
  4194. url: string
  4195. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4196. complete?: RedirectToCompleteCallback
  4197. /** 接口调用失败的回调函数 */
  4198. fail?: RedirectToFailCallback
  4199. /** 接口调用成功的回调函数 */
  4200. success?: RedirectToSuccessCallback
  4201. }
  4202. interface RedoOption {
  4203. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4204. complete?: RedoCompleteCallback
  4205. /** 接口调用失败的回调函数 */
  4206. fail?: RedoFailCallback
  4207. /** 接口调用成功的回调函数 */
  4208. success?: RedoSuccessCallback
  4209. }
  4210. /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
  4211. interface ReferrerInfo {
  4212. /** 来源小程序、公众号或 App 的 appId */
  4213. appId: string
  4214. /** 来源小程序传过来的数据,scene=1037或1038时支持 */
  4215. extraData: IAnyObject
  4216. }
  4217. /** 参照区域的边界 */
  4218. interface RelativeRectResult {
  4219. /** 下边界 */
  4220. bottom: number
  4221. /** 左边界 */
  4222. left: number
  4223. /** 右边界 */
  4224. right: number
  4225. /** 上边界 */
  4226. top: number
  4227. }
  4228. /** 消息来源的结构化信息 */
  4229. interface RemoteInfo {
  4230. /** 发送消息的 socket 的地址 */
  4231. address: string
  4232. /** 使用的协议族,为 IPv4 或者 IPv6 */
  4233. family: string
  4234. /** 端口号 */
  4235. port: number
  4236. /** message 的大小,单位:字节 */
  4237. size: number
  4238. }
  4239. interface RemoveCustomLayerOption {
  4240. /** 个性化图层id */
  4241. layerId: string
  4242. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4243. complete?: RemoveCustomLayerCompleteCallback
  4244. /** 接口调用失败的回调函数 */
  4245. fail?: RemoveCustomLayerFailCallback
  4246. /** 接口调用成功的回调函数 */
  4247. success?: RemoveCustomLayerSuccessCallback
  4248. }
  4249. interface RemoveFormatOption {
  4250. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4251. complete?: RemoveFormatCompleteCallback
  4252. /** 接口调用失败的回调函数 */
  4253. fail?: RemoveFormatFailCallback
  4254. /** 接口调用成功的回调函数 */
  4255. success?: RemoveFormatSuccessCallback
  4256. }
  4257. interface RemoveGroundOverlayOption {
  4258. /** 图片图层 id */
  4259. id: string
  4260. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4261. complete?: RemoveGroundOverlayCompleteCallback
  4262. /** 接口调用失败的回调函数 */
  4263. fail?: RemoveGroundOverlayFailCallback
  4264. /** 接口调用成功的回调函数 */
  4265. success?: RemoveGroundOverlaySuccessCallback
  4266. }
  4267. interface RemoveMarkersOption {
  4268. /** marker 的 id 集合。 */
  4269. markerIds: any[]
  4270. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4271. complete?: RemoveMarkersCompleteCallback
  4272. /** 接口调用失败的回调函数 */
  4273. fail?: RemoveMarkersFailCallback
  4274. /** 接口调用成功的回调函数 */
  4275. success?: RemoveMarkersSuccessCallback
  4276. }
  4277. interface RemoveSavedFileFailCallbackResult {
  4278. /** 错误信息
  4279. *
  4280. * 可选值:
  4281. * - 'fail file not exist': 指定的 tempFilePath 找不到文件; */
  4282. errMsg: string
  4283. }
  4284. interface RemoveServiceOption {
  4285. /** service 的 uuid */
  4286. serviceId: string
  4287. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4288. complete?: RemoveServiceCompleteCallback
  4289. /** 接口调用失败的回调函数 */
  4290. fail?: RemoveServiceFailCallback
  4291. /** 接口调用成功的回调函数 */
  4292. success?: RemoveServiceSuccessCallback
  4293. }
  4294. interface RemoveStorageOption {
  4295. /** 本地缓存中指定的 key */
  4296. key: string
  4297. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4298. complete?: RemoveStorageCompleteCallback
  4299. /** 接口调用失败的回调函数 */
  4300. fail?: RemoveStorageFailCallback
  4301. /** 接口调用成功的回调函数 */
  4302. success?: RemoveStorageSuccessCallback
  4303. }
  4304. interface RemoveTabBarBadgeOption {
  4305. /** tabBar 的哪一项,从左边算起 */
  4306. index: number
  4307. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4308. complete?: RemoveTabBarBadgeCompleteCallback
  4309. /** 接口调用失败的回调函数 */
  4310. fail?: RemoveTabBarBadgeFailCallback
  4311. /** 接口调用成功的回调函数 */
  4312. success?: RemoveTabBarBadgeSuccessCallback
  4313. }
  4314. interface RenameFailCallbackResult {
  4315. /** 错误信息
  4316. *
  4317. * 可选值:
  4318. * - 'fail permission denied, rename ${oldPath} -> ${newPath}': 指定源文件或目标文件没有写权限;
  4319. * - 'fail no such file or directory, rename ${oldPath} -> ${newPath}': 源文件不存在,或目标文件路径的上层目录不存在; */
  4320. errMsg: string
  4321. }
  4322. interface RenameOption {
  4323. /** 新文件路径,支持本地路径 */
  4324. newPath: string
  4325. /** 源文件路径,支持本地路径 */
  4326. oldPath: string
  4327. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4328. complete?: RenameCompleteCallback
  4329. /** 接口调用失败的回调函数 */
  4330. fail?: RenameFailCallback
  4331. /** 接口调用成功的回调函数 */
  4332. success?: RenameSuccessCallback
  4333. }
  4334. /** Canvas 绘图上下文。
  4335. *
  4336. * ****
  4337. *
  4338. * - 通过 Canvas.getContext('2d') 接口可以获取 CanvasRenderingContext2D 对象,实现了 [HTML Canvas 2D Context](https://www.w3.org/TR/2dcontext/) 定义的属性、方法。
  4339. * - 通过 Canvas.getContext('webgl') 或 OffscreenCanvas.getContext('webgl') 接口可以获取 WebGLRenderingContext 对象,实现了 [WebGL 1.0](https://www.khronos.org/registry/webgl/specs/latest/1.0/) 定义的所有属性、方法、常量。
  4340. * - CanvasRenderingContext2D 的 drawImage 方法 2.10.0 起支持传入通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取的 video 对象
  4341. *
  4342. * **示例代码**
  4343. *
  4344. *
  4345. *
  4346. * video 画到 2D Canvas 示例
  4347. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/tJTak7mU7sfX) */
  4348. interface RenderingContext {}
  4349. interface RequestOption<
  4350. T extends string | IAnyObject | ArrayBuffer =
  4351. | string
  4352. | IAnyObject
  4353. | ArrayBuffer
  4354. > {
  4355. /** 开发者服务器接口地址 */
  4356. url: string
  4357. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4358. complete?: RequestCompleteCallback
  4359. /** 请求的参数 */
  4360. data?: string | IAnyObject | ArrayBuffer
  4361. /** 返回的数据格式
  4362. *
  4363. * 可选值:
  4364. * - 'json': 返回的数据为 JSON,返回后会对返回的数据进行一次 JSON.parse;
  4365. * - '其他': 不对返回的内容进行 JSON.parse; */
  4366. dataType?: 'json' | '其他'
  4367. /** 开启 cache
  4368. *
  4369. * 最低基础库: `2.10.4` */
  4370. enableCache?: boolean
  4371. /** 开启 http2
  4372. *
  4373. * 最低基础库: `2.10.4` */
  4374. enableHttp2?: boolean
  4375. /** 开启 quic
  4376. *
  4377. * 最低基础库: `2.10.4` */
  4378. enableQuic?: boolean
  4379. /** 接口调用失败的回调函数 */
  4380. fail?: RequestFailCallback
  4381. /** 设置请求的 header,header 中不能设置 Referer。
  4382. *
  4383. * `content-type` 默认为 `application/json` */
  4384. header?: IAnyObject
  4385. /** HTTP 请求方法
  4386. *
  4387. * 可选值:
  4388. * - 'OPTIONS': HTTP 请求 OPTIONS;
  4389. * - 'GET': HTTP 请求 GET;
  4390. * - 'HEAD': HTTP 请求 HEAD;
  4391. * - 'POST': HTTP 请求 POST;
  4392. * - 'PUT': HTTP 请求 PUT;
  4393. * - 'DELETE': HTTP 请求 DELETE;
  4394. * - 'TRACE': HTTP 请求 TRACE;
  4395. * - 'CONNECT': HTTP 请求 CONNECT; */
  4396. method?:
  4397. | 'OPTIONS'
  4398. | 'GET'
  4399. | 'HEAD'
  4400. | 'POST'
  4401. | 'PUT'
  4402. | 'DELETE'
  4403. | 'TRACE'
  4404. | 'CONNECT'
  4405. /** 响应的数据类型
  4406. *
  4407. * 可选值:
  4408. * - 'text': 响应的数据为文本;
  4409. * - 'arraybuffer': 响应的数据为 ArrayBuffer;
  4410. *
  4411. * 最低基础库: `1.7.0` */
  4412. responseType?: 'text' | 'arraybuffer'
  4413. /** 接口调用成功的回调函数 */
  4414. success?: RequestSuccessCallback<T>
  4415. /** 超时时间,单位为毫秒
  4416. *
  4417. * 最低基础库: `2.10.0` */
  4418. timeout?: number
  4419. }
  4420. interface RequestPaymentOption {
  4421. /** 随机字符串,长度为32个字符以下 */
  4422. nonceStr: string
  4423. /** 统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=*** */
  4424. package: string
  4425. /** 签名,具体见微信支付文档 */
  4426. paySign: string
  4427. /** 时间戳,从 1970 年 1 月 1 日 00:00:00 至今的秒数,即当前的时间 */
  4428. timeStamp: string
  4429. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4430. complete?: RequestPaymentCompleteCallback
  4431. /** 接口调用失败的回调函数 */
  4432. fail?: RequestPaymentFailCallback
  4433. /** 签名算法,应与后台下单时的值一致
  4434. *
  4435. * 可选值:
  4436. * - 'MD5': 仅在 v2 版本接口适用;
  4437. * - 'HMAC-SHA256': 仅在 v2 版本接口适用;
  4438. * - 'RSA': 仅在 v3 版本接口适用; */
  4439. signType?: 'MD5' | 'HMAC-SHA256' | 'RSA'
  4440. /** 接口调用成功的回调函数 */
  4441. success?: RequestPaymentSuccessCallback
  4442. }
  4443. interface RequestPictureInPictureOption {
  4444. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4445. complete?: RequestPictureInPictureCompleteCallback
  4446. /** 接口调用失败的回调函数 */
  4447. fail?: RequestPictureInPictureFailCallback
  4448. /** 接口调用成功的回调函数 */
  4449. success?: RequestPictureInPictureSuccessCallback
  4450. }
  4451. /** 网络请求过程中一些调试信息
  4452. *
  4453. * 最低基础库: `2.10.4` */
  4454. interface RequestProfile {
  4455. /** SSL建立完成的时间,如果不是安全连接,则值为 0 */
  4456. SSLconnectionEnd: number
  4457. /** SSL建立连接的时间,如果不是安全连接,则值为 0 */
  4458. SSLconnectionStart: number
  4459. /** HTTP(TCP) 完成建立连接的时间(完成握手),如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接完成的时间。注意这里握手结束,包括安全连接建立完成、SOCKS 授权通过 */
  4460. connectEnd: number
  4461. /** HTTP(TCP) 开始建立连接的时间,如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接开始的时间 */
  4462. connectStart: number
  4463. /** DNS 域名查询完成的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
  4464. domainLookupEnd: number
  4465. /** DNS 域名查询开始的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
  4466. domainLookupStart: number
  4467. /** 评估当前网络下载的kbps */
  4468. downstreamThroughputKbpsEstimate: number
  4469. /** 评估的网络状态 slow 2g/2g/3g/4g */
  4470. estimate_nettype: string
  4471. /** 组件准备好使用 HTTP 请求抓取资源的时间,这发生在检查本地缓存之前 */
  4472. fetchStart: number
  4473. /** 协议层根据多个请求评估当前网络的 rtt(仅供参考) */
  4474. httpRttEstimate: number
  4475. /** 当前请求的IP */
  4476. peerIP: string
  4477. /** 当前请求的端口 */
  4478. port: number
  4479. /** 收到字节数 */
  4480. receivedBytedCount: number
  4481. /** 最后一个 HTTP 重定向完成时的时间。有跳转且是同域名内部的重定向才算,否则值为 0 */
  4482. redirectEnd: number
  4483. /** 第一个 HTTP 重定向发生时的时间。有跳转且是同域名内的重定向才算,否则值为 0 */
  4484. redirectStart: number
  4485. /** HTTP请求读取真实文档结束的时间 */
  4486. requestEnd: number
  4487. /** HTTP请求读取真实文档开始的时间(完成建立连接),包括从本地读取缓存。连接错误重连时,这里显示的也是新建立连接的时间 */
  4488. requestStart: number
  4489. /** HTTP 响应全部接收完成的时间(获取到最后一个字节),包括从本地读取缓存 */
  4490. responseEnd: number
  4491. /** HTTP 开始接收响应的时间(获取到第一个字节),包括从本地读取缓存 */
  4492. responseStart: number
  4493. /** 当次请求连接过程中实时 rtt */
  4494. rtt: number
  4495. /** 发送的字节数 */
  4496. sendBytesCount: number
  4497. /** 是否复用连接 */
  4498. socketReused: boolean
  4499. /** 当前网络的实际下载kbps */
  4500. throughputKbps: number
  4501. /** 传输层根据多个请求评估的当前网络的 rtt(仅供参考) */
  4502. transportRttEstimate: number
  4503. }
  4504. interface RequestSubscribeMessageFailCallbackResult {
  4505. /** 接口调用失败错误码 */
  4506. errCode: number
  4507. /** 接口调用失败错误信息 */
  4508. errMsg: string
  4509. }
  4510. interface RequestSubscribeMessageOption {
  4511. /** 需要订阅的消息模板的id的集合,一次调用最多可订阅3条消息(注意:iOS客户端7.0.6版本、Android客户端7.0.7版本之后的一次性订阅/长期订阅才支持多个模板消息,iOS客户端7.0.5版本、Android客户端7.0.6版本之前的一次订阅只支持一个模板消息)消息模板id在[微信公众平台(mp.weixin.qq.com)-功能-订阅消息]中配置。每个tmplId对应的模板标题需要不相同,否则会被过滤。 */
  4512. tmplIds: any[]
  4513. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4514. complete?: RequestSubscribeMessageCompleteCallback
  4515. /** 接口调用失败的回调函数 */
  4516. fail?: RequestSubscribeMessageFailCallback
  4517. /** 接口调用成功的回调函数 */
  4518. success?: RequestSubscribeMessageSuccessCallback
  4519. }
  4520. interface RequestSubscribeMessageSuccessCallbackResult {
  4521. /** [TEMPLATE_ID]是动态的键,即模板id,值包括'accept'、'reject'、'ban'、'filter'。'accept'表示用户同意订阅该条id对应的模板消息,'reject'表示用户拒绝订阅该条id对应的模板消息,'ban'表示已被后台封禁,'filter'表示该模板因为模板标题同名被后台过滤。例如 { errMsg: "requestSubscribeMessage:ok", zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: "accept"} 表示用户同意订阅zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE这条消息 */
  4522. [TEMPLATE_ID: string]: string
  4523. /** 接口调用成功时errMsg值为'requestSubscribeMessage:ok' */
  4524. errMsg: string
  4525. }
  4526. interface RequestSuccessCallbackResult<
  4527. T extends string | IAnyObject | ArrayBuffer =
  4528. | string
  4529. | IAnyObject
  4530. | ArrayBuffer
  4531. > {
  4532. /** 开发者服务器返回的 cookies,格式为字符串数组
  4533. *
  4534. * 最低基础库: `2.10.0` */
  4535. cookies: string[]
  4536. /** 开发者服务器返回的数据 */
  4537. data: T
  4538. /** 开发者服务器返回的 HTTP Response Header
  4539. *
  4540. * 最低基础库: `1.2.0` */
  4541. header: IAnyObject
  4542. /** 网络请求过程中一些调试信息
  4543. *
  4544. * 最低基础库: `2.10.4` */
  4545. profile: RequestProfile
  4546. /** 开发者服务器返回的 HTTP 状态码 */
  4547. statusCode: number
  4548. errMsg: string
  4549. }
  4550. interface ResumeBGMOption {
  4551. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4552. complete?: ResumeBGMCompleteCallback
  4553. /** 接口调用失败的回调函数 */
  4554. fail?: ResumeBGMFailCallback
  4555. /** 接口调用成功的回调函数 */
  4556. success?: ResumeBGMSuccessCallback
  4557. }
  4558. interface ResumeOption {
  4559. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4560. complete?: ResumeCompleteCallback
  4561. /** 接口调用失败的回调函数 */
  4562. fail?: ResumeFailCallback
  4563. /** 接口调用成功的回调函数 */
  4564. success?: ResumeSuccessCallback
  4565. }
  4566. interface RewardedVideoAdOnCloseCallbackResult {
  4567. /** 视频是否是在用户完整观看的情况下被关闭的
  4568. *
  4569. * 最低基础库: `2.1.0` */
  4570. isEnded: boolean
  4571. }
  4572. interface RewardedVideoAdOnErrorCallbackResult {
  4573. /** 错误码
  4574. *
  4575. * 可选值:
  4576. * - 1000: 后端接口调用失败;
  4577. * - 1001: 参数错误;
  4578. * - 1002: 广告单元无效;
  4579. * - 1003: 内部错误;
  4580. * - 1004: 无合适的广告;
  4581. * - 1005: 广告组件审核中;
  4582. * - 1006: 广告组件被驳回;
  4583. * - 1007: 广告组件被封禁;
  4584. * - 1008: 广告单元已关闭;
  4585. *
  4586. * 最低基础库: `2.2.2` */
  4587. errCode: 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008
  4588. /** 错误信息 */
  4589. errMsg: string
  4590. }
  4591. interface RmdirFailCallbackResult {
  4592. /** 错误信息
  4593. *
  4594. * 可选值:
  4595. * - 'fail no such file or directory ${dirPath}': 目录不存在;
  4596. * - 'fail directory not empty': 目录不为空;
  4597. * - 'fail permission denied, open ${dirPath}': 指定的 dirPath 路径没有写权限;
  4598. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  4599. errMsg: string
  4600. }
  4601. interface RmdirOption {
  4602. /** 要删除的目录路径 (本地路径) */
  4603. dirPath: string
  4604. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4605. complete?: RmdirCompleteCallback
  4606. /** 接口调用失败的回调函数 */
  4607. fail?: RmdirFailCallback
  4608. /** 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。
  4609. *
  4610. * 最低基础库: `2.3.0` */
  4611. recursive?: boolean
  4612. /** 接口调用成功的回调函数 */
  4613. success?: RmdirSuccessCallback
  4614. }
  4615. /** 在竖屏正方向下的安全区域
  4616. *
  4617. * 最低基础库: `2.7.0` */
  4618. interface SafeArea {
  4619. /** 安全区域右下角纵坐标 */
  4620. bottom: number
  4621. /** 安全区域的高度,单位逻辑像素 */
  4622. height: number
  4623. /** 安全区域左上角横坐标 */
  4624. left: number
  4625. /** 安全区域右下角横坐标 */
  4626. right: number
  4627. /** 安全区域左上角纵坐标 */
  4628. top: number
  4629. /** 安全区域的宽度,单位逻辑像素 */
  4630. width: number
  4631. }
  4632. interface SaveFileFailCallbackResult {
  4633. /** 错误信息
  4634. *
  4635. * 可选值:
  4636. * - 'fail tempFilePath file not exist': 指定的 tempFilePath 找不到文件;
  4637. * - 'fail permission denied, open "${filePath}"': 指定的 filePath 路径没有写权限;
  4638. * - 'fail no such file or directory "${dirPath}"': 上级目录不存在;
  4639. * - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足;
  4640. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  4641. errMsg: string
  4642. }
  4643. interface SaveFileSuccessCallbackResult {
  4644. /** 存储后的文件路径 (本地路径) */
  4645. savedFilePath: string
  4646. errMsg: string
  4647. }
  4648. interface SaveFileToDiskOption {
  4649. /** 待保存文件路径 */
  4650. filePath: string
  4651. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4652. complete?: SaveFileToDiskCompleteCallback
  4653. /** 接口调用失败的回调函数 */
  4654. fail?: SaveFileToDiskFailCallback
  4655. /** 接口调用成功的回调函数 */
  4656. success?: SaveFileToDiskSuccessCallback
  4657. }
  4658. interface SaveImageToPhotosAlbumOption {
  4659. /** 图片文件路径,可以是临时文件路径或永久文件路径 (本地路径) ,不支持网络路径 */
  4660. filePath: string
  4661. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4662. complete?: SaveImageToPhotosAlbumCompleteCallback
  4663. /** 接口调用失败的回调函数 */
  4664. fail?: SaveImageToPhotosAlbumFailCallback
  4665. /** 接口调用成功的回调函数 */
  4666. success?: SaveImageToPhotosAlbumSuccessCallback
  4667. }
  4668. interface SaveVideoToPhotosAlbumOption {
  4669. /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 (本地路径) */
  4670. filePath: string
  4671. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4672. complete?: SaveVideoToPhotosAlbumCompleteCallback
  4673. /** 接口调用失败的回调函数 */
  4674. fail?: SaveVideoToPhotosAlbumFailCallback
  4675. /** 接口调用成功的回调函数 */
  4676. success?: SaveVideoToPhotosAlbumSuccessCallback
  4677. }
  4678. interface ScanCodeOption {
  4679. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4680. complete?: ScanCodeCompleteCallback
  4681. /** 接口调用失败的回调函数 */
  4682. fail?: ScanCodeFailCallback
  4683. /** 是否只能从相机扫码,不允许从相册选择图片
  4684. *
  4685. * 最低基础库: `1.2.0` */
  4686. onlyFromCamera?: boolean
  4687. /** 扫码类型
  4688. *
  4689. * 可选值:
  4690. * - 'barCode': 一维码;
  4691. * - 'qrCode': 二维码;
  4692. * - 'datamatrix': Data Matrix 码;
  4693. * - 'pdf417': PDF417 条码;
  4694. *
  4695. * 最低基础库: `1.7.0` */
  4696. scanType?: Array<'barCode' | 'qrCode' | 'datamatrix' | 'pdf417'>
  4697. /** 接口调用成功的回调函数 */
  4698. success?: ScanCodeSuccessCallback
  4699. }
  4700. interface ScanCodeSuccessCallbackResult {
  4701. /** 所扫码的字符集 */
  4702. charSet: string
  4703. /** 当所扫的码为当前小程序二维码时,会返回此字段,内容为二维码携带的 path */
  4704. path: string
  4705. /** 原始数据,base64编码 */
  4706. rawData: string
  4707. /** 所扫码的内容 */
  4708. result: string
  4709. /** 所扫码的类型
  4710. *
  4711. * 可选值:
  4712. * - 'QR_CODE': 二维码;
  4713. * - 'AZTEC': 一维码;
  4714. * - 'CODABAR': 一维码;
  4715. * - 'CODE_39': 一维码;
  4716. * - 'CODE_93': 一维码;
  4717. * - 'CODE_128': 一维码;
  4718. * - 'DATA_MATRIX': 二维码;
  4719. * - 'EAN_8': 一维码;
  4720. * - 'EAN_13': 一维码;
  4721. * - 'ITF': 一维码;
  4722. * - 'MAXICODE': 一维码;
  4723. * - 'PDF_417': 二维码;
  4724. * - 'RSS_14': 一维码;
  4725. * - 'RSS_EXPANDED': 一维码;
  4726. * - 'UPC_A': 一维码;
  4727. * - 'UPC_E': 一维码;
  4728. * - 'UPC_EAN_EXTENSION': 一维码;
  4729. * - 'WX_CODE': 二维码;
  4730. * - 'CODE_25': 一维码; */
  4731. scanType:
  4732. | 'QR_CODE'
  4733. | 'AZTEC'
  4734. | 'CODABAR'
  4735. | 'CODE_39'
  4736. | 'CODE_93'
  4737. | 'CODE_128'
  4738. | 'DATA_MATRIX'
  4739. | 'EAN_8'
  4740. | 'EAN_13'
  4741. | 'ITF'
  4742. | 'MAXICODE'
  4743. | 'PDF_417'
  4744. | 'RSS_14'
  4745. | 'RSS_EXPANDED'
  4746. | 'UPC_A'
  4747. | 'UPC_E'
  4748. | 'UPC_EAN_EXTENSION'
  4749. | 'WX_CODE'
  4750. | 'CODE_25'
  4751. errMsg: string
  4752. }
  4753. interface ScrollOffsetCallbackResult {
  4754. /** 节点的 dataset */
  4755. dataset: IAnyObject
  4756. /** 节点的 ID */
  4757. id: string
  4758. /** 节点的水平滚动位置 */
  4759. scrollLeft: number
  4760. /** 节点的竖直滚动位置 */
  4761. scrollTop: number
  4762. }
  4763. interface ScrollToOption {
  4764. /** 是否启用滚动动画 */
  4765. animated?: boolean
  4766. /** 滚动动画时长 */
  4767. duration?: number
  4768. /** 左边界距离 */
  4769. left?: number
  4770. /** 顶部距离 */
  4771. top?: number
  4772. /** 初始速度 */
  4773. velocity?: number
  4774. }
  4775. /** 增强 ScrollView 实例
  4776. *
  4777. * 最低基础库: `2.14.4` */
  4778. interface ScrollViewContext {
  4779. /** 设置滚动边界弹性 (仅在 iOS 下生效) */
  4780. bounces: boolean
  4781. /** 取消滚动惯性 (仅在 iOS 下生效) */
  4782. decelerationDisabled: boolean
  4783. /** 设置滚动减速速率 */
  4784. fastDeceleration: boolean
  4785. /** 分页滑动开关 */
  4786. pagingEnabled: boolean
  4787. /** 滚动开关 */
  4788. scrollEnabled: boolean
  4789. /** 设置是否显示滚动条 */
  4790. showScrollbar: boolean
  4791. }
  4792. interface SeekBackgroundAudioOption {
  4793. /** 音乐位置,单位:秒 */
  4794. position: number
  4795. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4796. complete?: SeekBackgroundAudioCompleteCallback
  4797. /** 接口调用失败的回调函数 */
  4798. fail?: SeekBackgroundAudioFailCallback
  4799. /** 接口调用成功的回调函数 */
  4800. success?: SeekBackgroundAudioSuccessCallback
  4801. }
  4802. interface SendHCEMessageOption {
  4803. /** 二进制数据 */
  4804. data: ArrayBuffer
  4805. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4806. complete?: SendHCEMessageCompleteCallback
  4807. /** 接口调用失败的回调函数 */
  4808. fail?: SendHCEMessageFailCallback
  4809. /** 接口调用成功的回调函数 */
  4810. success?: SendHCEMessageSuccessCallback
  4811. }
  4812. interface SendMessageOption {
  4813. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4814. complete?: SendMessageCompleteCallback
  4815. /** 接口调用失败的回调函数 */
  4816. fail?: SendMessageFailCallback
  4817. /** 接口调用成功的回调函数 */
  4818. success?: SendMessageSuccessCallback
  4819. }
  4820. interface SendSocketMessageOption {
  4821. /** 需要发送的内容 */
  4822. data: string | ArrayBuffer
  4823. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4824. complete?: SendSocketMessageCompleteCallback
  4825. /** 接口调用失败的回调函数 */
  4826. fail?: SendSocketMessageFailCallback
  4827. /** 接口调用成功的回调函数 */
  4828. success?: SendSocketMessageSuccessCallback
  4829. }
  4830. interface SetBGMVolumeOption {
  4831. /** 音量大小,范围是 0-1 */
  4832. volume: string
  4833. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4834. complete?: SetBGMVolumeCompleteCallback
  4835. /** 接口调用失败的回调函数 */
  4836. fail?: SetBGMVolumeFailCallback
  4837. /** 接口调用成功的回调函数 */
  4838. success?: SetBGMVolumeSuccessCallback
  4839. }
  4840. interface SetBLEMTUOption {
  4841. /** 用于区分设备的 id */
  4842. deviceId: string
  4843. /** 最大传输单元(22,512) 区间内,单位 bytes */
  4844. mtu: number
  4845. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4846. complete?: SetBLEMTUCompleteCallback
  4847. /** 接口调用失败的回调函数 */
  4848. fail?: SetBLEMTUFailCallback
  4849. /** 接口调用成功的回调函数 */
  4850. success?: SetBLEMTUSuccessCallback
  4851. }
  4852. interface SetBackgroundColorOption {
  4853. /** 窗口的背景色,必须为十六进制颜色值 */
  4854. backgroundColor?: string
  4855. /** 底部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持 */
  4856. backgroundColorBottom?: string
  4857. /** 顶部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持 */
  4858. backgroundColorTop?: string
  4859. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4860. complete?: SetBackgroundColorCompleteCallback
  4861. /** 接口调用失败的回调函数 */
  4862. fail?: SetBackgroundColorFailCallback
  4863. /** 接口调用成功的回调函数 */
  4864. success?: SetBackgroundColorSuccessCallback
  4865. }
  4866. interface SetBackgroundFetchTokenOption {
  4867. /** 自定义的登录态 */
  4868. token: string
  4869. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4870. complete?: SetBackgroundFetchTokenCompleteCallback
  4871. /** 接口调用失败的回调函数 */
  4872. fail?: SetBackgroundFetchTokenFailCallback
  4873. /** 接口调用成功的回调函数 */
  4874. success?: SetBackgroundFetchTokenSuccessCallback
  4875. }
  4876. interface SetBackgroundTextStyleOption {
  4877. /** 下拉背景字体、loading 图的样式。
  4878. *
  4879. * 可选值:
  4880. * - 'dark': dark 样式;
  4881. * - 'light': light 样式; */
  4882. textStyle: 'dark' | 'light'
  4883. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4884. complete?: SetBackgroundTextStyleCompleteCallback
  4885. /** 接口调用失败的回调函数 */
  4886. fail?: SetBackgroundTextStyleFailCallback
  4887. /** 接口调用成功的回调函数 */
  4888. success?: SetBackgroundTextStyleSuccessCallback
  4889. }
  4890. interface SetCenterOffsetOption {
  4891. /** 偏移量,两位数组 */
  4892. offset: number[]
  4893. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4894. complete?: SetCenterOffsetCompleteCallback
  4895. /** 接口调用失败的回调函数 */
  4896. fail?: SetCenterOffsetFailCallback
  4897. /** 接口调用成功的回调函数 */
  4898. success?: SetCenterOffsetSuccessCallback
  4899. }
  4900. interface SetClipboardDataOption {
  4901. /** 剪贴板的内容 */
  4902. data: string
  4903. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4904. complete?: SetClipboardDataCompleteCallback
  4905. /** 接口调用失败的回调函数 */
  4906. fail?: SetClipboardDataFailCallback
  4907. /** 接口调用成功的回调函数 */
  4908. success?: SetClipboardDataSuccessCallback
  4909. }
  4910. interface SetContentsOption {
  4911. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4912. complete?: SetContentsCompleteCallback
  4913. /** 表示内容的delta对象 */
  4914. delta?: IAnyObject
  4915. /** 接口调用失败的回调函数 */
  4916. fail?: SetContentsFailCallback
  4917. /** 带标签的HTML内容 */
  4918. html?: string
  4919. /** 接口调用成功的回调函数 */
  4920. success?: SetContentsSuccessCallback
  4921. }
  4922. interface SetEnableDebugOption {
  4923. /** 是否打开调试 */
  4924. enableDebug: boolean
  4925. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4926. complete?: SetEnableDebugCompleteCallback
  4927. /** 接口调用失败的回调函数 */
  4928. fail?: SetEnableDebugFailCallback
  4929. /** 接口调用成功的回调函数 */
  4930. success?: SetEnableDebugSuccessCallback
  4931. }
  4932. interface SetInnerAudioOption {
  4933. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4934. complete?: SetInnerAudioOptionCompleteCallback
  4935. /** 接口调用失败的回调函数 */
  4936. fail?: SetInnerAudioOptionFailCallback
  4937. /** 是否与其他音频混播,设置为 true 之后,不会终止其他应用或微信内的音乐 */
  4938. mixWithOther?: boolean
  4939. /** (仅在 iOS 生效)是否遵循静音开关,设置为 false 之后,即使是在静音模式下,也能播放声音 */
  4940. obeyMuteSwitch?: boolean
  4941. /** true 代表用扬声器播放,false 代表听筒播放,默认值为 true。 */
  4942. speakerOn?: boolean
  4943. /** 接口调用成功的回调函数 */
  4944. success?: SetInnerAudioOptionSuccessCallback
  4945. }
  4946. interface SetKeepScreenOnOption {
  4947. /** 是否保持屏幕常亮 */
  4948. keepScreenOn: boolean
  4949. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4950. complete?: SetKeepScreenOnCompleteCallback
  4951. /** 接口调用失败的回调函数 */
  4952. fail?: SetKeepScreenOnFailCallback
  4953. /** 接口调用成功的回调函数 */
  4954. success?: SetKeepScreenOnSuccessCallback
  4955. }
  4956. interface SetMICVolumeOption {
  4957. /** 音量大小,范围是 0.0-1.0 */
  4958. volume: number
  4959. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4960. complete?: SetMICVolumeCompleteCallback
  4961. /** 接口调用失败的回调函数 */
  4962. fail?: SetMICVolumeFailCallback
  4963. /** 接口调用成功的回调函数 */
  4964. success?: SetMICVolumeSuccessCallback
  4965. }
  4966. interface SetNavigationBarColorOption {
  4967. /** 背景颜色值,有效值为十六进制颜色 */
  4968. backgroundColor: string
  4969. /** 前景颜色值,包括按钮、标题、状态栏的颜色,仅支持 #ffffff 和 #000000 */
  4970. frontColor: string
  4971. /** 动画效果 */
  4972. animation?: AnimationOption
  4973. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4974. complete?: SetNavigationBarColorCompleteCallback
  4975. /** 接口调用失败的回调函数 */
  4976. fail?: SetNavigationBarColorFailCallback
  4977. /** 接口调用成功的回调函数 */
  4978. success?: SetNavigationBarColorSuccessCallback
  4979. }
  4980. interface SetNavigationBarTitleOption {
  4981. /** 页面标题 */
  4982. title: string
  4983. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4984. complete?: SetNavigationBarTitleCompleteCallback
  4985. /** 接口调用失败的回调函数 */
  4986. fail?: SetNavigationBarTitleFailCallback
  4987. /** 接口调用成功的回调函数 */
  4988. success?: SetNavigationBarTitleSuccessCallback
  4989. }
  4990. interface SetScreenBrightnessOption {
  4991. /** 屏幕亮度值,范围 0 ~ 1。0 最暗,1 最亮 */
  4992. value: number
  4993. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4994. complete?: SetScreenBrightnessCompleteCallback
  4995. /** 接口调用失败的回调函数 */
  4996. fail?: SetScreenBrightnessFailCallback
  4997. /** 接口调用成功的回调函数 */
  4998. success?: SetScreenBrightnessSuccessCallback
  4999. }
  5000. interface SetStorageOption<T = any> {
  5001. /** 需要存储的内容。只支持原生类型、Date、及能够通过`JSON.stringify`序列化的对象。 */
  5002. data: T
  5003. /** 本地缓存中指定的 key */
  5004. key: string
  5005. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5006. complete?: SetStorageCompleteCallback
  5007. /** 接口调用失败的回调函数 */
  5008. fail?: SetStorageFailCallback
  5009. /** 接口调用成功的回调函数 */
  5010. success?: SetStorageSuccessCallback
  5011. }
  5012. interface SetTabBarBadgeOption {
  5013. /** tabBar 的哪一项,从左边算起 */
  5014. index: number
  5015. /** 显示的文本,超过 4 个字符则显示成 ... */
  5016. text: string
  5017. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5018. complete?: SetTabBarBadgeCompleteCallback
  5019. /** 接口调用失败的回调函数 */
  5020. fail?: SetTabBarBadgeFailCallback
  5021. /** 接口调用成功的回调函数 */
  5022. success?: SetTabBarBadgeSuccessCallback
  5023. }
  5024. interface SetTabBarItemOption {
  5025. /** tabBar 的哪一项,从左边算起 */
  5026. index: number
  5027. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5028. complete?: SetTabBarItemCompleteCallback
  5029. /** 接口调用失败的回调函数 */
  5030. fail?: SetTabBarItemFailCallback
  5031. /** 图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,当 postion 为 top 时,此参数无效 */
  5032. iconPath?: string
  5033. /** 选中时的图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px ,当 postion 为 top 时,此参数无效 */
  5034. selectedIconPath?: string
  5035. /** 接口调用成功的回调函数 */
  5036. success?: SetTabBarItemSuccessCallback
  5037. /** tab 上的按钮文字 */
  5038. text?: string
  5039. }
  5040. interface SetTabBarStyleOption {
  5041. /** tab 的背景色,HexColor */
  5042. backgroundColor?: string
  5043. /** tabBar上边框的颜色, 仅支持 black/white */
  5044. borderStyle?: string
  5045. /** tab 上的文字默认颜色,HexColor */
  5046. color?: string
  5047. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5048. complete?: SetTabBarStyleCompleteCallback
  5049. /** 接口调用失败的回调函数 */
  5050. fail?: SetTabBarStyleFailCallback
  5051. /** tab 上的文字选中时的颜色,HexColor */
  5052. selectedColor?: string
  5053. /** 接口调用成功的回调函数 */
  5054. success?: SetTabBarStyleSuccessCallback
  5055. }
  5056. interface SetTimeoutOption {
  5057. /** 设置超时时间 (ms) */
  5058. timeout: number
  5059. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5060. complete?: SetTimeoutCompleteCallback
  5061. /** 接口调用失败的回调函数 */
  5062. fail?: SetTimeoutFailCallback
  5063. /** 接口调用成功的回调函数 */
  5064. success?: SetTimeoutSuccessCallback
  5065. }
  5066. interface SetTopBarTextOption {
  5067. /** 置顶栏文字 */
  5068. text: string
  5069. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5070. complete?: SetTopBarTextCompleteCallback
  5071. /** 接口调用失败的回调函数 */
  5072. fail?: SetTopBarTextFailCallback
  5073. /** 接口调用成功的回调函数 */
  5074. success?: SetTopBarTextSuccessCallback
  5075. }
  5076. interface SetWifiListOption {
  5077. /** 提供预设的 Wi-Fi 信息列表 */
  5078. wifiList: WifiData[]
  5079. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5080. complete?: SetWifiListCompleteCallback
  5081. /** 接口调用失败的回调函数 */
  5082. fail?: SetWifiListFailCallback
  5083. /** 接口调用成功的回调函数 */
  5084. success?: SetWifiListSuccessCallback
  5085. }
  5086. interface SetWindowSizeOption {
  5087. /** 窗口高度,以像素为单位 */
  5088. height: number
  5089. /** 窗口宽度,以像素为单位 */
  5090. width: number
  5091. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5092. complete?: SetWindowSizeCompleteCallback
  5093. /** 接口调用失败的回调函数 */
  5094. fail?: SetWindowSizeFailCallback
  5095. /** 接口调用成功的回调函数 */
  5096. success?: SetWindowSizeSuccessCallback
  5097. }
  5098. interface SetZoomOption {
  5099. /** 缩放级别,范围[1, maxZoom]。zoom 可取小数,精确到小数后一位。maxZoom 可在 bindinitdone 返回值中获取。 */
  5100. zoom: number
  5101. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5102. complete?: SetZoomCompleteCallback
  5103. /** 接口调用失败的回调函数 */
  5104. fail?: SetZoomFailCallback
  5105. /** 接口调用成功的回调函数 */
  5106. success?: SetZoomSuccessCallback
  5107. }
  5108. interface SetZoomSuccessCallbackResult {
  5109. /** 实际设置的缩放级别。由于系统限制,某些机型可能无法设置成指定值,会改用最接近的可设值。 */
  5110. zoom: number
  5111. errMsg: string
  5112. }
  5113. interface ShowActionSheetOption {
  5114. /** 按钮的文字数组,数组长度最大为 6 */
  5115. itemList: string[]
  5116. /** 警示文案
  5117. *
  5118. * 最低基础库: `2.14.0` */
  5119. alertText?: string
  5120. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5121. complete?: ShowActionSheetCompleteCallback
  5122. /** 接口调用失败的回调函数 */
  5123. fail?: ShowActionSheetFailCallback
  5124. /** 按钮的文字颜色 */
  5125. itemColor?: string
  5126. /** 接口调用成功的回调函数 */
  5127. success?: ShowActionSheetSuccessCallback
  5128. }
  5129. interface ShowActionSheetSuccessCallbackResult {
  5130. /** 用户点击的按钮序号,从上到下的顺序,从0开始 */
  5131. tapIndex: number
  5132. errMsg: string
  5133. }
  5134. interface ShowLoadingOption {
  5135. /** 提示的内容 */
  5136. title: string
  5137. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5138. complete?: ShowLoadingCompleteCallback
  5139. /** 接口调用失败的回调函数 */
  5140. fail?: ShowLoadingFailCallback
  5141. /** 是否显示透明蒙层,防止触摸穿透 */
  5142. mask?: boolean
  5143. /** 接口调用成功的回调函数 */
  5144. success?: ShowLoadingSuccessCallback
  5145. }
  5146. interface ShowModalOption {
  5147. /** 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
  5148. cancelColor?: string
  5149. /** 取消按钮的文字,最多 4 个字符 */
  5150. cancelText?: string
  5151. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5152. complete?: ShowModalCompleteCallback
  5153. /** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
  5154. confirmColor?: string
  5155. /** 确认按钮的文字,最多 4 个字符 */
  5156. confirmText?: string
  5157. /** 提示的内容,editable 为 true 时,会输入框默认文本 */
  5158. content?: string
  5159. /** 是否显示输入框
  5160. *
  5161. * 最低基础库: `2.15.0` */
  5162. editable?: boolean
  5163. /** 接口调用失败的回调函数 */
  5164. fail?: ShowModalFailCallback
  5165. /** 输入框提示文本
  5166. *
  5167. * 最低基础库: `2.15.0` */
  5168. placeholderText?: string
  5169. /** 是否显示取消按钮 */
  5170. showCancel?: boolean
  5171. /** 接口调用成功的回调函数 */
  5172. success?: ShowModalSuccessCallback
  5173. /** 提示的标题 */
  5174. title?: string
  5175. }
  5176. interface ShowModalSuccessCallbackResult {
  5177. /** 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭)
  5178. *
  5179. * 最低基础库: `1.1.0` */
  5180. cancel: boolean
  5181. /** 为 true 时,表示用户点击了确定按钮 */
  5182. confirm: boolean
  5183. /** editable 为 true 时,用户输入的文本 */
  5184. content: string
  5185. errMsg: string
  5186. }
  5187. interface ShowNavigationBarLoadingOption {
  5188. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5189. complete?: ShowNavigationBarLoadingCompleteCallback
  5190. /** 接口调用失败的回调函数 */
  5191. fail?: ShowNavigationBarLoadingFailCallback
  5192. /** 接口调用成功的回调函数 */
  5193. success?: ShowNavigationBarLoadingSuccessCallback
  5194. }
  5195. interface ShowRedPackageOption {
  5196. /** 封面地址 */
  5197. url: string
  5198. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5199. complete?: ShowRedPackageCompleteCallback
  5200. /** 接口调用失败的回调函数 */
  5201. fail?: ShowRedPackageFailCallback
  5202. /** 接口调用成功的回调函数 */
  5203. success?: ShowRedPackageSuccessCallback
  5204. }
  5205. interface ShowShareImageMenuOption {
  5206. /** 要分享的图片地址,必须为本地路径或临时路径 */
  5207. path: string
  5208. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5209. complete?: ShowShareImageMenuCompleteCallback
  5210. /** 接口调用失败的回调函数 */
  5211. fail?: ShowShareImageMenuFailCallback
  5212. /** 接口调用成功的回调函数 */
  5213. success?: ShowShareImageMenuSuccessCallback
  5214. }
  5215. interface ShowShareMenuOption {
  5216. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5217. complete?: ShowShareMenuCompleteCallback
  5218. /** 接口调用失败的回调函数 */
  5219. fail?: ShowShareMenuFailCallback
  5220. /** 本接口为 Beta 版本,暂只在 Android 平台支持。需要显示的转发按钮名称列表,默认['shareAppMessage']。按钮名称合法值包含 "shareAppMessage"、"shareTimeline" 两种
  5221. *
  5222. * 最低基础库: `2.11.3` */
  5223. menus?: string[]
  5224. /** 接口调用成功的回调函数 */
  5225. success?: ShowShareMenuSuccessCallback
  5226. /** 是否使用带 shareTicket 的转发[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
  5227. withShareTicket?: boolean
  5228. }
  5229. interface ShowTabBarOption {
  5230. /** 是否需要动画效果 */
  5231. animation?: boolean
  5232. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5233. complete?: ShowTabBarCompleteCallback
  5234. /** 接口调用失败的回调函数 */
  5235. fail?: ShowTabBarFailCallback
  5236. /** 接口调用成功的回调函数 */
  5237. success?: ShowTabBarSuccessCallback
  5238. }
  5239. interface ShowTabBarRedDotOption {
  5240. /** tabBar 的哪一项,从左边算起 */
  5241. index: number
  5242. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5243. complete?: ShowTabBarRedDotCompleteCallback
  5244. /** 接口调用失败的回调函数 */
  5245. fail?: ShowTabBarRedDotFailCallback
  5246. /** 接口调用成功的回调函数 */
  5247. success?: ShowTabBarRedDotSuccessCallback
  5248. }
  5249. interface ShowToastOption {
  5250. /** 提示的内容 */
  5251. title: string
  5252. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5253. complete?: ShowToastCompleteCallback
  5254. /** 提示的延迟时间 */
  5255. duration?: number
  5256. /** 接口调用失败的回调函数 */
  5257. fail?: ShowToastFailCallback
  5258. /** 图标
  5259. *
  5260. * 可选值:
  5261. * - 'success': 显示成功图标,此时 title 文本最多显示 7 个汉字长度;
  5262. * - 'error': 显示失败图标,此时 title 文本最多显示 7 个汉字长度;
  5263. * - 'loading': 显示加载图标,此时 title 文本最多显示 7 个汉字长度;
  5264. * - 'none': 不显示图标,此时 title 文本最多可显示两行,[1.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)及以上版本支持; */
  5265. icon?: 'success' | 'error' | 'loading' | 'none'
  5266. /** 自定义图标的本地路径,image 的优先级高于 icon
  5267. *
  5268. * 最低基础库: `1.1.0` */
  5269. image?: string
  5270. /** 是否显示透明蒙层,防止触摸穿透 */
  5271. mask?: boolean
  5272. /** 接口调用成功的回调函数 */
  5273. success?: ShowToastSuccessCallback
  5274. }
  5275. interface Size {
  5276. /** 变化后的窗口高度,单位 px */
  5277. windowHeight: number
  5278. /** 变化后的窗口宽度,单位 px */
  5279. windowWidth: number
  5280. }
  5281. /** 网络请求过程中一些调试信息
  5282. *
  5283. * 最低基础库: `2.10.4` */
  5284. interface SocketProfile {
  5285. /** 完成建立连接的时间(完成握手),如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接完成的时间。注意这里握手结束,包括安全连接建立完成、SOCKS 授权通过 */
  5286. connectEnd: number
  5287. /** 开始建立连接的时间,如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接开始的时间 */
  5288. connectStart: number
  5289. /** 上层请求到返回的耗时 */
  5290. cost: number
  5291. /** DNS 域名查询完成的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
  5292. domainLookupEnd: number
  5293. /** DNS 域名查询开始的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
  5294. domainLookupStart: number
  5295. /** 组件准备好使用 SOCKET 建立请求的时间,这发生在检查本地缓存之前 */
  5296. fetchStart: number
  5297. /** 握手耗时 */
  5298. handshakeCost: number
  5299. /** 单次连接的耗时,包括 connect ,tls */
  5300. rtt: number
  5301. }
  5302. interface SocketTaskCloseOption {
  5303. /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */
  5304. code?: number
  5305. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5306. complete?: SocketTaskCloseCompleteCallback
  5307. /** 接口调用失败的回调函数 */
  5308. fail?: SocketTaskCloseFailCallback
  5309. /** 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于 123 字节的 UTF-8 文本(不是字符)。 */
  5310. reason?: string
  5311. /** 接口调用成功的回调函数 */
  5312. success?: SocketTaskCloseSuccessCallback
  5313. }
  5314. interface SocketTaskOnCloseCallbackResult {
  5315. /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */
  5316. code: number
  5317. /** 一个可读的字符串,表示连接被关闭的原因。 */
  5318. reason: string
  5319. }
  5320. interface SocketTaskOnMessageCallbackResult {
  5321. /** 服务器返回的消息 */
  5322. data: string | ArrayBuffer
  5323. }
  5324. interface SocketTaskSendOption {
  5325. /** 需要发送的内容 */
  5326. data: string | ArrayBuffer
  5327. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5328. complete?: SendCompleteCallback
  5329. /** 接口调用失败的回调函数 */
  5330. fail?: SendFailCallback
  5331. /** 接口调用成功的回调函数 */
  5332. success?: SendSuccessCallback
  5333. }
  5334. interface StartAccelerometerOption {
  5335. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5336. complete?: StartAccelerometerCompleteCallback
  5337. /** 接口调用失败的回调函数 */
  5338. fail?: StartAccelerometerFailCallback
  5339. /** 监听加速度数据回调函数的执行频率
  5340. *
  5341. * 可选值:
  5342. * - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右;
  5343. * - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右;
  5344. * - 'normal': 普通的回调频率,在 200ms/次 左右;
  5345. *
  5346. * 最低基础库: `2.1.0` */
  5347. interval?: 'game' | 'ui' | 'normal'
  5348. /** 接口调用成功的回调函数 */
  5349. success?: StartAccelerometerSuccessCallback
  5350. }
  5351. interface StartAdvertisingObject {
  5352. /** 广播自定义参数 */
  5353. advertiseRequest: AdvertiseReqObj
  5354. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5355. complete?: StartAdvertisingCompleteCallback
  5356. /** 接口调用失败的回调函数 */
  5357. fail?: StartAdvertisingFailCallback
  5358. /** 广播功率
  5359. *
  5360. * 可选值:
  5361. * - 'low': 功率低;
  5362. * - 'medium': 功率适中;
  5363. * - 'high': 功率高; */
  5364. powerLevel?: 'low' | 'medium' | 'high'
  5365. /** 接口调用成功的回调函数 */
  5366. success?: StartAdvertisingSuccessCallback
  5367. }
  5368. interface StartBeaconDiscoveryOption {
  5369. /** iBeacon 设备广播的 uuid 列表 */
  5370. uuids: string[]
  5371. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5372. complete?: StartBeaconDiscoveryCompleteCallback
  5373. /** 接口调用失败的回调函数 */
  5374. fail?: StartBeaconDiscoveryFailCallback
  5375. /** 是否校验蓝牙开关,仅在 iOS 下有效 */
  5376. ignoreBluetoothAvailable?: boolean
  5377. /** 接口调用成功的回调函数 */
  5378. success?: StartBeaconDiscoverySuccessCallback
  5379. }
  5380. interface StartBluetoothDevicesDiscoveryOption {
  5381. /** 是否允许重复上报同一设备。如果允许重复上报,则 [wx.onBlueToothDeviceFound](#) 方法会多次上报同一设备,但是 RSSI 值会有不同。 */
  5382. allowDuplicatesKey?: boolean
  5383. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5384. complete?: StartBluetoothDevicesDiscoveryCompleteCallback
  5385. /** 接口调用失败的回调函数 */
  5386. fail?: StartBluetoothDevicesDiscoveryFailCallback
  5387. /** 上报设备的间隔。0 表示找到新设备立即上报,其他数值根据传入的间隔上报。 */
  5388. interval?: number
  5389. /** 扫描模式,越高扫描越快,也越耗电, 仅安卓 7.0.12 及以上支持。
  5390. *
  5391. * 可选值:
  5392. * - 'low': 低;
  5393. * - 'medium': 中;
  5394. * - 'high': 高; */
  5395. powerLevel?: 'low' | 'medium' | 'high'
  5396. /** 要搜索的蓝牙设备主 service 的 uuid 列表。某些蓝牙设备会广播自己的主 service 的 uuid。如果设置此参数,则只搜索广播包有对应 uuid 的主服务的蓝牙设备。建议主要通过该参数过滤掉周边不需要处理的其他蓝牙设备。 */
  5397. services?: string[]
  5398. /** 接口调用成功的回调函数 */
  5399. success?: StartBluetoothDevicesDiscoverySuccessCallback
  5400. }
  5401. interface StartCompassOption {
  5402. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5403. complete?: StartCompassCompleteCallback
  5404. /** 接口调用失败的回调函数 */
  5405. fail?: StartCompassFailCallback
  5406. /** 接口调用成功的回调函数 */
  5407. success?: StartCompassSuccessCallback
  5408. }
  5409. interface StartDeviceMotionListeningOption {
  5410. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5411. complete?: StartDeviceMotionListeningCompleteCallback
  5412. /** 接口调用失败的回调函数 */
  5413. fail?: StartDeviceMotionListeningFailCallback
  5414. /** 监听设备方向的变化回调函数的执行频率
  5415. *
  5416. * 可选值:
  5417. * - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右;
  5418. * - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右;
  5419. * - 'normal': 普通的回调频率,在 200ms/次 左右; */
  5420. interval?: 'game' | 'ui' | 'normal'
  5421. /** 接口调用成功的回调函数 */
  5422. success?: StartDeviceMotionListeningSuccessCallback
  5423. }
  5424. interface StartDiscoveryOption {
  5425. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5426. complete?: StartDiscoveryCompleteCallback
  5427. /** 接口调用失败的回调函数 */
  5428. fail?: StartDiscoveryFailCallback
  5429. /** 接口调用成功的回调函数 */
  5430. success?: StartDiscoverySuccessCallback
  5431. }
  5432. interface StartGyroscopeOption {
  5433. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5434. complete?: StartGyroscopeCompleteCallback
  5435. /** 接口调用失败的回调函数 */
  5436. fail?: StartGyroscopeFailCallback
  5437. /** 监听陀螺仪数据回调函数的执行频率
  5438. *
  5439. * 可选值:
  5440. * - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右;
  5441. * - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右;
  5442. * - 'normal': 普通的回调频率,在 200ms/次 左右; */
  5443. interval?: 'game' | 'ui' | 'normal'
  5444. /** 接口调用成功的回调函数 */
  5445. success?: StartGyroscopeSuccessCallback
  5446. }
  5447. interface StartHCEOption {
  5448. /** 需要注册到系统的 AID 列表 */
  5449. aid_list: string[]
  5450. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5451. complete?: StartHCECompleteCallback
  5452. /** 接口调用失败的回调函数 */
  5453. fail?: StartHCEFailCallback
  5454. /** 接口调用成功的回调函数 */
  5455. success?: StartHCESuccessCallback
  5456. }
  5457. interface StartLocalServiceDiscoveryFailCallbackResult {
  5458. /** 错误信息
  5459. *
  5460. * 可选值:
  5461. * - 'invalid param': serviceType 为空;
  5462. * - 'scan task already exist': 在当前 startLocalServiceDiscovery 发起的搜索未停止的情况下,再次调用 startLocalServiceDiscovery; */
  5463. errMsg: string
  5464. }
  5465. interface StartLocalServiceDiscoveryOption {
  5466. /** 要搜索的服务类型 */
  5467. serviceType: string
  5468. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5469. complete?: StartLocalServiceDiscoveryCompleteCallback
  5470. /** 接口调用失败的回调函数 */
  5471. fail?: StartLocalServiceDiscoveryFailCallback
  5472. /** 接口调用成功的回调函数 */
  5473. success?: StartLocalServiceDiscoverySuccessCallback
  5474. }
  5475. interface StartLocationUpdateBackgroundOption {
  5476. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5477. complete?: StartLocationUpdateBackgroundCompleteCallback
  5478. /** 接口调用失败的回调函数 */
  5479. fail?: StartLocationUpdateBackgroundFailCallback
  5480. /** 接口调用成功的回调函数 */
  5481. success?: StartLocationUpdateBackgroundSuccessCallback
  5482. }
  5483. interface StartLocationUpdateOption {
  5484. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5485. complete?: StartLocationUpdateCompleteCallback
  5486. /** 接口调用失败的回调函数 */
  5487. fail?: StartLocationUpdateFailCallback
  5488. /** 接口调用成功的回调函数 */
  5489. success?: StartLocationUpdateSuccessCallback
  5490. }
  5491. interface StartPreviewOption {
  5492. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5493. complete?: StartPreviewCompleteCallback
  5494. /** 接口调用失败的回调函数 */
  5495. fail?: StartPreviewFailCallback
  5496. /** 接口调用成功的回调函数 */
  5497. success?: StartPreviewSuccessCallback
  5498. }
  5499. interface StartPullDownRefreshOption {
  5500. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5501. complete?: StartPullDownRefreshCompleteCallback
  5502. /** 接口调用失败的回调函数 */
  5503. fail?: StartPullDownRefreshFailCallback
  5504. /** 接口调用成功的回调函数 */
  5505. success?: StartPullDownRefreshSuccessCallback
  5506. }
  5507. interface StartRecordSuccessCallbackResult {
  5508. /** 录音文件的临时路径 (本地路径) */
  5509. tempFilePath: string
  5510. errMsg: string
  5511. }
  5512. interface StartRecordTimeoutCallbackResult {
  5513. /** 封面图片文件的临时路径 (本地路径) */
  5514. tempThumbPath: string
  5515. /** 视频的文件的临时路径 (本地路径) */
  5516. tempVideoPath: string
  5517. }
  5518. interface StartSoterAuthenticationOption {
  5519. /** 挑战因子。挑战因子为调用者为此次生物鉴权准备的用于签名的字符串关键识别信息,将作为 `resultJSON` 的一部分,供调用者识别本次请求。例如:如果场景为请求用户对某订单进行授权确认,则可以将订单号填入此参数。 */
  5520. challenge: string
  5521. /** 请求使用的可接受的生物认证方式
  5522. *
  5523. * 可选值:
  5524. * - 'fingerPrint': 指纹识别;
  5525. * - 'facial': 人脸识别;
  5526. * - 'speech': 声纹识别(暂未支持); */
  5527. requestAuthModes: Array<'fingerPrint' | 'facial' | 'speech'>
  5528. /** 验证描述,即识别过程中显示在界面上的对话框提示内容 */
  5529. authContent?: string
  5530. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5531. complete?: StartSoterAuthenticationCompleteCallback
  5532. /** 接口调用失败的回调函数 */
  5533. fail?: StartSoterAuthenticationFailCallback
  5534. /** 接口调用成功的回调函数 */
  5535. success?: StartSoterAuthenticationSuccessCallback
  5536. }
  5537. interface StartSoterAuthenticationSuccessCallbackResult {
  5538. /** 生物认证方式 */
  5539. authMode: string
  5540. /** 错误码 */
  5541. errCode: number
  5542. /** 错误信息 */
  5543. errMsg: string
  5544. /** 在设备安全区域(TEE)内获得的本机安全信息(如TEE名称版本号等以及防重放参数)以及本次认证信息(仅Android支持,本次认证的指纹ID)。具体说明见下文 */
  5545. resultJSON: string
  5546. /** 用SOTER安全密钥对 `resultJSON` 的签名(SHA256 with RSA/PSS, saltlen=20) */
  5547. resultJSONSignature: string
  5548. }
  5549. interface StartWifiOption {
  5550. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5551. complete?: StartWifiCompleteCallback
  5552. /** 接口调用失败的回调函数 */
  5553. fail?: StartWifiFailCallback
  5554. /** 接口调用成功的回调函数 */
  5555. success?: StartWifiSuccessCallback
  5556. }
  5557. interface StatFailCallbackResult {
  5558. /** 错误信息
  5559. *
  5560. * 可选值:
  5561. * - 'fail permission denied, open ${path}': 指定的 path 路径没有读权限;
  5562. * - 'fail no such file or directory ${path}': 文件不存在;
  5563. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  5564. errMsg: string
  5565. }
  5566. interface StatOption {
  5567. /** 文件/目录路径 (本地路径) */
  5568. path: string
  5569. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5570. complete?: StatCompleteCallback
  5571. /** 接口调用失败的回调函数 */
  5572. fail?: StatFailCallback
  5573. /** 是否递归获取目录下的每个文件的 Stats 信息
  5574. *
  5575. * 最低基础库: `2.3.0` */
  5576. recursive?: boolean
  5577. /** 接口调用成功的回调函数 */
  5578. success?: StatSuccessCallback
  5579. }
  5580. interface StatSuccessCallbackResult {
  5581. /** [Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)|Object
  5582. *
  5583. * 当 recursive 为 false 时,res.stats 是一个 Stats 对象。当 recursive 为 true 且 path 是一个目录的路径时,res.stats 是一个 Object,key 以 path 为根路径的相对路径,value 是该路径对应的 Stats 对象。 */
  5584. stats: Stats | IAnyObject
  5585. errMsg: string
  5586. }
  5587. /** 描述文件状态的对象 */
  5588. interface Stats {
  5589. /** 文件最近一次被存取或被执行的时间,UNIX 时间戳,对应 POSIX stat.st_atime */
  5590. lastAccessedTime: number
  5591. /** 文件最后一次被修改的时间,UNIX 时间戳,对应 POSIX stat.st_mtime */
  5592. lastModifiedTime: number
  5593. /** 文件的类型和存取的权限,对应 POSIX stat.st_mode */
  5594. mode: string
  5595. /** 文件大小,单位:B,对应 POSIX stat.st_size */
  5596. size: number
  5597. }
  5598. interface StepOption {
  5599. /** 动画延迟时间,单位 ms */
  5600. delay?: number
  5601. /** 动画持续时间,单位 ms */
  5602. duration?: number
  5603. /** 动画的效果
  5604. *
  5605. * 可选值:
  5606. * - 'linear': 动画从头到尾的速度是相同的;
  5607. * - 'ease': 动画以低速开始,然后加快,在结束前变慢;
  5608. * - 'ease-in': 动画以低速开始;
  5609. * - 'ease-in-out': 动画以低速开始和结束;
  5610. * - 'ease-out': 动画以低速结束;
  5611. * - 'step-start': 动画第一帧就跳至结束状态直到结束;
  5612. * - 'step-end': 动画一直保持开始状态,最后一帧跳到结束状态; */
  5613. timingFunction?:
  5614. | 'linear'
  5615. | 'ease'
  5616. | 'ease-in'
  5617. | 'ease-in-out'
  5618. | 'ease-out'
  5619. | 'step-start'
  5620. | 'step-end'
  5621. transformOrigin?: string
  5622. }
  5623. interface StopAccelerometerOption {
  5624. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5625. complete?: StopAccelerometerCompleteCallback
  5626. /** 接口调用失败的回调函数 */
  5627. fail?: StopAccelerometerFailCallback
  5628. /** 接口调用成功的回调函数 */
  5629. success?: StopAccelerometerSuccessCallback
  5630. }
  5631. interface StopAdvertisingOption {
  5632. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5633. complete?: StopAdvertisingCompleteCallback
  5634. /** 接口调用失败的回调函数 */
  5635. fail?: StopAdvertisingFailCallback
  5636. /** 接口调用成功的回调函数 */
  5637. success?: StopAdvertisingSuccessCallback
  5638. }
  5639. interface StopBGMOption {
  5640. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5641. complete?: StopBGMCompleteCallback
  5642. /** 接口调用失败的回调函数 */
  5643. fail?: StopBGMFailCallback
  5644. /** 接口调用成功的回调函数 */
  5645. success?: StopBGMSuccessCallback
  5646. }
  5647. interface StopBackgroundAudioOption {
  5648. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5649. complete?: StopBackgroundAudioCompleteCallback
  5650. /** 接口调用失败的回调函数 */
  5651. fail?: StopBackgroundAudioFailCallback
  5652. /** 接口调用成功的回调函数 */
  5653. success?: StopBackgroundAudioSuccessCallback
  5654. }
  5655. interface StopBeaconDiscoveryOption {
  5656. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5657. complete?: StopBeaconDiscoveryCompleteCallback
  5658. /** 接口调用失败的回调函数 */
  5659. fail?: StopBeaconDiscoveryFailCallback
  5660. /** 接口调用成功的回调函数 */
  5661. success?: StopBeaconDiscoverySuccessCallback
  5662. }
  5663. interface StopBluetoothDevicesDiscoveryOption {
  5664. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5665. complete?: StopBluetoothDevicesDiscoveryCompleteCallback
  5666. /** 接口调用失败的回调函数 */
  5667. fail?: StopBluetoothDevicesDiscoveryFailCallback
  5668. /** 接口调用成功的回调函数 */
  5669. success?: StopBluetoothDevicesDiscoverySuccessCallback
  5670. }
  5671. interface StopCompassOption {
  5672. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5673. complete?: StopCompassCompleteCallback
  5674. /** 接口调用失败的回调函数 */
  5675. fail?: StopCompassFailCallback
  5676. /** 接口调用成功的回调函数 */
  5677. success?: StopCompassSuccessCallback
  5678. }
  5679. interface StopDeviceMotionListeningOption {
  5680. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5681. complete?: StopDeviceMotionListeningCompleteCallback
  5682. /** 接口调用失败的回调函数 */
  5683. fail?: StopDeviceMotionListeningFailCallback
  5684. /** 接口调用成功的回调函数 */
  5685. success?: StopDeviceMotionListeningSuccessCallback
  5686. }
  5687. interface StopDiscoveryOption {
  5688. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5689. complete?: StopDiscoveryCompleteCallback
  5690. /** 接口调用失败的回调函数 */
  5691. fail?: StopDiscoveryFailCallback
  5692. /** 接口调用成功的回调函数 */
  5693. success?: StopDiscoverySuccessCallback
  5694. }
  5695. interface StopGyroscopeOption {
  5696. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5697. complete?: StopGyroscopeCompleteCallback
  5698. /** 接口调用失败的回调函数 */
  5699. fail?: StopGyroscopeFailCallback
  5700. /** 接口调用成功的回调函数 */
  5701. success?: StopGyroscopeSuccessCallback
  5702. }
  5703. interface StopHCEOption {
  5704. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5705. complete?: StopHCECompleteCallback
  5706. /** 接口调用失败的回调函数 */
  5707. fail?: StopHCEFailCallback
  5708. /** 接口调用成功的回调函数 */
  5709. success?: StopHCESuccessCallback
  5710. }
  5711. interface StopLocalServiceDiscoveryFailCallbackResult {
  5712. /** 错误信息
  5713. *
  5714. * 可选值:
  5715. * - 'task not found': 在当前没有处在搜索服务中的情况下调用 stopLocalServiceDiscovery; */
  5716. errMsg: string
  5717. }
  5718. interface StopLocalServiceDiscoveryOption {
  5719. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5720. complete?: StopLocalServiceDiscoveryCompleteCallback
  5721. /** 接口调用失败的回调函数 */
  5722. fail?: StopLocalServiceDiscoveryFailCallback
  5723. /** 接口调用成功的回调函数 */
  5724. success?: StopLocalServiceDiscoverySuccessCallback
  5725. }
  5726. interface StopLocationUpdateOption {
  5727. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5728. complete?: StopLocationUpdateCompleteCallback
  5729. /** 接口调用失败的回调函数 */
  5730. fail?: StopLocationUpdateFailCallback
  5731. /** 接口调用成功的回调函数 */
  5732. success?: StopLocationUpdateSuccessCallback
  5733. }
  5734. interface StopOption {
  5735. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5736. complete?: StopCompleteCallback
  5737. /** 接口调用失败的回调函数 */
  5738. fail?: StopFailCallback
  5739. /** 接口调用成功的回调函数 */
  5740. success?: StopSuccessCallback
  5741. }
  5742. interface StopPreviewOption {
  5743. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5744. complete?: StopPreviewCompleteCallback
  5745. /** 接口调用失败的回调函数 */
  5746. fail?: StopPreviewFailCallback
  5747. /** 接口调用成功的回调函数 */
  5748. success?: StopPreviewSuccessCallback
  5749. }
  5750. interface StopPullDownRefreshOption {
  5751. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5752. complete?: StopPullDownRefreshCompleteCallback
  5753. /** 接口调用失败的回调函数 */
  5754. fail?: StopPullDownRefreshFailCallback
  5755. /** 接口调用成功的回调函数 */
  5756. success?: StopPullDownRefreshSuccessCallback
  5757. }
  5758. interface StopRecordSuccessCallbackResult {
  5759. /** 封面图片文件的临时路径 (本地路径) */
  5760. tempThumbPath: string
  5761. /** 视频的文件的临时路径 (本地路径) */
  5762. tempVideoPath: string
  5763. errMsg: string
  5764. }
  5765. interface StopVoiceOption {
  5766. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5767. complete?: StopVoiceCompleteCallback
  5768. /** 接口调用失败的回调函数 */
  5769. fail?: StopVoiceFailCallback
  5770. /** 接口调用成功的回调函数 */
  5771. success?: StopVoiceSuccessCallback
  5772. }
  5773. interface StopWifiOption {
  5774. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5775. complete?: StopWifiCompleteCallback
  5776. /** 接口调用失败的回调函数 */
  5777. fail?: StopWifiFailCallback
  5778. /** 接口调用成功的回调函数 */
  5779. success?: StopWifiSuccessCallback
  5780. }
  5781. interface SubscribeVoIPVideoMembersOption {
  5782. /** 订阅的成员列表 */
  5783. openIdList: string[]
  5784. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5785. complete?: SubscribeVoIPVideoMembersCompleteCallback
  5786. /** 接口调用失败的回调函数 */
  5787. fail?: SubscribeVoIPVideoMembersFailCallback
  5788. /** 接口调用成功的回调函数 */
  5789. success?: SubscribeVoIPVideoMembersSuccessCallback
  5790. }
  5791. /** 订阅消息设置
  5792. *
  5793. * **示例代码**
  5794. *
  5795. *
  5796. * ```javascript
  5797. wx.getSetting({
  5798. withSubscriptions: true,
  5799. success (res) {
  5800. console.log(res.authSetting)
  5801. // res.authSetting = {
  5802. // "scope.userInfo": true,
  5803. // "scope.userLocation": true
  5804. // }
  5805. console.log(res.subscriptionsSetting)
  5806. // res.subscriptionsSetting = {
  5807. // mainSwitch: true, // 订阅消息总开关
  5808. // itemSettings: { // 每一项开关
  5809. // SYS_MSG_TYPE_INTERACTIVE: 'accept', // 小游戏系统订阅消息
  5810. // SYS_MSG_TYPE_RANK: 'accept'
  5811. // zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: 'reject', // 普通一次性订阅消息
  5812. // ke_OZC_66gZxALLcsuI7ilCJSP2OJ2vWo2ooUPpkWrw: 'ban',
  5813. // }
  5814. // }
  5815. }
  5816. })
  5817. ``` */
  5818. interface SubscriptionsSetting {
  5819. /** 订阅消息总开关,true为开启,false为关闭 */
  5820. mainSwitch: boolean
  5821. /** 每一项订阅消息的订阅状态。itemSettings对象的键为**一次性订阅消息的模板id**或**系统订阅消息的类型**,值为'accept'、'reject'、'ban'中的其中一种。'accept'表示用户同意订阅这条消息,'reject'表示用户拒绝订阅这条消息,'ban'表示已被后台封禁。一次性订阅消息使用方法详见 [wx.requestSubscribeMessage](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html),永久订阅消息(仅小游戏可用)使用方法详见[wx.requestSubscribeSystemMessage](/minigame/dev/api/open-api/subscribe-message/wx.requestSubscribeSystemMessage.html)
  5822. * ## 注意事项
  5823. * - itemSettings 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。 */
  5824. itemSettings?: IAnyObject
  5825. }
  5826. interface SwitchCameraOption {
  5827. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5828. complete?: SwitchCameraCompleteCallback
  5829. /** 接口调用失败的回调函数 */
  5830. fail?: SwitchCameraFailCallback
  5831. /** 接口调用成功的回调函数 */
  5832. success?: SwitchCameraSuccessCallback
  5833. }
  5834. interface SwitchTabOption {
  5835. /** 需要跳转的 tabBar 页面的路径 (代码包路径)(需在 app.json 的 [tabBar](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#tabbar) 字段定义的页面),路径后不能带参数。 */
  5836. url: string
  5837. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5838. complete?: SwitchTabCompleteCallback
  5839. /** 接口调用失败的回调函数 */
  5840. fail?: SwitchTabFailCallback
  5841. /** 接口调用成功的回调函数 */
  5842. success?: SwitchTabSuccessCallback
  5843. }
  5844. interface SystemInfo {
  5845. /** 客户端基础库版本
  5846. *
  5847. * 最低基础库: `1.1.0` */
  5848. SDKVersion: string
  5849. /** 允许微信使用相册的开关(仅 iOS 有效)
  5850. *
  5851. * 最低基础库: `2.6.0` */
  5852. albumAuthorized: boolean
  5853. /** 设备性能等级(仅 Android)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50)
  5854. *
  5855. * 最低基础库: `1.8.0` */
  5856. benchmarkLevel: number
  5857. /** 蓝牙的系统开关
  5858. *
  5859. * 最低基础库: `2.6.0` */
  5860. bluetoothEnabled: boolean
  5861. /** 设备品牌
  5862. *
  5863. * 最低基础库: `1.5.0` */
  5864. brand: string
  5865. /** 允许微信使用摄像头的开关
  5866. *
  5867. * 最低基础库: `2.6.0` */
  5868. cameraAuthorized: boolean
  5869. /** 设备方向
  5870. *
  5871. * 可选值:
  5872. * - 'portrait': 竖屏;
  5873. * - 'landscape': 横屏; */
  5874. deviceOrientation: 'portrait' | 'landscape'
  5875. /** 是否已打开调试。可通过右上角菜单或 [wx.setEnableDebug](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html) 打开调试。
  5876. *
  5877. * 最低基础库: `2.15.0` */
  5878. enableDebug: boolean
  5879. /** 用户字体大小(单位px)。以微信客户端「我-设置-通用-字体大小」中的设置为准
  5880. *
  5881. * 最低基础库: `1.5.0` */
  5882. fontSizeSetting: number
  5883. /** 微信设置的语言 */
  5884. language: string
  5885. /** 允许微信使用定位的开关
  5886. *
  5887. * 最低基础库: `2.6.0` */
  5888. locationAuthorized: boolean
  5889. /** 地理位置的系统开关
  5890. *
  5891. * 最低基础库: `2.6.0` */
  5892. locationEnabled: boolean
  5893. /** `true` 表示模糊定位,`false` 表示精确定位,仅 iOS 支持 */
  5894. locationReducedAccuracy: boolean
  5895. /** 允许微信使用麦克风的开关
  5896. *
  5897. * 最低基础库: `2.6.0` */
  5898. microphoneAuthorized: boolean
  5899. /** 设备型号。新机型刚推出一段时间会显示unknown,微信会尽快进行适配。 */
  5900. model: string
  5901. /** 允许微信通知带有提醒的开关(仅 iOS 有效)
  5902. *
  5903. * 最低基础库: `2.6.0` */
  5904. notificationAlertAuthorized: boolean
  5905. /** 允许微信通知的开关
  5906. *
  5907. * 最低基础库: `2.6.0` */
  5908. notificationAuthorized: boolean
  5909. /** 允许微信通知带有标记的开关(仅 iOS 有效)
  5910. *
  5911. * 最低基础库: `2.6.0` */
  5912. notificationBadgeAuthorized: boolean
  5913. /** 允许微信通知带有声音的开关(仅 iOS 有效)
  5914. *
  5915. * 最低基础库: `2.6.0` */
  5916. notificationSoundAuthorized: boolean
  5917. /** 设备像素比 */
  5918. pixelRatio: number
  5919. /** 客户端平台 */
  5920. platform: string
  5921. /** 在竖屏正方向下的安全区域
  5922. *
  5923. * 最低基础库: `2.7.0` */
  5924. safeArea: SafeArea
  5925. /** 屏幕高度,单位px
  5926. *
  5927. * 最低基础库: `1.1.0` */
  5928. screenHeight: number
  5929. /** 屏幕宽度,单位px
  5930. *
  5931. * 最低基础库: `1.1.0` */
  5932. screenWidth: number
  5933. /** 状态栏的高度,单位px
  5934. *
  5935. * 最低基础库: `1.9.0` */
  5936. statusBarHeight: number
  5937. /** 操作系统及版本 */
  5938. system: string
  5939. /** 微信版本号 */
  5940. version: string
  5941. /** Wi-Fi 的系统开关
  5942. *
  5943. * 最低基础库: `2.6.0` */
  5944. wifiEnabled: boolean
  5945. /** 可使用窗口高度,单位px */
  5946. windowHeight: number
  5947. /** 可使用窗口宽度,单位px */
  5948. windowWidth: number
  5949. /** 系统当前主题,取值为`light`或`dark`,全局配置`"darkmode":true`时才能获取,否则为 undefined (不支持小游戏)
  5950. *
  5951. * 可选值:
  5952. * - 'dark': 深色主题;
  5953. * - 'light': 浅色主题;
  5954. *
  5955. * 最低基础库: `2.11.0` */
  5956. theme?: 'dark' | 'light'
  5957. }
  5958. interface TakePhotoOption {
  5959. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5960. complete?: TakePhotoCompleteCallback
  5961. /** 接口调用失败的回调函数 */
  5962. fail?: TakePhotoFailCallback
  5963. /** 成像质量
  5964. *
  5965. * 可选值:
  5966. * - 'high': 高质量;
  5967. * - 'normal': 普通质量;
  5968. * - 'low': 低质量; */
  5969. quality?: 'high' | 'normal' | 'low'
  5970. /** 接口调用成功的回调函数 */
  5971. success?: TakePhotoSuccessCallback
  5972. }
  5973. interface TakePhotoSuccessCallbackResult {
  5974. /** 照片文件的临时路径 (本地路径),安卓是jpg图片格式,ios是png */
  5975. tempImagePath: string
  5976. errMsg: string
  5977. }
  5978. /** 标签类型枚举 */
  5979. interface TechType {
  5980. /** 对应IsoDep实例,实例支持ISO-DEP (ISO 14443-4)标准的读写 */
  5981. isoDep: string
  5982. /** 对应MifareClassic实例,实例支持MIFARE Classic标签的读写 */
  5983. mifareClassic: string
  5984. /** 对应MifareUltralight实例,实例支持MIFARE Ultralight标签的读写 */
  5985. mifareUltralight: string
  5986. /** 对应Ndef实例,实例支持对NDEF格式的NFC标签上的NDEF数据的读写 */
  5987. ndef: string
  5988. /** 对应NfcA实例,实例支持NFC-A (ISO 14443-3A)标准的读写 */
  5989. nfcA: string
  5990. /** 对应NfcB实例,实例支持NFC-B (ISO 14443-3B)标准的读写 */
  5991. nfcB: string
  5992. /** 对应NfcF实例,实例支持NFC-F (JIS 6319-4)标准的读写 */
  5993. nfcF: string
  5994. /** 对应NfcV实例,实例支持NFC-V (ISO 15693)标准的读写 */
  5995. nfcV: string
  5996. }
  5997. interface TextMetrics {
  5998. /** 文本的宽度 */
  5999. width: number
  6000. }
  6001. interface ToScreenLocationOption {
  6002. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6003. complete?: ToScreenLocationCompleteCallback
  6004. /** 接口调用失败的回调函数 */
  6005. fail?: ToScreenLocationFailCallback
  6006. /** 接口调用成功的回调函数 */
  6007. success?: ToScreenLocationSuccessCallback
  6008. }
  6009. interface ToScreenLocationSuccessCallbackResult {
  6010. /** x 坐标值 */
  6011. x: number
  6012. /** y 坐标值 */
  6013. y: number
  6014. errMsg: string
  6015. }
  6016. interface ToggleTorchOption {
  6017. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6018. complete?: ToggleTorchCompleteCallback
  6019. /** 接口调用失败的回调函数 */
  6020. fail?: ToggleTorchFailCallback
  6021. /** 接口调用成功的回调函数 */
  6022. success?: ToggleTorchSuccessCallback
  6023. }
  6024. interface TransceiveOption {
  6025. /** 需要传递的二进制数据 */
  6026. data: ArrayBuffer
  6027. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6028. complete?: TransceiveCompleteCallback
  6029. /** 接口调用失败的回调函数 */
  6030. fail?: TransceiveFailCallback
  6031. /** 接口调用成功的回调函数 */
  6032. success?: TransceiveSuccessCallback
  6033. }
  6034. interface TransceiveSuccessCallbackResult {
  6035. data: ArrayBuffer
  6036. errMsg: string
  6037. }
  6038. interface TranslateMarkerOption {
  6039. /** 移动过程中是否自动旋转 marker */
  6040. autoRotate: boolean
  6041. /** 指定 marker 移动到的目标点 */
  6042. destination: DestinationOption
  6043. /** 指定 marker */
  6044. markerId: number
  6045. /** marker 的旋转角度 */
  6046. rotate: number
  6047. /** 动画结束回调函数 */
  6048. animationEnd?: (...args: any[]) => any
  6049. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6050. complete?: TranslateMarkerCompleteCallback
  6051. /** 动画持续时长,平移与旋转分别计算 */
  6052. duration?: number
  6053. /** 接口调用失败的回调函数 */
  6054. fail?: TranslateMarkerFailCallback
  6055. /** 平移和旋转同时进行
  6056. *
  6057. * 最低基础库: `2.13.0` */
  6058. moveWithRotate?: boolean
  6059. /** 接口调用成功的回调函数 */
  6060. success?: TranslateMarkerSuccessCallback
  6061. }
  6062. interface UDPSocketOnErrorCallbackResult {
  6063. /** 错误信息 */
  6064. errMsg: string
  6065. }
  6066. interface UDPSocketOnMessageCallbackResult {
  6067. /** 收到的消息 */
  6068. message: ArrayBuffer
  6069. /** 消息来源的结构化信息 */
  6070. remoteInfo: RemoteInfo
  6071. }
  6072. interface UDPSocketSendOption {
  6073. /** 要发消息的地址。在基础库 2.9.3 及之前版本可以是一个和本机同网段的 IP 地址,也可以是在安全域名列表内的域名地址;在基础库 2.9.4 及之后版本,可以是任意 IP 和域名 */
  6074. address: string
  6075. /** 要发送的数据 */
  6076. message: string | ArrayBuffer
  6077. /** 要发送消息的端口号 */
  6078. port: number
  6079. /** 发送数据的长度,仅当 message 为 ArrayBuffer 类型时有效 */
  6080. length?: number
  6081. /** 发送数据的偏移量,仅当 message 为 ArrayBuffer 类型时有效 */
  6082. offset?: number
  6083. }
  6084. interface UndoOption {
  6085. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6086. complete?: UndoCompleteCallback
  6087. /** 接口调用失败的回调函数 */
  6088. fail?: UndoFailCallback
  6089. /** 接口调用成功的回调函数 */
  6090. success?: UndoSuccessCallback
  6091. }
  6092. interface UnlinkFailCallbackResult {
  6093. /** 错误信息
  6094. *
  6095. * 可选值:
  6096. * - 'fail permission denied, open ${path}': 指定的 path 路径没有读权限;
  6097. * - 'fail no such file or directory ${path}': 文件不存在;
  6098. * - 'fail operation not permitted, unlink ${filePath}': 传入的 filePath 是一个目录;
  6099. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  6100. errMsg: string
  6101. }
  6102. interface UnlinkOption {
  6103. /** 要删除的文件路径 (本地路径) */
  6104. filePath: string
  6105. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6106. complete?: UnlinkCompleteCallback
  6107. /** 接口调用失败的回调函数 */
  6108. fail?: UnlinkFailCallback
  6109. /** 接口调用成功的回调函数 */
  6110. success?: UnlinkSuccessCallback
  6111. }
  6112. interface UnzipFailCallbackResult {
  6113. /** 错误信息
  6114. *
  6115. * 可选值:
  6116. * - 'fail permission denied, unzip ${zipFilePath} -> ${destPath}': 指定目标文件路径没有写权限;
  6117. * - 'fail no such file or directory, unzip ${zipFilePath} -> "${destPath}': 源文件不存在,或目标文件路径的上层目录不存在; */
  6118. errMsg: string
  6119. }
  6120. interface UnzipOption {
  6121. /** 目标目录路径, 支持本地路径 */
  6122. targetPath: string
  6123. /** 源文件路径,支持本地路径, 只可以是 zip 压缩文件 */
  6124. zipFilePath: string
  6125. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6126. complete?: UnzipCompleteCallback
  6127. /** 接口调用失败的回调函数 */
  6128. fail?: UnzipFailCallback
  6129. /** 接口调用成功的回调函数 */
  6130. success?: UnzipSuccessCallback
  6131. }
  6132. /** 参数列表 */
  6133. interface UpdatableMessageFrontEndParameter {
  6134. /** 参数名 */
  6135. name: string
  6136. /** 参数值 */
  6137. value: string
  6138. }
  6139. /** 动态消息的模板信息
  6140. *
  6141. * 最低基础库: `2.4.0` */
  6142. interface UpdatableMessageFrontEndTemplateInfo {
  6143. /** 参数列表 */
  6144. parameterList: UpdatableMessageFrontEndParameter[]
  6145. }
  6146. interface UpdateGroundOverlayOption {
  6147. /** 图片覆盖的经纬度范围 */
  6148. bounds: MapBounds
  6149. /** 图片图层 id */
  6150. id: string
  6151. /** 图片路径,支持网络图片、临时路径、代码包路径 */
  6152. src: string
  6153. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6154. complete?: UpdateGroundOverlayCompleteCallback
  6155. /** 接口调用失败的回调函数 */
  6156. fail?: UpdateGroundOverlayFailCallback
  6157. /** 图层透明度 */
  6158. opacity?: number
  6159. /** 接口调用成功的回调函数 */
  6160. success?: UpdateGroundOverlaySuccessCallback
  6161. /** 是否可见 */
  6162. visible?: boolean
  6163. /** 图层绘制顺序 */
  6164. zIndex?: number
  6165. }
  6166. interface UpdateShareMenuOption {
  6167. /** 动态消息的 activityId。通过 [updatableMessage.createActivityId](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/updatable-message/updatableMessage.createActivityId.html) 接口获取
  6168. *
  6169. * 最低基础库: `2.4.0` */
  6170. activityId?: string
  6171. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6172. complete?: UpdateShareMenuCompleteCallback
  6173. /** 接口调用失败的回调函数 */
  6174. fail?: UpdateShareMenuFailCallback
  6175. /** 是否是私密消息。详见 [小程序私密消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share/private-message.html)
  6176. *
  6177. * 最低基础库: `2.13.0` */
  6178. isPrivateMessage?: boolean
  6179. /** 是否是动态消息,详见[动态消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share/updatable-message.html)
  6180. *
  6181. * 最低基础库: `2.4.0` */
  6182. isUpdatableMessage?: boolean
  6183. /** 接口调用成功的回调函数 */
  6184. success?: UpdateShareMenuSuccessCallback
  6185. /** 动态消息的模板信息
  6186. *
  6187. * 最低基础库: `2.4.0` */
  6188. templateInfo?: UpdatableMessageFrontEndTemplateInfo
  6189. /** 群待办消息的id,通过toDoActivityId可以把多个群待办消息聚合为同一个。通过 [updatableMessage.createActivityId](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/updatable-message/updatableMessage.createActivityId.html) 接口获取。详见[群待办消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html)
  6190. *
  6191. * 最低基础库: `2.11.0` */
  6192. toDoActivityId?: string
  6193. /** 是否使用带 shareTicket 的转发[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
  6194. withShareTicket?: boolean
  6195. }
  6196. interface UpdateVoIPChatMuteConfigOption {
  6197. /** 静音设置 */
  6198. muteConfig: MuteConfig
  6199. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6200. complete?: UpdateVoIPChatMuteConfigCompleteCallback
  6201. /** 接口调用失败的回调函数 */
  6202. fail?: UpdateVoIPChatMuteConfigFailCallback
  6203. /** 接口调用成功的回调函数 */
  6204. success?: UpdateVoIPChatMuteConfigSuccessCallback
  6205. }
  6206. interface UpdateWeChatAppOption {
  6207. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6208. complete?: UpdateWeChatAppCompleteCallback
  6209. /** 接口调用失败的回调函数 */
  6210. fail?: UpdateWeChatAppFailCallback
  6211. /** 接口调用成功的回调函数 */
  6212. success?: UpdateWeChatAppSuccessCallback
  6213. }
  6214. interface UploadFileOption {
  6215. /** 要上传文件资源的路径 (本地路径) */
  6216. filePath: string
  6217. /** 文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容 */
  6218. name: string
  6219. /** 开发者服务器地址 */
  6220. url: string
  6221. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6222. complete?: UploadFileCompleteCallback
  6223. /** 接口调用失败的回调函数 */
  6224. fail?: UploadFileFailCallback
  6225. /** HTTP 请求中其他额外的 form data */
  6226. formData?: IAnyObject
  6227. /** HTTP 请求 Header,Header 中不能设置 Referer */
  6228. header?: IAnyObject
  6229. /** 接口调用成功的回调函数 */
  6230. success?: UploadFileSuccessCallback
  6231. /** 超时时间,单位为毫秒
  6232. *
  6233. * 最低基础库: `2.10.0` */
  6234. timeout?: number
  6235. }
  6236. interface UploadFileSuccessCallbackResult {
  6237. /** 开发者服务器返回的数据 */
  6238. data: string
  6239. /** 开发者服务器返回的 HTTP 状态码 */
  6240. statusCode: number
  6241. errMsg: string
  6242. }
  6243. interface UploadTaskOnProgressUpdateCallbackResult {
  6244. /** 上传进度百分比 */
  6245. progress: number
  6246. /** 预期需要上传的数据总长度,单位 Bytes */
  6247. totalBytesExpectedToSend: number
  6248. /** 已经上传的数据长度,单位 Bytes */
  6249. totalBytesSent: number
  6250. }
  6251. /** 用户信息 */
  6252. interface UserInfo {
  6253. /** 用户头像图片的 URL。URL 最后一个数值代表正方形头像大小(有 0、46、64、96、132 数值可选,0 代表 640x640 的正方形头像,46 表示 46x46 的正方形头像,剩余数值以此类推。默认132),用户没有头像时该项为空。若用户更换头像,原有头像 URL 将失效。 */
  6254. avatarUrl: string
  6255. /** 用户所在城市 */
  6256. city: string
  6257. /** 用户所在国家 */
  6258. country: string
  6259. /** 用户性别
  6260. *
  6261. * 可选值:
  6262. * - 0: 未知;
  6263. * - 1: 男性;
  6264. * - 2: 女性; */
  6265. gender: 0 | 1 | 2
  6266. /** 显示 country,province,city 所用的语言
  6267. *
  6268. * 可选值:
  6269. * - 'en': 英文;
  6270. * - 'zh_CN': 简体中文;
  6271. * - 'zh_TW': 繁体中文; */
  6272. language: 'en' | 'zh_CN' | 'zh_TW'
  6273. /** 用户昵称 */
  6274. nickName: string
  6275. /** 用户所在省份 */
  6276. province: string
  6277. }
  6278. interface VibrateLongOption {
  6279. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6280. complete?: VibrateLongCompleteCallback
  6281. /** 接口调用失败的回调函数 */
  6282. fail?: VibrateLongFailCallback
  6283. /** 接口调用成功的回调函数 */
  6284. success?: VibrateLongSuccessCallback
  6285. }
  6286. interface VibrateShortOption {
  6287. /** 震动强度类型,有效值为:heavy、medium、light
  6288. *
  6289. * 最低基础库: `2.13.0` */
  6290. type: string
  6291. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6292. complete?: VibrateShortCompleteCallback
  6293. /** 接口调用失败的回调函数 */
  6294. fail?: VibrateShortFailCallback
  6295. /** 接口调用成功的回调函数 */
  6296. success?: VibrateShortSuccessCallback
  6297. }
  6298. interface VideoContextRequestFullScreenOption {
  6299. /** 设置全屏时视频的方向,不指定则根据宽高比自动判断。
  6300. *
  6301. * 可选值:
  6302. * - 0: 正常竖向;
  6303. * - 90: 屏幕逆时针90度;
  6304. * - -90: 屏幕顺时针90度;
  6305. *
  6306. * 最低基础库: `1.7.0` */
  6307. direction?: 0 | 90 | -90
  6308. }
  6309. interface VideoDecoderStartOption {
  6310. /** 需要解码的视频源文件。基础库 2.13.0 以下的版本只支持本地路径。 2.13.0 开始支持 http:// 和 https:// 协议的远程路径。 */
  6311. source: string
  6312. /** 解码模式。0:按 pts 解码;1:以最快速度解码 */
  6313. mode?: number
  6314. }
  6315. /** 提供预设的 Wi-Fi 信息列表 */
  6316. interface WifiData {
  6317. /** Wi-Fi 的 BSSID */
  6318. BSSID?: string
  6319. /** Wi-Fi 的 SSID */
  6320. SSID?: string
  6321. /** Wi-Fi 设备密码 */
  6322. password?: string
  6323. }
  6324. /** Wifi 信息 */
  6325. interface WifiInfo {
  6326. /** Wi-Fi 的 BSSID */
  6327. BSSID: string
  6328. /** Wi-Fi 的 SSID */
  6329. SSID: string
  6330. /** Wi-Fi 频段单位 MHz
  6331. *
  6332. * 最低基础库: `2.12.0` */
  6333. frequency: number
  6334. /** Wi-Fi 是否安全 */
  6335. secure: boolean
  6336. /** Wi-Fi 信号强度 */
  6337. signalStrength: number
  6338. }
  6339. interface WorkerOnMessageCallbackResult {
  6340. /** 主线程/Worker 线程向当前线程发送的消息 */
  6341. message: IAnyObject
  6342. }
  6343. interface WriteBLECharacteristicValueOption {
  6344. /** 蓝牙特征值的 uuid */
  6345. characteristicId: string
  6346. /** 蓝牙设备 id */
  6347. deviceId: string
  6348. /** 蓝牙特征值对应服务的 uuid */
  6349. serviceId: string
  6350. /** 蓝牙设备特征值对应的二进制值 */
  6351. value: ArrayBuffer
  6352. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6353. complete?: WriteBLECharacteristicValueCompleteCallback
  6354. /** 接口调用失败的回调函数 */
  6355. fail?: WriteBLECharacteristicValueFailCallback
  6356. /** 接口调用成功的回调函数 */
  6357. success?: WriteBLECharacteristicValueSuccessCallback
  6358. }
  6359. interface WriteCharacteristicValueObject {
  6360. /** characteristic对应的uuid */
  6361. characteristicId: string
  6362. /** 是否需要通知主机value已更新 */
  6363. needNotify: boolean
  6364. /** service 的 uuid */
  6365. serviceId: string
  6366. /** 特征值对应的二进制值 */
  6367. value: ArrayBuffer
  6368. /** 可选,处理回包时使用 */
  6369. callbackId?: number
  6370. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6371. complete?: WriteCharacteristicValueCompleteCallback
  6372. /** 接口调用失败的回调函数 */
  6373. fail?: WriteCharacteristicValueFailCallback
  6374. /** 接口调用成功的回调函数 */
  6375. success?: WriteCharacteristicValueSuccessCallback
  6376. }
  6377. interface WriteFileFailCallbackResult {
  6378. /** 错误信息
  6379. *
  6380. * 可选值:
  6381. * - 'fail no such file or directory, open ${filePath}': 指定的 filePath 所在目录不存在;
  6382. * - 'fail permission denied, open ${dirPath}': 指定的 filePath 路径没有写权限;
  6383. * - 'fail the maximum size of the file storage limit is exceeded': 存储空间不足;
  6384. * - 'fail sdcard not mounted': Android sdcard 挂载失败; */
  6385. errMsg: string
  6386. }
  6387. interface WriteFileOption {
  6388. /** 要写入的文本或二进制数据 */
  6389. data: string | ArrayBuffer
  6390. /** 要写入的文件路径 (本地路径) */
  6391. filePath: string
  6392. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6393. complete?: WriteFileCompleteCallback
  6394. /** 指定写入文件的字符编码
  6395. *
  6396. * 可选值:
  6397. * - 'ascii': ;
  6398. * - 'base64': ;
  6399. * - 'binary': ;
  6400. * - 'hex': ;
  6401. * - 'ucs2': 以小端序读取;
  6402. * - 'ucs-2': 以小端序读取;
  6403. * - 'utf16le': 以小端序读取;
  6404. * - 'utf-16le': 以小端序读取;
  6405. * - 'utf-8': ;
  6406. * - 'utf8': ;
  6407. * - 'latin1': ; */
  6408. encoding?:
  6409. | 'ascii'
  6410. | 'base64'
  6411. | 'binary'
  6412. | 'hex'
  6413. | 'ucs2'
  6414. | 'ucs-2'
  6415. | 'utf16le'
  6416. | 'utf-16le'
  6417. | 'utf-8'
  6418. | 'utf8'
  6419. | 'latin1'
  6420. /** 接口调用失败的回调函数 */
  6421. fail?: WriteFileFailCallback
  6422. /** 接口调用成功的回调函数 */
  6423. success?: WriteFileSuccessCallback
  6424. }
  6425. interface WriteNdefMessageOption {
  6426. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6427. complete?: WriteNdefMessageCompleteCallback
  6428. /** 接口调用失败的回调函数 */
  6429. fail?: WriteNdefMessageFailCallback
  6430. /** 二进制对象数组, 需要指明 id, type 以及 payload (均为 ArrayBuffer 类型) */
  6431. records?: any[]
  6432. /** 接口调用成功的回调函数 */
  6433. success?: WriteNdefMessageSuccessCallback
  6434. /** text 数组 */
  6435. texts?: any[]
  6436. /** uri 数组 */
  6437. uris?: any[]
  6438. }
  6439. interface WxGetFileInfoOption {
  6440. /** 本地文件路径 (本地路径) */
  6441. filePath: string
  6442. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6443. complete?: GetFileInfoCompleteCallback
  6444. /** 计算文件摘要的算法
  6445. *
  6446. * 可选值:
  6447. * - 'md5': md5 算法;
  6448. * - 'sha1': sha1 算法; */
  6449. digestAlgorithm?: 'md5' | 'sha1'
  6450. /** 接口调用失败的回调函数 */
  6451. fail?: WxGetFileInfoFailCallback
  6452. /** 接口调用成功的回调函数 */
  6453. success?: WxGetFileInfoSuccessCallback
  6454. }
  6455. interface WxGetFileInfoSuccessCallbackResult {
  6456. /** 按照传入的 digestAlgorithm 计算得出的的文件摘要 */
  6457. digest: string
  6458. /** 文件大小,以字节为单位 */
  6459. size: number
  6460. errMsg: string
  6461. }
  6462. interface WxGetSavedFileListOption {
  6463. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6464. complete?: GetSavedFileListCompleteCallback
  6465. /** 接口调用失败的回调函数 */
  6466. fail?: GetSavedFileListFailCallback
  6467. /** 接口调用成功的回调函数 */
  6468. success?: WxGetSavedFileListSuccessCallback
  6469. }
  6470. interface WxGetSavedFileListSuccessCallbackResult {
  6471. /** 文件数组,每一项是一个 FileItem */
  6472. fileList: FileItem[]
  6473. errMsg: string
  6474. }
  6475. interface WxRemoveSavedFileOption {
  6476. /** 需要删除的文件路径 (本地路径) */
  6477. filePath: string
  6478. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6479. complete?: RemoveSavedFileCompleteCallback
  6480. /** 接口调用失败的回调函数 */
  6481. fail?: WxRemoveSavedFileFailCallback
  6482. /** 接口调用成功的回调函数 */
  6483. success?: RemoveSavedFileSuccessCallback
  6484. }
  6485. interface WxSaveFileOption {
  6486. /** 需要保存的文件的临时路径 (本地路径) */
  6487. tempFilePath: string
  6488. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6489. complete?: SaveFileCompleteCallback
  6490. /** 接口调用失败的回调函数 */
  6491. fail?: WxSaveFileFailCallback
  6492. /** 接口调用成功的回调函数 */
  6493. success?: SaveFileSuccessCallback
  6494. }
  6495. interface WxStartRecordOption {
  6496. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6497. complete?: StartRecordCompleteCallback
  6498. /** 接口调用失败的回调函数 */
  6499. fail?: StartRecordFailCallback
  6500. /** 接口调用成功的回调函数 */
  6501. success?: WxStartRecordSuccessCallback
  6502. }
  6503. interface WxStopRecordOption {
  6504. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6505. complete?: StopRecordCompleteCallback
  6506. /** 接口调用失败的回调函数 */
  6507. fail?: StopRecordFailCallback
  6508. /** 接口调用成功的回调函数 */
  6509. success?: WxStopRecordSuccessCallback
  6510. }
  6511. interface Animation {
  6512. /** [Object Animation.export()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.export.html)
  6513. *
  6514. * 导出动画队列。**export 方法每次调用后会清掉之前的动画操作。** */
  6515. export(): AnimationExportResult
  6516. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.backgroundColor(string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.backgroundColor.html)
  6517. *
  6518. * 设置背景色 */
  6519. backgroundColor(
  6520. /** 颜色值 */
  6521. value: string
  6522. ): Animation
  6523. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.bottom(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.bottom.html)
  6524. *
  6525. * 设置 bottom 值 */
  6526. bottom(
  6527. /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
  6528. value: number | string
  6529. ): Animation
  6530. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.height(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.height.html)
  6531. *
  6532. * 设置高度 */
  6533. height(
  6534. /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
  6535. value: number | string
  6536. ): Animation
  6537. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.left(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.left.html)
  6538. *
  6539. * 设置 left 值 */
  6540. left(
  6541. /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
  6542. value: number | string
  6543. ): Animation
  6544. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.matrix()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.matrix.html)
  6545. *
  6546. * 同 [transform-function matrix](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix) */
  6547. matrix(): Animation
  6548. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.matrix3d()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.matrix3d.html)
  6549. *
  6550. * 同 [transform-function matrix3d](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix3d) */
  6551. matrix3d(): Animation
  6552. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.opacity(number value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.opacity.html)
  6553. *
  6554. * 设置透明度 */
  6555. opacity(
  6556. /** 透明度,范围 0-1 */
  6557. value: number
  6558. ): Animation
  6559. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.right(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.right.html)
  6560. *
  6561. * 设置 right 值 */
  6562. right(
  6563. /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
  6564. value: number | string
  6565. ): Animation
  6566. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotate(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotate.html)
  6567. *
  6568. * 从原点顺时针旋转一个角度 */
  6569. rotate(
  6570. /** 旋转的角度。范围 [-180, 180] */
  6571. angle: number
  6572. ): Animation
  6573. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotate3d(number x, number y, number z, number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotate3d.html)
  6574. *
  6575. * 从 固定 轴顺时针旋转一个角度 */
  6576. rotate3d(
  6577. /** 旋转轴的 x 坐标 */
  6578. x: number,
  6579. /** 旋转轴的 y 坐标 */
  6580. y: number,
  6581. /** 旋转轴的 z 坐标 */
  6582. z: number,
  6583. /** 旋转的角度。范围 [-180, 180] */
  6584. angle: number
  6585. ): Animation
  6586. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotateX(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotateX.html)
  6587. *
  6588. * 从 X 轴顺时针旋转一个角度 */
  6589. rotateX(
  6590. /** 旋转的角度。范围 [-180, 180] */
  6591. angle: number
  6592. ): Animation
  6593. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotateY(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotateY.html)
  6594. *
  6595. * 从 Y 轴顺时针旋转一个角度 */
  6596. rotateY(
  6597. /** 旋转的角度。范围 [-180, 180] */
  6598. angle: number
  6599. ): Animation
  6600. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.rotateZ(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.rotateZ.html)
  6601. *
  6602. * 从 Z 轴顺时针旋转一个角度 */
  6603. rotateZ(
  6604. /** 旋转的角度。范围 [-180, 180] */
  6605. angle: number
  6606. ): Animation
  6607. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scale(number sx, number sy)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scale.html)
  6608. *
  6609. * 缩放 */
  6610. scale(
  6611. /** 当仅有 sx 参数时,表示在 X 轴、Y 轴同时缩放sx倍数 */
  6612. sx: number,
  6613. /** 在 Y 轴缩放 sy 倍数 */
  6614. sy?: number
  6615. ): Animation
  6616. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scale3d(number sx, number sy, number sz)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scale3d.html)
  6617. *
  6618. * 缩放 */
  6619. scale3d(
  6620. /** x 轴的缩放倍数 */
  6621. sx: number,
  6622. /** y 轴的缩放倍数 */
  6623. sy: number,
  6624. /** z 轴的缩放倍数 */
  6625. sz: number
  6626. ): Animation
  6627. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scaleX(number scale)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scaleX.html)
  6628. *
  6629. * 缩放 X 轴 */
  6630. scaleX(
  6631. /** X 轴的缩放倍数 */
  6632. scale: number
  6633. ): Animation
  6634. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scaleY(number scale)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scaleY.html)
  6635. *
  6636. * 缩放 Y 轴 */
  6637. scaleY(
  6638. /** Y 轴的缩放倍数 */
  6639. scale: number
  6640. ): Animation
  6641. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.scaleZ(number scale)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.scaleZ.html)
  6642. *
  6643. * 缩放 Z 轴 */
  6644. scaleZ(
  6645. /** Z 轴的缩放倍数 */
  6646. scale: number
  6647. ): Animation
  6648. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.skew(number ax, number ay)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.skew.html)
  6649. *
  6650. * 对 X、Y 轴坐标进行倾斜 */
  6651. skew(
  6652. /** 对 X 轴坐标倾斜的角度,范围 [-180, 180] */
  6653. ax: number,
  6654. /** 对 Y 轴坐标倾斜的角度,范围 [-180, 180] */
  6655. ay: number
  6656. ): Animation
  6657. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.skewX(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.skewX.html)
  6658. *
  6659. * 对 X 轴坐标进行倾斜 */
  6660. skewX(
  6661. /** 倾斜的角度,范围 [-180, 180] */
  6662. angle: number
  6663. ): Animation
  6664. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.skewY(number angle)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.skewY.html)
  6665. *
  6666. * 对 Y 轴坐标进行倾斜 */
  6667. skewY(
  6668. /** 倾斜的角度,范围 [-180, 180] */
  6669. angle: number
  6670. ): Animation
  6671. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.step(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.step.html)
  6672. *
  6673. * 表示一组动画完成。可以在一组动画中调用任意多个动画方法,一组动画中的所有动画会同时开始,一组动画完成后才会进行下一组动画。 */
  6674. step(option?: StepOption): Animation
  6675. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.top(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.top.html)
  6676. *
  6677. * 设置 top 值 */
  6678. top(
  6679. /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
  6680. value: number | string
  6681. ): Animation
  6682. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translate(number tx, number ty)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translate.html)
  6683. *
  6684. * 平移变换 */
  6685. translate(
  6686. /** 当仅有该参数时表示在 X 轴偏移 tx,单位 px */
  6687. tx?: number,
  6688. /** 在 Y 轴平移的距离,单位为 px */
  6689. ty?: number
  6690. ): Animation
  6691. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translate3d(number tx, number ty, number tz)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translate3d.html)
  6692. *
  6693. * 对 xyz 坐标进行平移变换 */
  6694. translate3d(
  6695. /** 在 X 轴平移的距离,单位为 px */
  6696. tx?: number,
  6697. /** 在 Y 轴平移的距离,单位为 px */
  6698. ty?: number,
  6699. /** 在 Z 轴平移的距离,单位为 px */
  6700. tz?: number
  6701. ): Animation
  6702. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translateX(number translation)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translateX.html)
  6703. *
  6704. * 对 X 轴平移 */
  6705. translateX(
  6706. /** 在 X 轴平移的距离,单位为 px */
  6707. translation: number
  6708. ): Animation
  6709. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translateY(number translation)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translateY.html)
  6710. *
  6711. * 对 Y 轴平移 */
  6712. translateY(
  6713. /** 在 Y 轴平移的距离,单位为 px */
  6714. translation: number
  6715. ): Animation
  6716. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.translateZ(number translation)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.translateZ.html)
  6717. *
  6718. * 对 Z 轴平移 */
  6719. translateZ(
  6720. /** 在 Z 轴平移的距离,单位为 px */
  6721. translation: number
  6722. ): Animation
  6723. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) Animation.width(number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.width.html)
  6724. *
  6725. * 设置宽度 */
  6726. width(
  6727. /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
  6728. value: number | string
  6729. ): Animation
  6730. }
  6731. interface AudioContext {
  6732. /** [AudioContext.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.pause.html)
  6733. *
  6734. * 暂停音频。 */
  6735. pause(): void
  6736. /** [AudioContext.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.play.html)
  6737. *
  6738. * 播放音频。 */
  6739. play(): void
  6740. /** [AudioContext.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.seek.html)
  6741. *
  6742. * 跳转到指定位置。 */
  6743. seek(
  6744. /** 跳转位置,单位 s */
  6745. position: number
  6746. ): void
  6747. /** [AudioContext.setSrc(string src)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.setSrc.html)
  6748. *
  6749. * 设置音频地址 */
  6750. setSrc(
  6751. /** 音频地址 */
  6752. src: string
  6753. ): void
  6754. }
  6755. interface BLEPeripheralServer {
  6756. /** [BLEPeripheralServer.addService(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.addService.html)
  6757. *
  6758. * 添加服务。
  6759. *
  6760. * 最低基础库: `2.10.3` */
  6761. addService(option: AddServiceOption): void
  6762. /** [BLEPeripheralServer.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.close.html)
  6763. *
  6764. * 关闭当前服务端。
  6765. *
  6766. * 最低基础库: `2.10.3` */
  6767. close(option?: BLEPeripheralServerCloseOption): void
  6768. /** [BLEPeripheralServer.offCharacteristicReadRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicReadRequest.html)
  6769. *
  6770. * 取消监听已连接的设备请求读当前外围设备的特征值事件
  6771. *
  6772. * 最低基础库: `2.10.3` */
  6773. offCharacteristicReadRequest(
  6774. /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */
  6775. callback?: OffCharacteristicReadRequestCallback
  6776. ): void
  6777. /** [BLEPeripheralServer.offCharacteristicSubscribed(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicSubscribed.html)
  6778. *
  6779. * 取消监听特征值订阅事件
  6780. *
  6781. * 最低基础库: `2.13.0` */
  6782. offCharacteristicSubscribed(
  6783. /** 特征值订阅事件的回调函数 */
  6784. callback?: OffCharacteristicSubscribedCallback
  6785. ): void
  6786. /** [BLEPeripheralServer.offCharacteristicUnsubscribed(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicUnsubscribed.html)
  6787. *
  6788. * 取消监听取消特征值订阅事件
  6789. *
  6790. * 最低基础库: `2.13.0` */
  6791. offCharacteristicUnsubscribed(
  6792. /** 取消特征值订阅事件的回调函数 */
  6793. callback?: OffCharacteristicUnsubscribedCallback
  6794. ): void
  6795. /** [BLEPeripheralServer.offCharacteristicWriteRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicWriteRequest.html)
  6796. *
  6797. * 取消监听已连接的设备请求写当前外围设备的特征值事件
  6798. *
  6799. * 最低基础库: `2.10.3` */
  6800. offCharacteristicWriteRequest(
  6801. /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */
  6802. callback?: OffCharacteristicWriteRequestCallback
  6803. ): void
  6804. /** [BLEPeripheralServer.onCharacteristicReadRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicReadRequest.html)
  6805. *
  6806. * 监听已连接的设备请求读当前外围设备的特征值事件。收到该消息后需要立刻调用 `writeCharacteristicValue` 写回数据,否则主机不会收到响应。
  6807. *
  6808. * 最低基础库: `2.10.3` */
  6809. onCharacteristicReadRequest(
  6810. /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */
  6811. callback: OnCharacteristicReadRequestCallback
  6812. ): void
  6813. /** [BLEPeripheralServer.onCharacteristicSubscribed(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicSubscribed.html)
  6814. *
  6815. * 监听特征值订阅事件,仅 iOS 支持。
  6816. *
  6817. * 最低基础库: `2.13.0` */
  6818. onCharacteristicSubscribed(
  6819. /** 特征值订阅事件的回调函数 */
  6820. callback: OnCharacteristicSubscribedCallback
  6821. ): void
  6822. /** [BLEPeripheralServer.onCharacteristicUnsubscribed(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicUnsubscribed.html)
  6823. *
  6824. * 监听取消特征值订阅事件,仅 iOS 支持。
  6825. *
  6826. * 最低基础库: `2.13.0` */
  6827. onCharacteristicUnsubscribed(
  6828. /** 取消特征值订阅事件的回调函数 */
  6829. callback: OnCharacteristicUnsubscribedCallback
  6830. ): void
  6831. /** [BLEPeripheralServer.onCharacteristicWriteRequest(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicWriteRequest.html)
  6832. *
  6833. * 监听已连接的设备请求写当前外围设备的特征值事件。收到该消息后需要立刻调用 `writeCharacteristicValue` 写回数据,否则主机不会收到响应。
  6834. *
  6835. * 最低基础库: `2.10.3` */
  6836. onCharacteristicWriteRequest(
  6837. /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */
  6838. callback: OnCharacteristicWriteRequestCallback
  6839. ): void
  6840. /** [BLEPeripheralServer.removeService(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.removeService.html)
  6841. *
  6842. * 移除服务。
  6843. *
  6844. * 最低基础库: `2.10.3` */
  6845. removeService(option: RemoveServiceOption): void
  6846. /** [BLEPeripheralServer.startAdvertising(Object Object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.startAdvertising.html)
  6847. *
  6848. * 开始广播本地创建的外围设备。
  6849. *
  6850. * 最低基础库: `2.10.3` */
  6851. startAdvertising(Object: StartAdvertisingObject): void
  6852. /** [BLEPeripheralServer.stopAdvertising(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.stopAdvertising.html)
  6853. *
  6854. * 停止广播。
  6855. *
  6856. * 最低基础库: `2.10.3` */
  6857. stopAdvertising(option?: StopAdvertisingOption): void
  6858. /** [BLEPeripheralServer.writeCharacteristicValue(Object Object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html)
  6859. *
  6860. * 往指定特征值写入数据,并通知已连接的主机,从机的特征值已发生变化,该接口会处理是走回包还是走订阅。
  6861. *
  6862. * 最低基础库: `2.10.3` */
  6863. writeCharacteristicValue(Object: WriteCharacteristicValueObject): void
  6864. }
  6865. interface BackgroundAudioError {
  6866. /** 错误信息
  6867. *
  6868. * | 错误码 | 错误信息 | 说明 |
  6869. * | - | - | - |
  6870. * | 10001 | | 系统错误 |
  6871. * | 10002 | | 网络错误 |
  6872. * | 10003 | | 文件错误,请检查是否responseheader是否缺少Content-Length |
  6873. * | 10004 | | 格式错误 |
  6874. * | -1 | | 未知错误 | */ errMsg: string
  6875. /** 错误码
  6876. *
  6877. * | 错误码 | 错误信息 | 说明 |
  6878. * | - | - | - |
  6879. * | 10001 | | 系统错误 |
  6880. * | 10002 | | 网络错误 |
  6881. * | 10003 | | 文件错误,请检查是否responseheader是否缺少Content-Length |
  6882. * | 10004 | | 格式错误 |
  6883. * | -1 | | 未知错误 | */ errCode: number
  6884. }
  6885. interface BackgroundAudioManager {
  6886. /** [BackgroundAudioManager.onCanplay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onCanplay.html)
  6887. *
  6888. * 监听背景音频进入可播放状态事件。 但不保证后面可以流畅播放 */
  6889. onCanplay(
  6890. /** 背景音频进入可播放状态事件的回调函数 */
  6891. callback: OnCanplayCallback
  6892. ): void
  6893. /** [BackgroundAudioManager.onEnded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onEnded.html)
  6894. *
  6895. * 监听背景音频自然播放结束事件 */
  6896. onEnded(
  6897. /** 背景音频自然播放结束事件的回调函数 */
  6898. callback: OnEndedCallback
  6899. ): void
  6900. /** [BackgroundAudioManager.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onError.html)
  6901. *
  6902. * 监听背景音频播放错误事件 */
  6903. onError(
  6904. /** 背景音频播放错误事件的回调函数 */
  6905. callback: BackgroundAudioManagerOnErrorCallback
  6906. ): void
  6907. /** [BackgroundAudioManager.onNext(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onNext.html)
  6908. *
  6909. * 监听用户在系统音乐播放面板点击下一曲事件(仅iOS) */
  6910. onNext(
  6911. /** 用户在系统音乐播放面板点击下一曲事件的回调函数 */
  6912. callback: OnNextCallback
  6913. ): void
  6914. /** [BackgroundAudioManager.onPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPause.html)
  6915. *
  6916. * 监听背景音频暂停事件 */
  6917. onPause(
  6918. /** 背景音频暂停事件的回调函数 */
  6919. callback: OnPauseCallback
  6920. ): void
  6921. /** [BackgroundAudioManager.onPlay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPlay.html)
  6922. *
  6923. * 监听背景音频播放事件 */
  6924. onPlay(
  6925. /** 背景音频播放事件的回调函数 */
  6926. callback: OnPlayCallback
  6927. ): void
  6928. /** [BackgroundAudioManager.onPrev(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPrev.html)
  6929. *
  6930. * 监听用户在系统音乐播放面板点击上一曲事件(仅iOS) */
  6931. onPrev(
  6932. /** 用户在系统音乐播放面板点击上一曲事件的回调函数 */
  6933. callback: OnPrevCallback
  6934. ): void
  6935. /** [BackgroundAudioManager.onSeeked(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onSeeked.html)
  6936. *
  6937. * 监听背景音频完成跳转操作事件 */
  6938. onSeeked(
  6939. /** 背景音频完成跳转操作事件的回调函数 */
  6940. callback: OnSeekedCallback
  6941. ): void
  6942. /** [BackgroundAudioManager.onSeeking(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onSeeking.html)
  6943. *
  6944. * 监听背景音频开始跳转操作事件 */
  6945. onSeeking(
  6946. /** 背景音频开始跳转操作事件的回调函数 */
  6947. callback: OnSeekingCallback
  6948. ): void
  6949. /** [BackgroundAudioManager.onStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onStop.html)
  6950. *
  6951. * 监听背景音频停止事件 */
  6952. onStop(
  6953. /** 背景音频停止事件的回调函数 */
  6954. callback: InnerAudioContextOnStopCallback
  6955. ): void
  6956. /** [BackgroundAudioManager.onTimeUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onTimeUpdate.html)
  6957. *
  6958. * 监听背景音频播放进度更新事件,只有小程序在前台时会回调。 */
  6959. onTimeUpdate(
  6960. /** 背景音频播放进度更新事件的回调函数 */
  6961. callback: OnTimeUpdateCallback
  6962. ): void
  6963. /** [BackgroundAudioManager.onWaiting(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onWaiting.html)
  6964. *
  6965. * 监听音频加载中事件。当音频因为数据不足,需要停下来加载时会触发 */
  6966. onWaiting(
  6967. /** 音频加载中事件的回调函数 */
  6968. callback: OnWaitingCallback
  6969. ): void
  6970. /** [BackgroundAudioManager.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.pause.html)
  6971. *
  6972. * 暂停音乐 */
  6973. pause(): void
  6974. /** [BackgroundAudioManager.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.play.html)
  6975. *
  6976. * 播放音乐 */
  6977. play(): void
  6978. /** [BackgroundAudioManager.seek(number currentTime)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.seek.html)
  6979. *
  6980. * 跳转到指定位置 */
  6981. seek(
  6982. /** 跳转的位置,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */
  6983. currentTime: number
  6984. ): void
  6985. /** [BackgroundAudioManager.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.stop.html)
  6986. *
  6987. * 停止音乐 */
  6988. stop(): void
  6989. }
  6990. interface BluetoothError {
  6991. /** 错误信息
  6992. *
  6993. * | 错误码 | 错误信息 | 说明 |
  6994. * | - | - | - |
  6995. * | 0 | ok | 正常 |
  6996. * | -1 | already connet | 已连接 |
  6997. * | 10000 | not init | 未初始化蓝牙适配器 |
  6998. * | 10001 | not available | 当前蓝牙适配器不可用 |
  6999. * | 10002 | no device | 没有找到指定设备 |
  7000. * | 10003 | connection fail | 连接失败 |
  7001. * | 10004 | no service | 没有找到指定服务 |
  7002. * | 10005 | no characteristic | 没有找到指定特征值 |
  7003. * | 10006 | no connection | 当前连接已断开 |
  7004. * | 10007 | property not support | 当前特征值不支持此操作 |
  7005. * | 10008 | system error | 其余所有系统上报的异常 |
  7006. * | 10009 | system not support | Android 系统特有,系统版本低于 4.3 不支持 BLE |
  7007. * | 10012 | operate time out | 连接超时 |
  7008. * | 10013 | invalid_data | 连接 deviceId 为空或者是格式不正确 | */ errMsg: string
  7009. /** 错误码
  7010. *
  7011. * | 错误码 | 错误信息 | 说明 |
  7012. * | - | - | - |
  7013. * | 0 | ok | 正常 |
  7014. * | -1 | already connet | 已连接 |
  7015. * | 10000 | not init | 未初始化蓝牙适配器 |
  7016. * | 10001 | not available | 当前蓝牙适配器不可用 |
  7017. * | 10002 | no device | 没有找到指定设备 |
  7018. * | 10003 | connection fail | 连接失败 |
  7019. * | 10004 | no service | 没有找到指定服务 |
  7020. * | 10005 | no characteristic | 没有找到指定特征值 |
  7021. * | 10006 | no connection | 当前连接已断开 |
  7022. * | 10007 | property not support | 当前特征值不支持此操作 |
  7023. * | 10008 | system error | 其余所有系统上报的异常 |
  7024. * | 10009 | system not support | Android 系统特有,系统版本低于 4.3 不支持 BLE |
  7025. * | 10012 | operate time out | 连接超时 |
  7026. * | 10013 | invalid_data | 连接 deviceId 为空或者是格式不正确 | */ errCode: number
  7027. }
  7028. interface CameraContext {
  7029. /** [CameraContext.setZoom(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.setZoom.html)
  7030. *
  7031. * 设置缩放级别
  7032. *
  7033. * 最低基础库: `2.10.0` */
  7034. setZoom(option: SetZoomOption): void
  7035. /** [CameraContext.startRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.startRecord.html)
  7036. *
  7037. * 开始录像 */
  7038. startRecord(option: CameraContextStartRecordOption): void
  7039. /** [CameraContext.stopRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.stopRecord.html)
  7040. *
  7041. * 结束录像 */
  7042. stopRecord(option: CameraContextStopRecordOption): void
  7043. /** [CameraContext.takePhoto(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.takePhoto.html)
  7044. *
  7045. * 拍摄照片 */
  7046. takePhoto(option: TakePhotoOption): void
  7047. /** [[CameraFrameListener](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.html) CameraContext.onCameraFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.onCameraFrame.html)
  7048. *
  7049. * 获取 Camera 实时帧数据
  7050. *
  7051. * ****
  7052. *
  7053. * 注: 使用该接口需同时在 [camera](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html) 组件属性中指定 frame-size。
  7054. *
  7055. * **示例代码**
  7056. *
  7057. *
  7058. * ```js
  7059. const context = wx.createCameraContext()
  7060. const listener = context.onCameraFrame((frame) => {
  7061. console.log(frame.data instanceof ArrayBuffer, frame.width, frame.height)
  7062. })
  7063. listener.start()
  7064. ```
  7065. *
  7066. * 最低基础库: `2.7.0` */
  7067. onCameraFrame(
  7068. /** 回调函数 */
  7069. callback: OnCameraFrameCallback
  7070. ): CameraFrameListener
  7071. }
  7072. interface CameraFrameListener {
  7073. /** [CameraFrameListener.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.start.html)
  7074. *
  7075. * 开始监听帧数据 */
  7076. start(option?: CameraFrameListenerStartOption): void
  7077. /** [CameraFrameListener.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.stop.html)
  7078. *
  7079. * 停止监听帧数据 */
  7080. stop(option?: StopOption): void
  7081. }
  7082. interface Canvas {
  7083. /** [Canvas.cancelAnimationFrame(number requestID)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.cancelAnimationFrame.html)
  7084. *
  7085. * 取消由 requestAnimationFrame 添加到计划中的动画帧请求。支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。
  7086. *
  7087. * 最低基础库: `2.7.0` */
  7088. cancelAnimationFrame(requestID: number): void
  7089. /** [[ImageData](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/ImageData.html) Canvas.createImageData()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createImageData.html)
  7090. *
  7091. * 创建一个 ImageData 对象。仅支持在 2D Canvas 中使用。
  7092. *
  7093. * 最低基础库: `2.9.0` */
  7094. createImageData(): ImageData
  7095. /** [[Image](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Image.html) Canvas.createImage()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createImage.html)
  7096. *
  7097. * 创建一个图片对象。 支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。
  7098. *
  7099. * 最低基础库: `2.7.0` */
  7100. createImage(): Image
  7101. /** [[Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) Canvas.createPath2D([Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) path)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.createPath2D.html)
  7102. *
  7103. * 创建 Path2D 对象
  7104. *
  7105. * 最低基础库: `2.11.0` */
  7106. createPath2D(
  7107. /** [Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html)
  7108. *
  7109. * */
  7110. path: Path2D
  7111. ): Path2D
  7112. /** [[RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) Canvas.getContext(string contextType)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.getContext.html)
  7113. *
  7114. * 该方法返回 Canvas 的绘图上下文
  7115. *
  7116. * ****
  7117. *
  7118. * 支持获取 2D 和 WebGL 绘图上下文
  7119. *
  7120. * 最低基础库: `2.7.0` */
  7121. getContext(contextType: string): any
  7122. /** [number Canvas.requestAnimationFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.requestAnimationFrame.html)
  7123. *
  7124. * 在下次进行重绘时执行。 支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。
  7125. *
  7126. * 最低基础库: `2.7.0` */
  7127. requestAnimationFrame(
  7128. /** 执行的 callback */
  7129. callback: (...args: any[]) => any
  7130. ): number
  7131. /** [string Canvas.toDataURL(string type, number encoderOptions)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.toDataURL.html)
  7132. *
  7133. * 返回一个包含图片展示的 data URI 。可以使用 type 参数其类型,默认为 PNG 格式。
  7134. *
  7135. * 最低基础库: `2.11.0` */
  7136. toDataURL(
  7137. /** 图片格式,默认为 image/png */
  7138. type: string,
  7139. /** 在指定图片格式为 image/jpeg 或 image/webp的情况下,可以从 0 到 1 的区间内选择图片的质量。如果超出取值范围,将会使用默认值 0.92。其他参数会被忽略。 */
  7140. encoderOptions: number
  7141. ): string
  7142. }
  7143. interface CanvasContext {
  7144. /** [CanvasContext.arc(number x, number y, number r, number sAngle, number eAngle, boolean counterclockwise)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.arc.html)
  7145. *
  7146. * 创建一条弧线。
  7147. *
  7148. * - 创建一个圆可以指定起始弧度为 0,终止弧度为 2 * Math.PI。
  7149. * - 用 `stroke` 或者 `fill` 方法来在 `canvas` 中画弧线。
  7150. *
  7151. * **示例代码**
  7152. *
  7153. *
  7154. * ```javascript
  7155. const ctx = wx.createCanvasContext('myCanvas')
  7156. // Draw coordinates
  7157. ctx.arc(100, 75, 50, 0, 2 * Math.PI)
  7158. ctx.setFillStyle('#EEEEEE')
  7159. ctx.fill()
  7160. ctx.beginPath()
  7161. ctx.moveTo(40, 75)
  7162. ctx.lineTo(160, 75)
  7163. ctx.moveTo(100, 15)
  7164. ctx.lineTo(100, 135)
  7165. ctx.setStrokeStyle('#AAAAAA')
  7166. ctx.stroke()
  7167. ctx.setFontSize(12)
  7168. ctx.setFillStyle('black')
  7169. ctx.fillText('0', 165, 78)
  7170. ctx.fillText('0.5*PI', 83, 145)
  7171. ctx.fillText('1*PI', 15, 78)
  7172. ctx.fillText('1.5*PI', 83, 10)
  7173. // Draw points
  7174. ctx.beginPath()
  7175. ctx.arc(100, 75, 2, 0, 2 * Math.PI)
  7176. ctx.setFillStyle('lightgreen')
  7177. ctx.fill()
  7178. ctx.beginPath()
  7179. ctx.arc(100, 25, 2, 0, 2 * Math.PI)
  7180. ctx.setFillStyle('blue')
  7181. ctx.fill()
  7182. ctx.beginPath()
  7183. ctx.arc(150, 75, 2, 0, 2 * Math.PI)
  7184. ctx.setFillStyle('red')
  7185. ctx.fill()
  7186. // Draw arc
  7187. ctx.beginPath()
  7188. ctx.arc(100, 75, 50, 0, 1.5 * Math.PI)
  7189. ctx.setStrokeStyle('#333333')
  7190. ctx.stroke()
  7191. ctx.draw()
  7192. ```
  7193. *
  7194. * ![](@program/dev/image/canvas/arc.png)
  7195. *
  7196. * 针对 arc(100, 75, 50, 0, 1.5 * Math.PI)的三个关键坐标如下:
  7197. *
  7198. * - 绿色: 圆心 (100, 75)
  7199. * - 红色: 起始弧度 (0)
  7200. * - 蓝色: 终止弧度 (1.5 * Math.PI) */
  7201. arc(
  7202. /** 圆心的 x 坐标 */
  7203. x: number,
  7204. /** 圆心的 y 坐标 */
  7205. y: number,
  7206. /** 圆的半径 */
  7207. r: number,
  7208. /** 起始弧度,单位弧度(在3点钟方向) */
  7209. sAngle: number,
  7210. /** 终止弧度 */
  7211. eAngle: number,
  7212. /** 弧度的方向是否是逆时针 */
  7213. counterclockwise?: boolean
  7214. ): void
  7215. /** [CanvasContext.arcTo(number x1, number y1, number x2, number y2, number radius)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.arcTo.html)
  7216. *
  7217. * 根据控制点和半径绘制圆弧路径。
  7218. *
  7219. * 最低基础库: `1.9.90` */
  7220. arcTo(
  7221. /** 第一个控制点的 x 轴坐标 */
  7222. x1: number,
  7223. /** 第一个控制点的 y 轴坐标 */
  7224. y1: number,
  7225. /** 第二个控制点的 x 轴坐标 */
  7226. x2: number,
  7227. /** 第二个控制点的 y 轴坐标 */
  7228. y2: number,
  7229. /** 圆弧的半径 */
  7230. radius: number
  7231. ): void
  7232. /** [CanvasContext.beginPath()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.beginPath.html)
  7233. *
  7234. * 开始创建一个路径。需要调用 `fill` 或者 `stroke` 才会使用路径进行填充或描边
  7235. *
  7236. * - 在最开始的时候相当于调用了一次 `beginPath`。
  7237. * - 同一个路径内的多次 `setFillStyle`、`setStrokeStyle`、`setLineWidth`等设置,以最后一次设置为准。
  7238. *
  7239. * **示例代码**
  7240. *
  7241. *
  7242. * ```javascript
  7243. const ctx = wx.createCanvasContext('myCanvas')
  7244. // begin path
  7245. ctx.rect(10, 10, 100, 30)
  7246. ctx.setFillStyle('yellow')
  7247. ctx.fill()
  7248. // begin another path
  7249. ctx.beginPath()
  7250. ctx.rect(10, 40, 100, 30)
  7251. // only fill this rect, not in current path
  7252. ctx.setFillStyle('blue')
  7253. ctx.fillRect(10, 70, 100, 30)
  7254. ctx.rect(10, 100, 100, 30)
  7255. // it will fill current path
  7256. ctx.setFillStyle('red')
  7257. ctx.fill()
  7258. ctx.draw()
  7259. ```
  7260. *
  7261. * ![](@program/dev/image/canvas/fill-path.png) */
  7262. beginPath(): void
  7263. /** [CanvasContext.bezierCurveTo(number cp1x, number cp1y, number cp2x, number cp2y, number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.bezierCurveTo.html)
  7264. *
  7265. * 创建三次方贝塞尔曲线路径。曲线的起始点为路径中前一个点。
  7266. *
  7267. * **示例代码**
  7268. *
  7269. *
  7270. * ```javascript
  7271. const ctx = wx.createCanvasContext('myCanvas')
  7272. // Draw points
  7273. ctx.beginPath()
  7274. ctx.arc(20, 20, 2, 0, 2 * Math.PI)
  7275. ctx.setFillStyle('red')
  7276. ctx.fill()
  7277. ctx.beginPath()
  7278. ctx.arc(200, 20, 2, 0, 2 * Math.PI)
  7279. ctx.setFillStyle('lightgreen')
  7280. ctx.fill()
  7281. ctx.beginPath()
  7282. ctx.arc(20, 100, 2, 0, 2 * Math.PI)
  7283. ctx.arc(200, 100, 2, 0, 2 * Math.PI)
  7284. ctx.setFillStyle('blue')
  7285. ctx.fill()
  7286. ctx.setFillStyle('black')
  7287. ctx.setFontSize(12)
  7288. // Draw guides
  7289. ctx.beginPath()
  7290. ctx.moveTo(20, 20)
  7291. ctx.lineTo(20, 100)
  7292. ctx.lineTo(150, 75)
  7293. ctx.moveTo(200, 20)
  7294. ctx.lineTo(200, 100)
  7295. ctx.lineTo(70, 75)
  7296. ctx.setStrokeStyle('#AAAAAA')
  7297. ctx.stroke()
  7298. // Draw quadratic curve
  7299. ctx.beginPath()
  7300. ctx.moveTo(20, 20)
  7301. ctx.bezierCurveTo(20, 100, 200, 100, 200, 20)
  7302. ctx.setStrokeStyle('black')
  7303. ctx.stroke()
  7304. ctx.draw()
  7305. ```
  7306. *
  7307. * ![](@program/dev/image/canvas/bezier-curve.png)
  7308. *
  7309. * 针对 moveTo(20, 20) bezierCurveTo(20, 100, 200, 100, 200, 20) 的三个关键坐标如下:
  7310. *
  7311. * - 红色:起始点(20, 20)
  7312. * - 蓝色:两个控制点(20, 100) (200, 100)
  7313. * - 绿色:终止点(200, 20) */
  7314. bezierCurveTo(
  7315. /** 第一个贝塞尔控制点的 x 坐标 */
  7316. cp1x: number,
  7317. /** 第一个贝塞尔控制点的 y 坐标 */
  7318. cp1y: number,
  7319. /** 第二个贝塞尔控制点的 x 坐标 */
  7320. cp2x: number,
  7321. /** 第二个贝塞尔控制点的 y 坐标 */
  7322. cp2y: number,
  7323. /** 结束点的 x 坐标 */
  7324. x: number,
  7325. /** 结束点的 y 坐标 */
  7326. y: number
  7327. ): void
  7328. /** [CanvasContext.clearRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.clearRect.html)
  7329. *
  7330. * 清除画布上在该矩形区域内的内容
  7331. *
  7332. * **示例代码**
  7333. *
  7334. *
  7335. * clearRect 并非画一个白色的矩形在地址区域,而是清空,为了有直观感受,对 canvas 加了一层背景色。
  7336. * ```html
  7337. * <canvas canvas-id="myCanvas" style="border: 1px solid; background: #123456;"/>
  7338. * ```
  7339. * ```javascript
  7340. const ctx = wx.createCanvasContext('myCanvas')
  7341. ctx.setFillStyle('red')
  7342. ctx.fillRect(0, 0, 150, 200)
  7343. ctx.setFillStyle('blue')
  7344. ctx.fillRect(150, 0, 150, 200)
  7345. ctx.clearRect(10, 10, 150, 75)
  7346. ctx.draw()
  7347. ```
  7348. * ![](@program/dev/image/canvas/clear-rect.png) */
  7349. clearRect(
  7350. /** 矩形路径左上角的横坐标 */
  7351. x: number,
  7352. /** 矩形路径左上角的纵坐标 */
  7353. y: number,
  7354. /** 矩形路径的宽度 */
  7355. width: number,
  7356. /** 矩形路径的高度 */
  7357. height: number
  7358. ): void
  7359. /** [CanvasContext.clip()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.clip.html)
  7360. *
  7361. * 从原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内(不能访问画布上的其他区域)。可以在使用 `clip` 方法前通过使用 `save` 方法对当前画布区域进行保存,并在以后的任意时间通过`restore`方法对其进行恢复。
  7362. *
  7363. * **示例代码**
  7364. *
  7365. *
  7366. * ```javascript
  7367. const ctx = wx.createCanvasContext('myCanvas')
  7368. wx.downloadFile({
  7369. url: 'http://is5.mzstatic.com/image/thumb/Purple128/v4/75/3b/90/753b907c-b7fb-5877-215a-759bd73691a4/source/50x50bb.jpg',
  7370. success: function(res) {
  7371. ctx.save()
  7372. ctx.beginPath()
  7373. ctx.arc(50, 50, 25, 0, 2*Math.PI)
  7374. ctx.clip()
  7375. ctx.drawImage(res.tempFilePath, 25, 25)
  7376. ctx.restore()
  7377. ctx.draw()
  7378. }
  7379. })
  7380. ```
  7381. * ![](@program/dev/image/canvas/clip.png)
  7382. *
  7383. * 最低基础库: `1.6.0` */
  7384. clip(): void
  7385. /** [CanvasContext.closePath()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.closePath.html)
  7386. *
  7387. * 关闭一个路径。会连接起点和终点。如果关闭路径后没有调用 `fill` 或者 `stroke` 并开启了新的路径,那之前的路径将不会被渲染。
  7388. *
  7389. * **示例代码**
  7390. *
  7391. *
  7392. * ```javascript
  7393. const ctx = wx.createCanvasContext('myCanvas')
  7394. ctx.moveTo(10, 10)
  7395. ctx.lineTo(100, 10)
  7396. ctx.lineTo(100, 100)
  7397. ctx.closePath()
  7398. ctx.stroke()
  7399. ctx.draw()
  7400. ```
  7401. * ![](@program/dev/image/canvas/close-line.png)
  7402. *
  7403. * ```javascript
  7404. const ctx = wx.createCanvasContext('myCanvas')
  7405. // begin path
  7406. ctx.rect(10, 10, 100, 30)
  7407. ctx.closePath()
  7408. // begin another path
  7409. ctx.beginPath()
  7410. ctx.rect(10, 40, 100, 30)
  7411. // only fill this rect, not in current path
  7412. ctx.setFillStyle('blue')
  7413. ctx.fillRect(10, 70, 100, 30)
  7414. ctx.rect(10, 100, 100, 30)
  7415. // it will fill current path
  7416. ctx.setFillStyle('red')
  7417. ctx.fill()
  7418. ctx.draw()
  7419. ```
  7420. *
  7421. * ![](@program/dev/image/canvas/close-path.png) */
  7422. closePath(): void
  7423. /** [CanvasContext.createPattern(string image, string repetition)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createPattern.html)
  7424. *
  7425. * 对指定的图像创建模式的方法,可在指定的方向上重复元图像
  7426. *
  7427. * 最低基础库: `1.9.90` */
  7428. createPattern(
  7429. /** 重复的图像源,支持代码包路径和本地临时路径 (本地路径) */
  7430. image: string,
  7431. /** 如何重复图像
  7432. *
  7433. * 参数 repetition 可选值:
  7434. * - 'repeat': 水平竖直方向都重复;
  7435. * - 'repeat-x': 水平方向重复;
  7436. * - 'repeat-y': 竖直方向重复;
  7437. * - 'no-repeat': 不重复; */
  7438. repetition: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat'
  7439. ): void
  7440. /** [CanvasContext.draw(boolean reserve, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.draw.html)
  7441. *
  7442. * 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。
  7443. *
  7444. * **示例代码**
  7445. *
  7446. *
  7447. * 第二次 draw() reserve 为 true。所以保留了上一次的绘制结果,在上下文设置的 fillStyle 'red' 也变成了默认的 'black'。
  7448. *
  7449. * ```javascript
  7450. const ctx = wx.createCanvasContext('myCanvas')
  7451. ctx.setFillStyle('red')
  7452. ctx.fillRect(10, 10, 150, 100)
  7453. ctx.draw()
  7454. ctx.fillRect(50, 50, 150, 100)
  7455. ctx.draw(true)
  7456. ```
  7457. * ![](@program/dev/image/canvas/reserve.png)
  7458. *
  7459. * **示例代码**
  7460. *
  7461. *
  7462. * 第二次 draw() reserve 为 false。所以没有保留了上一次的绘制结果和在上下文设置的 fillStyle 'red'。
  7463. *
  7464. * ```javascript
  7465. const ctx = wx.createCanvasContext('myCanvas')
  7466. ctx.setFillStyle('red')
  7467. ctx.fillRect(10, 10, 150, 100)
  7468. ctx.draw()
  7469. ctx.fillRect(50, 50, 150, 100)
  7470. ctx.draw()
  7471. ```
  7472. * ![](@program/dev/image/canvas/un-reserve.png) */
  7473. draw(
  7474. /** 本次绘制是否接着上一次绘制。即 reserve 参数为 false,则在本次调用绘制之前 native 层会先清空画布再继续绘制;若 reserve 参数为 true,则保留当前画布上的内容,本次调用 drawCanvas 绘制的内容覆盖在上面,默认 false。 */
  7475. reserve?: boolean,
  7476. /** 绘制完成后执行的回调函数 */
  7477. callback?: (...args: any[]) => any
  7478. ): void
  7479. /** [CanvasContext.drawImage(string imageResource, number sx, number sy, number sWidth, number sHeight, number dx, number dy, number dWidth, number dHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html)
  7480. *
  7481. * 绘制图像到画布
  7482. *
  7483. * **示例代码**
  7484. *
  7485. *
  7486. *
  7487. * 有三个版本的写法:
  7488. *
  7489. * - drawImage(imageResource, dx, dy)
  7490. * - drawImage(imageResource, dx, dy, dWidth, dHeight)
  7491. * - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持
  7492. *
  7493. * ```javascript
  7494. const ctx = wx.createCanvasContext('myCanvas')
  7495. wx.chooseImage({
  7496. success: function(res){
  7497. ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
  7498. ctx.draw()
  7499. }
  7500. })
  7501. ```
  7502. * ![](@program/dev/image/canvas/draw-image.png) */
  7503. drawImage(
  7504. /** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */
  7505. imageResource: string,
  7506. /** imageResource的左上角在目标 canvas 上 x 轴的位置 */
  7507. dx: number,
  7508. /** imageResource的左上角在目标 canvas 上 y 轴的位置 */
  7509. dy: number
  7510. ): void
  7511. /** [CanvasContext.drawImage(string imageResource, number sx, number sy, number sWidth, number sHeight, number dx, number dy, number dWidth, number dHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html)
  7512. *
  7513. * 绘制图像到画布
  7514. *
  7515. * **示例代码**
  7516. *
  7517. *
  7518. *
  7519. * 有三个版本的写法:
  7520. *
  7521. * - drawImage(imageResource, dx, dy)
  7522. * - drawImage(imageResource, dx, dy, dWidth, dHeight)
  7523. * - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持
  7524. *
  7525. * ```javascript
  7526. const ctx = wx.createCanvasContext('myCanvas')
  7527. wx.chooseImage({
  7528. success: function(res){
  7529. ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
  7530. ctx.draw()
  7531. }
  7532. })
  7533. ```
  7534. * ![](@program/dev/image/canvas/draw-image.png) */
  7535. drawImage(
  7536. /** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */
  7537. imageResource: string,
  7538. /** imageResource的左上角在目标 canvas 上 x 轴的位置 */
  7539. dx: number,
  7540. /** imageResource的左上角在目标 canvas 上 y 轴的位置 */
  7541. dy: number,
  7542. /** 在目标画布上绘制imageResource的宽度,允许对绘制的imageResource进行缩放 */
  7543. dWidth: number,
  7544. /** 在目标画布上绘制imageResource的高度,允许对绘制的imageResource进行缩放 */
  7545. dHeight: number
  7546. ): void
  7547. /** [CanvasContext.drawImage(string imageResource, number sx, number sy, number sWidth, number sHeight, number dx, number dy, number dWidth, number dHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html)
  7548. *
  7549. * 绘制图像到画布
  7550. *
  7551. * **示例代码**
  7552. *
  7553. *
  7554. *
  7555. * 有三个版本的写法:
  7556. *
  7557. * - drawImage(imageResource, dx, dy)
  7558. * - drawImage(imageResource, dx, dy, dWidth, dHeight)
  7559. * - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持
  7560. *
  7561. * ```javascript
  7562. const ctx = wx.createCanvasContext('myCanvas')
  7563. wx.chooseImage({
  7564. success: function(res){
  7565. ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
  7566. ctx.draw()
  7567. }
  7568. })
  7569. ```
  7570. * ![](@program/dev/image/canvas/draw-image.png) */
  7571. drawImage(
  7572. /** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */
  7573. imageResource: string,
  7574. /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的左上角 x 坐标 */
  7575. sx: number,
  7576. /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的左上角 y 坐标 */
  7577. sy: number,
  7578. /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的宽度 */
  7579. sWidth: number,
  7580. /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的高度 */
  7581. sHeight: number,
  7582. /** imageResource的左上角在目标 canvas 上 x 轴的位置 */
  7583. dx: number,
  7584. /** imageResource的左上角在目标 canvas 上 y 轴的位置 */
  7585. dy: number,
  7586. /** 在目标画布上绘制imageResource的宽度,允许对绘制的imageResource进行缩放 */
  7587. dWidth: number,
  7588. /** 在目标画布上绘制imageResource的高度,允许对绘制的imageResource进行缩放 */
  7589. dHeight: number
  7590. ): void
  7591. /** [CanvasContext.fill()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fill.html)
  7592. *
  7593. * 对当前路径中的内容进行填充。默认的填充色为黑色。
  7594. *
  7595. * **示例代码**
  7596. *
  7597. *
  7598. *
  7599. * 如果当前路径没有闭合,fill() 方法会将起点和终点进行连接,然后填充。
  7600. *
  7601. * ```javascript
  7602. const ctx = wx.createCanvasContext('myCanvas')
  7603. ctx.moveTo(10, 10)
  7604. ctx.lineTo(100, 10)
  7605. ctx.lineTo(100, 100)
  7606. ctx.fill()
  7607. ctx.draw()
  7608. ```
  7609. *
  7610. * fill() 填充的的路径是从 beginPath() 开始计算,但是不会将 fillRect() 包含进去。
  7611. *
  7612. * ![](@program/dev/image/canvas/fill-line.png)
  7613. *
  7614. * ```javascript
  7615. const ctx = wx.createCanvasContext('myCanvas')
  7616. // begin path
  7617. ctx.rect(10, 10, 100, 30)
  7618. ctx.setFillStyle('yellow')
  7619. ctx.fill()
  7620. // begin another path
  7621. ctx.beginPath()
  7622. ctx.rect(10, 40, 100, 30)
  7623. // only fill this rect, not in current path
  7624. ctx.setFillStyle('blue')
  7625. ctx.fillRect(10, 70, 100, 30)
  7626. ctx.rect(10, 100, 100, 30)
  7627. // it will fill current path
  7628. ctx.setFillStyle('red')
  7629. ctx.fill()
  7630. ctx.draw()
  7631. ```
  7632. *
  7633. * ![](@program/dev/image/canvas/fill-path.png) */
  7634. fill(): void
  7635. /** [CanvasContext.fillRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fillRect.html)
  7636. *
  7637. * 填充一个矩形。用 [`setFillStyle`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html) 设置矩形的填充色,如果没设置默认是黑色。
  7638. *
  7639. * **示例代码**
  7640. *
  7641. *
  7642. * ```javascript
  7643. const ctx = wx.createCanvasContext('myCanvas')
  7644. ctx.setFillStyle('red')
  7645. ctx.fillRect(10, 10, 150, 75)
  7646. ctx.draw()
  7647. ```
  7648. * ![](@program/dev/image/canvas/fill-rect.png) */
  7649. fillRect(
  7650. /** 矩形路径左上角的横坐标 */
  7651. x: number,
  7652. /** 矩形路径左上角的纵坐标 */
  7653. y: number,
  7654. /** 矩形路径的宽度 */
  7655. width: number,
  7656. /** 矩形路径的高度 */
  7657. height: number
  7658. ): void
  7659. /** [CanvasContext.fillText(string text, number x, number y, number maxWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fillText.html)
  7660. *
  7661. * 在画布上绘制被填充的文本
  7662. *
  7663. * **示例代码**
  7664. *
  7665. *
  7666. * ```javascript
  7667. const ctx = wx.createCanvasContext('myCanvas')
  7668. ctx.setFontSize(20)
  7669. ctx.fillText('Hello', 20, 20)
  7670. ctx.fillText('MINA', 100, 100)
  7671. ctx.draw()
  7672. ```
  7673. * ![](@program/dev/image/canvas/text.png) */
  7674. fillText(
  7675. /** 在画布上输出的文本 */
  7676. text: string,
  7677. /** 绘制文本的左上角 x 坐标位置 */
  7678. x: number,
  7679. /** 绘制文本的左上角 y 坐标位置 */
  7680. y: number,
  7681. /** 需要绘制的最大宽度,可选 */
  7682. maxWidth?: number
  7683. ): void
  7684. /** [CanvasContext.lineTo(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.lineTo.html)
  7685. *
  7686. * 增加一个新点,然后创建一条从上次指定点到目标点的线。用 `stroke` 方法来画线条
  7687. *
  7688. * **示例代码**
  7689. *
  7690. *
  7691. * ```javascript
  7692. const ctx = wx.createCanvasContext('myCanvas')
  7693. ctx.moveTo(10, 10)
  7694. ctx.rect(10, 10, 100, 50)
  7695. ctx.lineTo(110, 60)
  7696. ctx.stroke()
  7697. ctx.draw()
  7698. ```
  7699. * ![](@program/dev/image/canvas/line-to.png) */
  7700. lineTo(
  7701. /** 目标位置的 x 坐标 */
  7702. x: number,
  7703. /** 目标位置的 y 坐标 */
  7704. y: number
  7705. ): void
  7706. /** [CanvasContext.moveTo(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.moveTo.html)
  7707. *
  7708. * 把路径移动到画布中的指定点,不创建线条。用 `stroke` 方法来画线条
  7709. *
  7710. * **示例代码**
  7711. *
  7712. *
  7713. * ```javascript
  7714. const ctx = wx.createCanvasContext('myCanvas')
  7715. ctx.moveTo(10, 10)
  7716. ctx.lineTo(100, 10)
  7717. ctx.moveTo(10, 50)
  7718. ctx.lineTo(100, 50)
  7719. ctx.stroke()
  7720. ctx.draw()
  7721. ```
  7722. * ![](@program/dev/image/canvas/move-to.png) */
  7723. moveTo(
  7724. /** 目标位置的 x 坐标 */
  7725. x: number,
  7726. /** 目标位置的 y 坐标 */
  7727. y: number
  7728. ): void
  7729. /** [CanvasContext.quadraticCurveTo(number cpx, number cpy, number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.quadraticCurveTo.html)
  7730. *
  7731. * 创建二次贝塞尔曲线路径。曲线的起始点为路径中前一个点。
  7732. *
  7733. * **示例代码**
  7734. *
  7735. *
  7736. * ```javascript
  7737. const ctx = wx.createCanvasContext('myCanvas')
  7738. // Draw points
  7739. ctx.beginPath()
  7740. ctx.arc(20, 20, 2, 0, 2 * Math.PI)
  7741. ctx.setFillStyle('red')
  7742. ctx.fill()
  7743. ctx.beginPath()
  7744. ctx.arc(200, 20, 2, 0, 2 * Math.PI)
  7745. ctx.setFillStyle('lightgreen')
  7746. ctx.fill()
  7747. ctx.beginPath()
  7748. ctx.arc(20, 100, 2, 0, 2 * Math.PI)
  7749. ctx.setFillStyle('blue')
  7750. ctx.fill()
  7751. ctx.setFillStyle('black')
  7752. ctx.setFontSize(12)
  7753. // Draw guides
  7754. ctx.beginPath()
  7755. ctx.moveTo(20, 20)
  7756. ctx.lineTo(20, 100)
  7757. ctx.lineTo(200, 20)
  7758. ctx.setStrokeStyle('#AAAAAA')
  7759. ctx.stroke()
  7760. // Draw quadratic curve
  7761. ctx.beginPath()
  7762. ctx.moveTo(20, 20)
  7763. ctx.quadraticCurveTo(20, 100, 200, 20)
  7764. ctx.setStrokeStyle('black')
  7765. ctx.stroke()
  7766. ctx.draw()
  7767. ```
  7768. *
  7769. * ![](@program/dev/image/canvas/quadratic-curve-to.png)
  7770. *
  7771. * 针对 moveTo(20, 20) quadraticCurveTo(20, 100, 200, 20) 的三个关键坐标如下:
  7772. *
  7773. * - 红色:起始点(20, 20)
  7774. * - 蓝色:控制点(20, 100)
  7775. * - 绿色:终止点(200, 20) */
  7776. quadraticCurveTo(
  7777. /** 贝塞尔控制点的 x 坐标 */
  7778. cpx: number,
  7779. /** 贝塞尔控制点的 y 坐标 */
  7780. cpy: number,
  7781. /** 结束点的 x 坐标 */
  7782. x: number,
  7783. /** 结束点的 y 坐标 */
  7784. y: number
  7785. ): void
  7786. /** [CanvasContext.rect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.rect.html)
  7787. *
  7788. * 创建一个矩形路径。需要用 [`fill`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fill.html) 或者 [`stroke`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.stroke.html) 方法将矩形真正的画到 `canvas` 中
  7789. *
  7790. * **示例代码**
  7791. *
  7792. *
  7793. * ```javascript
  7794. const ctx = wx.createCanvasContext('myCanvas')
  7795. ctx.rect(10, 10, 150, 75)
  7796. ctx.setFillStyle('red')
  7797. ctx.fill()
  7798. ctx.draw()
  7799. ```
  7800. * ![](@program/dev/image/canvas/fill-rect.png) */
  7801. rect(
  7802. /** 矩形路径左上角的横坐标 */
  7803. x: number,
  7804. /** 矩形路径左上角的纵坐标 */
  7805. y: number,
  7806. /** 矩形路径的宽度 */
  7807. width: number,
  7808. /** 矩形路径的高度 */
  7809. height: number
  7810. ): void
  7811. /** [CanvasContext.restore()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.restore.html)
  7812. *
  7813. * 恢复之前保存的绘图上下文。
  7814. *
  7815. * **示例代码**
  7816. *
  7817. *
  7818. * ```javascript
  7819. const ctx = wx.createCanvasContext('myCanvas')
  7820. // save the default fill style
  7821. ctx.save()
  7822. ctx.setFillStyle('red')
  7823. ctx.fillRect(10, 10, 150, 100)
  7824. // restore to the previous saved state
  7825. ctx.restore()
  7826. ctx.fillRect(50, 50, 150, 100)
  7827. ctx.draw()
  7828. ```
  7829. * ![](@program/dev/image/canvas/save-restore.png) */
  7830. restore(): void
  7831. /** [CanvasContext.rotate(number rotate)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.rotate.html)
  7832. *
  7833. * 以原点为中心顺时针旋转当前坐标轴。多次调用旋转的角度会叠加。原点可以用 `translate` 方法修改。
  7834. *
  7835. * **示例代码**
  7836. *
  7837. *
  7838. * ```javascript
  7839. const ctx = wx.createCanvasContext('myCanvas')
  7840. ctx.strokeRect(100, 10, 150, 100)
  7841. ctx.rotate(20 * Math.PI / 180)
  7842. ctx.strokeRect(100, 10, 150, 100)
  7843. ctx.rotate(20 * Math.PI / 180)
  7844. ctx.strokeRect(100, 10, 150, 100)
  7845. ctx.draw()
  7846. ```
  7847. * ![](@program/dev/image/canvas/rotate.png) */
  7848. rotate(
  7849. /** 旋转角度,以弧度计 degrees * Math.PI/180;degrees 范围为 0-360 */
  7850. rotate: number
  7851. ): void
  7852. /** [CanvasContext.save()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.save.html)
  7853. *
  7854. * 保存绘图上下文。
  7855. *
  7856. * **示例代码**
  7857. *
  7858. *
  7859. * ```javascript
  7860. const ctx = wx.createCanvasContext('myCanvas')
  7861. // save the default fill style
  7862. ctx.save()
  7863. ctx.setFillStyle('red')
  7864. ctx.fillRect(10, 10, 150, 100)
  7865. // restore to the previous saved state
  7866. ctx.restore()
  7867. ctx.fillRect(50, 50, 150, 100)
  7868. ctx.draw()
  7869. ```
  7870. * ![](@program/dev/image/canvas/save-restore.png) */
  7871. save(): void
  7872. /** [CanvasContext.scale(number scaleWidth, number scaleHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.scale.html)
  7873. *
  7874. * 在调用后,之后创建的路径其横纵坐标会被缩放。多次调用倍数会相乘。
  7875. *
  7876. * **示例代码**
  7877. *
  7878. *
  7879. * ```javascript
  7880. const ctx = wx.createCanvasContext('myCanvas')
  7881. ctx.strokeRect(10, 10, 25, 15)
  7882. ctx.scale(2, 2)
  7883. ctx.strokeRect(10, 10, 25, 15)
  7884. ctx.scale(2, 2)
  7885. ctx.strokeRect(10, 10, 25, 15)
  7886. ctx.draw()
  7887. ```
  7888. * ![](@program/dev/image/canvas/scale.png) */
  7889. scale(
  7890. /** 横坐标缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%) */
  7891. scaleWidth: number,
  7892. /** 纵坐标轴缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%) */
  7893. scaleHeight: number
  7894. ): void
  7895. /** [CanvasContext.setFillStyle(string|[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html)
  7896. *
  7897. * 设置填充色。
  7898. *
  7899. * **代码示例**
  7900. *
  7901. *
  7902. * ```js
  7903. const ctx = wx.createCanvasContext('myCanvas')
  7904. ctx.setFillStyle('red')
  7905. ctx.fillRect(10, 10, 150, 75)
  7906. ctx.draw()
  7907. ```
  7908. * ![](@program/dev/image/canvas/fill-rect.png)
  7909. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.fillStyle](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  7910. * */
  7911. setFillStyle(
  7912. /** 填充的颜色,默认颜色为 black。 */
  7913. color: string | CanvasGradient
  7914. ): void
  7915. /** [CanvasContext.setFontSize(number fontSize)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFontSize.html)
  7916. *
  7917. * 设置字体的字号
  7918. *
  7919. * **示例代码**
  7920. *
  7921. *
  7922. * ```javascript
  7923. const ctx = wx.createCanvasContext('myCanvas')
  7924. ctx.setFontSize(20)
  7925. ctx.fillText('20', 20, 20)
  7926. ctx.setFontSize(30)
  7927. ctx.fillText('30', 40, 40)
  7928. ctx.setFontSize(40)
  7929. ctx.fillText('40', 60, 60)
  7930. ctx.setFontSize(50)
  7931. ctx.fillText('50', 90, 90)
  7932. ctx.draw()
  7933. ```
  7934. * ![](@program/dev/image/canvas/font-size.png)
  7935. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.font](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  7936. * */
  7937. setFontSize(
  7938. /** 字体的字号 */
  7939. fontSize: number
  7940. ): void
  7941. /** [CanvasContext.setGlobalAlpha(number alpha)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setGlobalAlpha.html)
  7942. *
  7943. * 设置全局画笔透明度。
  7944. *
  7945. * **示例代码**
  7946. *
  7947. *
  7948. * ```javascript
  7949. const ctx = wx.createCanvasContext('myCanvas')
  7950. ctx.setFillStyle('red')
  7951. ctx.fillRect(10, 10, 150, 100)
  7952. ctx.setGlobalAlpha(0.2)
  7953. ctx.setFillStyle('blue')
  7954. ctx.fillRect(50, 50, 150, 100)
  7955. ctx.setFillStyle('yellow')
  7956. ctx.fillRect(100, 100, 150, 100)
  7957. ctx.draw()
  7958. ```
  7959. * ![](@program/dev/image/canvas/global-alpha.png)
  7960. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.globalAlpha](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  7961. * */
  7962. setGlobalAlpha(
  7963. /** 透明度。范围 0-1,0 表示完全透明,1 表示完全不透明。 */
  7964. alpha: number
  7965. ): void
  7966. /** [CanvasContext.setLineCap(string lineCap)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineCap.html)
  7967. *
  7968. * 设置线条的端点样式
  7969. *
  7970. * **示例代码**
  7971. *
  7972. *
  7973. * ```javascript
  7974. const ctx = wx.createCanvasContext('myCanvas')
  7975. ctx.beginPath()
  7976. ctx.moveTo(10, 10)
  7977. ctx.lineTo(150, 10)
  7978. ctx.stroke()
  7979. ctx.beginPath()
  7980. ctx.setLineCap('butt')
  7981. ctx.setLineWidth(10)
  7982. ctx.moveTo(10, 30)
  7983. ctx.lineTo(150, 30)
  7984. ctx.stroke()
  7985. ctx.beginPath()
  7986. ctx.setLineCap('round')
  7987. ctx.setLineWidth(10)
  7988. ctx.moveTo(10, 50)
  7989. ctx.lineTo(150, 50)
  7990. ctx.stroke()
  7991. ctx.beginPath()
  7992. ctx.setLineCap('square')
  7993. ctx.setLineWidth(10)
  7994. ctx.moveTo(10, 70)
  7995. ctx.lineTo(150, 70)
  7996. ctx.stroke()
  7997. ctx.draw()
  7998. ```
  7999. * ![](@program/dev/image/canvas/line-cap.png)
  8000. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineCap](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  8001. * */
  8002. setLineCap(
  8003. /** 线条的结束端点样式
  8004. *
  8005. * 参数 lineCap 可选值:
  8006. * - 'butt': 向线条的每个末端添加平直的边缘。;
  8007. * - 'round': 向线条的每个末端添加圆形线帽。;
  8008. * - 'square': 向线条的每个末端添加正方形线帽。; */
  8009. lineCap: 'butt' | 'round' | 'square'
  8010. ): void
  8011. /** [CanvasContext.setLineDash(Array.&lt;number&gt; pattern, number offset)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineDash.html)
  8012. *
  8013. * 设置虚线样式。
  8014. *
  8015. * **示例代码**
  8016. *
  8017. *
  8018. * ```javascript
  8019. const ctx = wx.createCanvasContext('myCanvas')
  8020. ctx.setLineDash([10, 20], 5);
  8021. ctx.beginPath();
  8022. ctx.moveTo(0,100);
  8023. ctx.lineTo(400, 100);
  8024. ctx.stroke();
  8025. ctx.draw()
  8026. ```
  8027. * ![](@program/dev/image/canvas/set-line-dash.png)
  8028. *
  8029. * 最低基础库: `1.6.0`
  8030. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineDashOffset](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  8031. * */
  8032. setLineDash(
  8033. /** 一组描述交替绘制线段和间距(坐标空间单位)长度的数字 */
  8034. pattern: number[],
  8035. /** 虚线偏移量 */
  8036. offset: number
  8037. ): void
  8038. /** [CanvasContext.setLineJoin(string lineJoin)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html)
  8039. *
  8040. * 设置线条的交点样式
  8041. *
  8042. * **示例代码**
  8043. *
  8044. *
  8045. * ```javascript
  8046. const ctx = wx.createCanvasContext('myCanvas')
  8047. ctx.beginPath()
  8048. ctx.moveTo(10, 10)
  8049. ctx.lineTo(100, 50)
  8050. ctx.lineTo(10, 90)
  8051. ctx.stroke()
  8052. ctx.beginPath()
  8053. ctx.setLineJoin('bevel')
  8054. ctx.setLineWidth(10)
  8055. ctx.moveTo(50, 10)
  8056. ctx.lineTo(140, 50)
  8057. ctx.lineTo(50, 90)
  8058. ctx.stroke()
  8059. ctx.beginPath()
  8060. ctx.setLineJoin('round')
  8061. ctx.setLineWidth(10)
  8062. ctx.moveTo(90, 10)
  8063. ctx.lineTo(180, 50)
  8064. ctx.lineTo(90, 90)
  8065. ctx.stroke()
  8066. ctx.beginPath()
  8067. ctx.setLineJoin('miter')
  8068. ctx.setLineWidth(10)
  8069. ctx.moveTo(130, 10)
  8070. ctx.lineTo(220, 50)
  8071. ctx.lineTo(130, 90)
  8072. ctx.stroke()
  8073. ctx.draw()
  8074. ```
  8075. * ![](@program/dev/image/canvas/line-join.png)
  8076. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineJoin](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  8077. * */
  8078. setLineJoin(
  8079. /** 线条的结束交点样式
  8080. *
  8081. * 参数 lineJoin 可选值:
  8082. * - 'bevel': 斜角;
  8083. * - 'round': 圆角;
  8084. * - 'miter': 尖角; */
  8085. lineJoin: 'bevel' | 'round' | 'miter'
  8086. ): void
  8087. /** [CanvasContext.setLineWidth(number lineWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineWidth.html)
  8088. *
  8089. * 设置线条的宽度
  8090. *
  8091. * **示例代码**
  8092. *
  8093. *
  8094. * ```javascript
  8095. const ctx = wx.createCanvasContext('myCanvas')
  8096. ctx.beginPath()
  8097. ctx.moveTo(10, 10)
  8098. ctx.lineTo(150, 10)
  8099. ctx.stroke()
  8100. ctx.beginPath()
  8101. ctx.setLineWidth(5)
  8102. ctx.moveTo(10, 30)
  8103. ctx.lineTo(150, 30)
  8104. ctx.stroke()
  8105. ctx.beginPath()
  8106. ctx.setLineWidth(10)
  8107. ctx.moveTo(10, 50)
  8108. ctx.lineTo(150, 50)
  8109. ctx.stroke()
  8110. ctx.beginPath()
  8111. ctx.setLineWidth(15)
  8112. ctx.moveTo(10, 70)
  8113. ctx.lineTo(150, 70)
  8114. ctx.stroke()
  8115. ctx.draw()
  8116. ```
  8117. *
  8118. * ![](@program/dev/image/canvas/line-width.png)
  8119. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.lineWidth](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  8120. * */
  8121. setLineWidth(
  8122. /** 线条的宽度,单位px */
  8123. lineWidth: number
  8124. ): void
  8125. /** [CanvasContext.setMiterLimit(number miterLimit)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setMiterLimit.html)
  8126. *
  8127. * 设置最大斜接长度。斜接长度指的是在两条线交汇处内角和外角之间的距离。当 [CanvasContext.setLineJoin()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html) 为 miter 时才有效。超过最大倾斜长度的,连接处将以 lineJoin 为 bevel 来显示。
  8128. *
  8129. * **示例代码**
  8130. *
  8131. *
  8132. * ```javascript
  8133. const ctx = wx.createCanvasContext('myCanvas')
  8134. ctx.beginPath()
  8135. ctx.setLineWidth(10)
  8136. ctx.setLineJoin('miter')
  8137. ctx.setMiterLimit(1)
  8138. ctx.moveTo(10, 10)
  8139. ctx.lineTo(100, 50)
  8140. ctx.lineTo(10, 90)
  8141. ctx.stroke()
  8142. ctx.beginPath()
  8143. ctx.setLineWidth(10)
  8144. ctx.setLineJoin('miter')
  8145. ctx.setMiterLimit(2)
  8146. ctx.moveTo(50, 10)
  8147. ctx.lineTo(140, 50)
  8148. ctx.lineTo(50, 90)
  8149. ctx.stroke()
  8150. ctx.beginPath()
  8151. ctx.setLineWidth(10)
  8152. ctx.setLineJoin('miter')
  8153. ctx.setMiterLimit(3)
  8154. ctx.moveTo(90, 10)
  8155. ctx.lineTo(180, 50)
  8156. ctx.lineTo(90, 90)
  8157. ctx.stroke()
  8158. ctx.beginPath()
  8159. ctx.setLineWidth(10)
  8160. ctx.setLineJoin('miter')
  8161. ctx.setMiterLimit(4)
  8162. ctx.moveTo(130, 10)
  8163. ctx.lineTo(220, 50)
  8164. ctx.lineTo(130, 90)
  8165. ctx.stroke()
  8166. ctx.draw()
  8167. ```
  8168. * ![](@program/dev/image/canvas/miter-limit.png)
  8169. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.miterLimit](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  8170. * */
  8171. setMiterLimit(
  8172. /** 最大斜接长度 */
  8173. miterLimit: number
  8174. ): void
  8175. /** [CanvasContext.setShadow(number offsetX, number offsetY, number blur, string color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setShadow.html)
  8176. *
  8177. * 设定阴影样式。
  8178. *
  8179. * **示例代码**
  8180. *
  8181. *
  8182. * ```javascript
  8183. const ctx = wx.createCanvasContext('myCanvas')
  8184. ctx.setFillStyle('red')
  8185. ctx.setShadow(10, 50, 50, 'blue')
  8186. ctx.fillRect(10, 10, 150, 75)
  8187. ctx.draw()
  8188. ```
  8189. * ![](@program/dev/image/canvas/shadow.png)
  8190. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.shadowOffsetX|CanvasContext.shadowOffsetY|CanvasContext.shadowColor|CanvasContext.shadowBlur](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  8191. * */
  8192. setShadow(
  8193. /** 阴影相对于形状在水平方向的偏移,默认值为 0。 */
  8194. offsetX: number,
  8195. /** 阴影相对于形状在竖直方向的偏移,默认值为 0。 */
  8196. offsetY: number,
  8197. /** 阴影的模糊级别,数值越大越模糊。范围 0- 100。,默认值为 0。 */
  8198. blur: number,
  8199. /** 阴影的颜色。默认值为 black。 */
  8200. color: string
  8201. ): void
  8202. /** [CanvasContext.setStrokeStyle(string|[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html)
  8203. *
  8204. * 设置描边颜色。
  8205. *
  8206. * **代码示例**
  8207. *
  8208. *
  8209. * ```js
  8210. const ctx = wx.createCanvasContext('myCanvas')
  8211. ctx.setStrokeStyle('red')
  8212. ctx.strokeRect(10, 10, 150, 75)
  8213. ctx.draw()
  8214. ```
  8215. * ![](@program/dev/image/canvas/stroke-rect.png)
  8216. * @deprecated 基础库版本 [1.9.90](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [CanvasContext.strokeStyle](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 替换
  8217. * */
  8218. setStrokeStyle(
  8219. /** 描边的颜色,默认颜色为 black。 */
  8220. color: string | CanvasGradient
  8221. ): void
  8222. /** [CanvasContext.setTextAlign(string align)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextAlign.html)
  8223. *
  8224. * 设置文字的对齐
  8225. *
  8226. * **示例代码**
  8227. *
  8228. *
  8229. *
  8230. * ```javascript
  8231. const ctx = wx.createCanvasContext('myCanvas')
  8232. ctx.setStrokeStyle('red')
  8233. ctx.moveTo(150, 20)
  8234. ctx.lineTo(150, 170)
  8235. ctx.stroke()
  8236. ctx.setFontSize(15)
  8237. ctx.setTextAlign('left')
  8238. ctx.fillText('textAlign=left', 150, 60)
  8239. ctx.setTextAlign('center')
  8240. ctx.fillText('textAlign=center', 150, 80)
  8241. ctx.setTextAlign('right')
  8242. ctx.fillText('textAlign=right', 150, 100)
  8243. ctx.draw()
  8244. ```
  8245. *
  8246. * ![](@program/dev/image/canvas/set-text-align.png)
  8247. *
  8248. * 最低基础库: `1.1.0` */
  8249. setTextAlign(
  8250. /** 文字的对齐方式
  8251. *
  8252. * 参数 align 可选值:
  8253. * - 'left': 左对齐;
  8254. * - 'center': 居中对齐;
  8255. * - 'right': 右对齐; */
  8256. align: 'left' | 'center' | 'right'
  8257. ): void
  8258. /** [CanvasContext.setTextBaseline(string textBaseline)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextBaseline.html)
  8259. *
  8260. * 设置文字的竖直对齐
  8261. *
  8262. * **示例代码**
  8263. *
  8264. *
  8265. * ```javascript
  8266. const ctx = wx.createCanvasContext('myCanvas')
  8267. ctx.setStrokeStyle('red')
  8268. ctx.moveTo(5, 75)
  8269. ctx.lineTo(295, 75)
  8270. ctx.stroke()
  8271. ctx.setFontSize(20)
  8272. ctx.setTextBaseline('top')
  8273. ctx.fillText('top', 5, 75)
  8274. ctx.setTextBaseline('middle')
  8275. ctx.fillText('middle', 50, 75)
  8276. ctx.setTextBaseline('bottom')
  8277. ctx.fillText('bottom', 120, 75)
  8278. ctx.setTextBaseline('normal')
  8279. ctx.fillText('normal', 200, 75)
  8280. ctx.draw()
  8281. ```
  8282. * ![](@program/dev/image/canvas/set-text-baseline.png)
  8283. *
  8284. * 最低基础库: `1.4.0` */
  8285. setTextBaseline(
  8286. /** 文字的竖直对齐方式
  8287. *
  8288. * 参数 textBaseline 可选值:
  8289. * - 'top': 顶部对齐;
  8290. * - 'bottom': 底部对齐;
  8291. * - 'middle': 居中对齐;
  8292. * - 'normal': ; */
  8293. textBaseline: 'top' | 'bottom' | 'middle' | 'normal'
  8294. ): void
  8295. /** [CanvasContext.setTransform(number scaleX, number skewX, number skewY, number scaleY, number translateX, number translateY)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTransform.html)
  8296. *
  8297. * 使用矩阵重新设置(覆盖)当前变换的方法
  8298. *
  8299. * 最低基础库: `1.9.90` */
  8300. setTransform(
  8301. /** 水平缩放 */
  8302. scaleX: number,
  8303. /** 水平倾斜 */
  8304. skewX: number,
  8305. /** 垂直倾斜 */
  8306. skewY: number,
  8307. /** 垂直缩放 */
  8308. scaleY: number,
  8309. /** 水平移动 */
  8310. translateX: number,
  8311. /** 垂直移动 */
  8312. translateY: number
  8313. ): void
  8314. /** [CanvasContext.stroke()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.stroke.html)
  8315. *
  8316. * 画出当前路径的边框。默认颜色色为黑色。
  8317. *
  8318. * **示例代码**
  8319. *
  8320. *
  8321. * ```javascript
  8322. const ctx = wx.createCanvasContext('myCanvas')
  8323. ctx.moveTo(10, 10)
  8324. ctx.lineTo(100, 10)
  8325. ctx.lineTo(100, 100)
  8326. ctx.stroke()
  8327. ctx.draw()
  8328. ```
  8329. * ![](@program/dev/image/canvas/stroke-line.png)
  8330. *
  8331. * stroke() 描绘的的路径是从 beginPath() 开始计算,但是不会将 strokeRect() 包含进去。
  8332. *
  8333. * ```javascript
  8334. const ctx = wx.createCanvasContext('myCanvas')
  8335. // begin path
  8336. ctx.rect(10, 10, 100, 30)
  8337. ctx.setStrokeStyle('yellow')
  8338. ctx.stroke()
  8339. // begin another path
  8340. ctx.beginPath()
  8341. ctx.rect(10, 40, 100, 30)
  8342. // only stoke this rect, not in current path
  8343. ctx.setStrokeStyle('blue')
  8344. ctx.strokeRect(10, 70, 100, 30)
  8345. ctx.rect(10, 100, 100, 30)
  8346. // it will stroke current path
  8347. ctx.setStrokeStyle('red')
  8348. ctx.stroke()
  8349. ctx.draw()
  8350. ```
  8351. *
  8352. * ![](@program/dev/image/canvas/stroke-path.png) */
  8353. stroke(): void
  8354. /** [CanvasContext.strokeRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.strokeRect.html)
  8355. *
  8356. * 画一个矩形(非填充)。 用 [`setStrokeStyle`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html) 设置矩形线条的颜色,如果没设置默认是黑色。
  8357. *
  8358. * **示例代码**
  8359. *
  8360. *
  8361. * ```javascript
  8362. const ctx = wx.createCanvasContext('myCanvas')
  8363. ctx.setStrokeStyle('red')
  8364. ctx.strokeRect(10, 10, 150, 75)
  8365. ctx.draw()
  8366. ```
  8367. * ![](@program/dev/image/canvas/stroke-rect.png) */
  8368. strokeRect(
  8369. /** 矩形路径左上角的横坐标 */
  8370. x: number,
  8371. /** 矩形路径左上角的纵坐标 */
  8372. y: number,
  8373. /** 矩形路径的宽度 */
  8374. width: number,
  8375. /** 矩形路径的高度 */
  8376. height: number
  8377. ): void
  8378. /** [CanvasContext.strokeText(string text, number x, number y, number maxWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.strokeText.html)
  8379. *
  8380. * 给定的 (x, y) 位置绘制文本描边的方法
  8381. *
  8382. * 最低基础库: `1.9.90` */
  8383. strokeText(
  8384. /** 要绘制的文本 */
  8385. text: string,
  8386. /** 文本起始点的 x 轴坐标 */
  8387. x: number,
  8388. /** 文本起始点的 y 轴坐标 */
  8389. y: number,
  8390. /** 需要绘制的最大宽度,可选 */
  8391. maxWidth?: number
  8392. ): void
  8393. /** [CanvasContext.transform(number scaleX, number skewX, number skewY, number scaleY, number translateX, number translateY)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.transform.html)
  8394. *
  8395. * 使用矩阵多次叠加当前变换的方法
  8396. *
  8397. * 最低基础库: `1.9.90` */
  8398. transform(
  8399. /** 水平缩放 */
  8400. scaleX: number,
  8401. /** 水平倾斜 */
  8402. skewX: number,
  8403. /** 垂直倾斜 */
  8404. skewY: number,
  8405. /** 垂直缩放 */
  8406. scaleY: number,
  8407. /** 水平移动 */
  8408. translateX: number,
  8409. /** 垂直移动 */
  8410. translateY: number
  8411. ): void
  8412. /** [CanvasContext.translate(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.translate.html)
  8413. *
  8414. * 对当前坐标系的原点 (0, 0) 进行变换。默认的坐标系原点为页面左上角。
  8415. *
  8416. * **示例代码**
  8417. *
  8418. *
  8419. *
  8420. * ```javascript
  8421. const ctx = wx.createCanvasContext('myCanvas')
  8422. ctx.strokeRect(10, 10, 150, 100)
  8423. ctx.translate(20, 20)
  8424. ctx.strokeRect(10, 10, 150, 100)
  8425. ctx.translate(20, 20)
  8426. ctx.strokeRect(10, 10, 150, 100)
  8427. ctx.draw()
  8428. ```
  8429. *
  8430. * ![](@program/dev/image/canvas/translate.png) */
  8431. translate(
  8432. /** 水平坐标平移量 */
  8433. x: number,
  8434. /** 竖直坐标平移量 */
  8435. y: number
  8436. ): void
  8437. /** [Object CanvasContext.measureText(string text)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.measureText.html)
  8438. *
  8439. * 测量文本尺寸信息。目前仅返回文本宽度。同步接口。
  8440. *
  8441. * 最低基础库: `1.9.90` */
  8442. measureText(
  8443. /** 要测量的文本 */
  8444. text: string
  8445. ): TextMetrics
  8446. /** [[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) CanvasContext.createCircularGradient(number x, number y, number r)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createCircularGradient.html)
  8447. *
  8448. * 创建一个圆形的渐变颜色。起点在圆心,终点在圆环。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html) 来指定渐变点,至少要两个。
  8449. *
  8450. * **示例代码**
  8451. *
  8452. *
  8453. * ```javascript
  8454. const ctx = wx.createCanvasContext('myCanvas')
  8455. // Create circular gradient
  8456. const grd = ctx.createCircularGradient(75, 50, 50)
  8457. grd.addColorStop(0, 'red')
  8458. grd.addColorStop(1, 'white')
  8459. // Fill with gradient
  8460. ctx.setFillStyle(grd)
  8461. ctx.fillRect(10, 10, 150, 80)
  8462. ctx.draw()
  8463. ```
  8464. * ![](@program/dev/image/canvas/circular-gradient.png) */
  8465. createCircularGradient(
  8466. /** 圆心的 x 坐标 */
  8467. x: number,
  8468. /** 圆心的 y 坐标 */
  8469. y: number,
  8470. /** 圆的半径 */
  8471. r: number
  8472. ): CanvasGradient
  8473. /** [[CanvasGradient](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.html) CanvasContext.createLinearGradient(number x0, number y0, number x1, number y1)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createLinearGradient.html)
  8474. *
  8475. * 创建一个线性的渐变颜色。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html) 来指定渐变点,至少要两个。
  8476. *
  8477. * **示例代码**
  8478. *
  8479. *
  8480. * ```javascript
  8481. const ctx = wx.createCanvasContext('myCanvas')
  8482. // Create linear gradient
  8483. const grd = ctx.createLinearGradient(0, 0, 200, 0)
  8484. grd.addColorStop(0, 'red')
  8485. grd.addColorStop(1, 'white')
  8486. // Fill with gradient
  8487. ctx.setFillStyle(grd)
  8488. ctx.fillRect(10, 10, 150, 80)
  8489. ctx.draw()
  8490. ```
  8491. * ![](@program/dev/image/canvas/linear-gradient.png) */
  8492. createLinearGradient(
  8493. /** 起点的 x 坐标 */
  8494. x0: number,
  8495. /** 起点的 y 坐标 */
  8496. y0: number,
  8497. /** 终点的 x 坐标 */
  8498. x1: number,
  8499. /** 终点的 y 坐标 */
  8500. y1: number
  8501. ): CanvasGradient
  8502. }
  8503. interface CanvasGradient {
  8504. /** [CanvasGradient.addColorStop(number stop, string color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html)
  8505. *
  8506. * 添加颜色的渐变点。小于最小 stop 的部分会按最小 stop 的 color 来渲染,大于最大 stop 的部分会按最大 stop 的 color 来渲染
  8507. *
  8508. * **示例代码**
  8509. *
  8510. *
  8511. * ```js
  8512. const ctx = wx.createCanvasContext('myCanvas')
  8513. // Create circular gradient
  8514. const grd = ctx.createLinearGradient(30, 10, 120, 10)
  8515. grd.addColorStop(0, 'red')
  8516. grd.addColorStop(0.16, 'orange')
  8517. grd.addColorStop(0.33, 'yellow')
  8518. grd.addColorStop(0.5, 'green')
  8519. grd.addColorStop(0.66, 'cyan')
  8520. grd.addColorStop(0.83, 'blue')
  8521. grd.addColorStop(1, 'purple')
  8522. // Fill with gradient
  8523. ctx.setFillStyle(grd)
  8524. ctx.fillRect(10, 10, 150, 80)
  8525. ctx.draw()
  8526. ```
  8527. * ![](@program/dev/image/canvas/color-stop.png) */
  8528. addColorStop(
  8529. /** 表示渐变中开始与结束之间的位置,范围 0-1。 */
  8530. stop: number,
  8531. /** 渐变点的颜色。 */
  8532. color: string
  8533. ): void
  8534. }
  8535. interface Console {
  8536. /** [console.debug()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.debug.html)
  8537. *
  8538. * 向调试面板中打印 debug 日志 */
  8539. debug(
  8540. /** 日志内容,可以有任意多个。 */
  8541. ...args: any[]
  8542. ): void
  8543. /** [console.error()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.error.html)
  8544. *
  8545. * 向调试面板中打印 error 日志 */
  8546. error(
  8547. /** 日志内容,可以有任意多个。 */
  8548. ...args: any[]
  8549. ): void
  8550. /** [console.group(string label)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.group.html)
  8551. *
  8552. * 在调试面板中创建一个新的分组。随后输出的内容都会被添加一个缩进,表示该内容属于当前分组。调用 [console.groupEnd](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.groupEnd.html)之后分组结束。
  8553. *
  8554. * **注意**
  8555. *
  8556. *
  8557. * 仅在工具中有效,在 vConsole 中为空函数实现。 */
  8558. group(
  8559. /** 分组标记,可选。 */
  8560. label?: string
  8561. ): void
  8562. /** [console.groupEnd()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.groupEnd.html)
  8563. *
  8564. * 结束由 [console.group](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.group.html) 创建的分组
  8565. *
  8566. * **注意**
  8567. *
  8568. *
  8569. * 仅在工具中有效,在 vConsole 中为空函数实现。 */
  8570. groupEnd(): void
  8571. /** [console.info()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.info.html)
  8572. *
  8573. * 向调试面板中打印 info 日志 */
  8574. info(
  8575. /** 日志内容,可以有任意多个。 */
  8576. ...args: any[]
  8577. ): void
  8578. /** [console.log()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.log.html)
  8579. *
  8580. * 向调试面板中打印 log 日志 */
  8581. log(
  8582. /** 日志内容,可以有任意多个。 */
  8583. ...args: any[]
  8584. ): void
  8585. /** [console.warn()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.warn.html)
  8586. *
  8587. * 向调试面板中打印 warn 日志 */
  8588. warn(
  8589. /** 日志内容,可以有任意多个。 */
  8590. ...args: any[]
  8591. ): void
  8592. }
  8593. interface DownloadTask {
  8594. /** [DownloadTask.abort()](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.abort.html)
  8595. *
  8596. * 中断下载任务
  8597. *
  8598. * 最低基础库: `1.4.0` */
  8599. abort(): void
  8600. /** [DownloadTask.offHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offHeadersReceived.html)
  8601. *
  8602. * 取消监听 HTTP Response Header 事件
  8603. *
  8604. * 最低基础库: `2.1.0` */
  8605. offHeadersReceived(
  8606. /** HTTP Response Header 事件的回调函数 */
  8607. callback?: OffHeadersReceivedCallback
  8608. ): void
  8609. /** [DownloadTask.offProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offProgressUpdate.html)
  8610. *
  8611. * 取消监听下载进度变化事件
  8612. *
  8613. * 最低基础库: `2.1.0` */
  8614. offProgressUpdate(
  8615. /** 下载进度变化事件的回调函数 */
  8616. callback?: DownloadTaskOffProgressUpdateCallback
  8617. ): void
  8618. /** [DownloadTask.onHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onHeadersReceived.html)
  8619. *
  8620. * 监听 HTTP Response Header 事件。会比请求完成事件更早
  8621. *
  8622. * 最低基础库: `2.1.0` */
  8623. onHeadersReceived(
  8624. /** HTTP Response Header 事件的回调函数 */
  8625. callback: OnHeadersReceivedCallback
  8626. ): void
  8627. /** [DownloadTask.onProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onProgressUpdate.html)
  8628. *
  8629. * 监听下载进度变化事件
  8630. *
  8631. * 最低基础库: `1.4.0` */
  8632. onProgressUpdate(
  8633. /** 下载进度变化事件的回调函数 */
  8634. callback: DownloadTaskOnProgressUpdateCallback
  8635. ): void
  8636. }
  8637. interface EditorContext {
  8638. /** [EditorContext.blur(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.blur.html)
  8639. *
  8640. * 编辑器失焦,同时收起键盘。
  8641. *
  8642. * 最低基础库: `2.8.3` */
  8643. blur(option?: BlurOption): void
  8644. /** [EditorContext.clear(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.clear.html)
  8645. *
  8646. * 清空编辑器内容
  8647. *
  8648. * 最低基础库: `2.7.0` */
  8649. clear(option?: ClearOption): void
  8650. /** [EditorContext.format(string name, string value)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.format.html)
  8651. *
  8652. * 修改样式
  8653. *
  8654. * ****
  8655. *
  8656. * ## 支持设置的样式列表
  8657. * | name | value | verson |
  8658. * | --------------------------------------------------------- | ------------------------------- | ------ |
  8659. * | bold | | 2.7.0 |
  8660. * | italic | | 2.7.0 |
  8661. * | underline | | 2.7.0 |
  8662. * | strike | | 2.7.0 |
  8663. * | ins | | 2.7.0 |
  8664. * | script | sub / super | 2.7.0 |
  8665. * | header | H1 / H2 / h3 / H4 / h5 / H6 | 2.7.0 |
  8666. * | align | left / center / right / justify | 2.7.0 |
  8667. * | direction | rtl | 2.7.0 |
  8668. * | indent | -1 / +1 | 2.7.0 |
  8669. * | list | ordered / bullet / check | 2.7.0 |
  8670. * | color | hex color | 2.7.0 |
  8671. * | backgroundColor | hex color | 2.7.0 |
  8672. * | margin/marginTop/marginBottom/marginLeft/marginRight | css style | 2.7.0 |
  8673. * | padding/paddingTop/paddingBottom/paddingLeft/paddingRight | css style | 2.7.0 |
  8674. * | font/fontSize/fontStyle/fontVariant/fontWeight/fontFamily | css style | 2.7.0 |
  8675. * | lineHeight | css style | 2.7.0 |
  8676. * | letterSpacing | css style | 2.7.0 |
  8677. * | textDecoration | css style | 2.7.0 |
  8678. * | textIndent | css style | 2.8.0 |
  8679. * | wordWrap | css style | 2.10.2 |
  8680. * | wordBreak | css style | 2.10.2 |
  8681. * | whiteSpace | css style | 2.10.2 |
  8682. *
  8683. * 对已经应用样式的选区设置会取消样式。css style 表示 css 中规定的允许值。
  8684. *
  8685. * 最低基础库: `2.7.0` */
  8686. format(
  8687. /** 属性 */
  8688. name: string,
  8689. /** 值 */
  8690. value?: string
  8691. ): void
  8692. /** [EditorContext.getContents(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getContents.html)
  8693. *
  8694. * 获取编辑器内容
  8695. *
  8696. * 最低基础库: `2.7.0` */
  8697. getContents(option?: GetContentsOption): void
  8698. /** [EditorContext.getSelectionText(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getSelectionText.html)
  8699. *
  8700. * 获取编辑器已选区域内的纯文本内容。当编辑器失焦或未选中一段区间时,返回内容为空。
  8701. *
  8702. * 最低基础库: `2.10.2` */
  8703. getSelectionText(option?: GetSelectionTextOption): void
  8704. /** [EditorContext.insertDivider(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertDivider.html)
  8705. *
  8706. * 插入分割线
  8707. *
  8708. * 最低基础库: `2.7.0` */
  8709. insertDivider(option?: InsertDividerOption): void
  8710. /** [EditorContext.insertImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertImage.html)
  8711. *
  8712. * 插入图片。
  8713. *
  8714. * 地址为临时文件时,获取的编辑器html格式内容中 <img> 标签增加属性 data-local,delta 格式内容中图片 attributes 属性增加 data-local 字段,该值为传入的临时文件地址。
  8715. *
  8716. * 开发者可选择在提交阶段上传图片到服务器,获取到网络地址后进行替换。替换时对于html内容应替换掉 <img> 的 src 值,对于 delta 内容应替换掉 `insert { image: abc }` 值。
  8717. *
  8718. * **示例代码**
  8719. *
  8720. *
  8721. * ```javascript
  8722. this.editorCtx.insertImage({
  8723. src: 'xx',
  8724. width: '100px',
  8725. height: '50px',
  8726. extClass: className
  8727. })
  8728. ```
  8729. *
  8730. * 最低基础库: `2.7.0` */
  8731. insertImage(option: InsertImageOption): void
  8732. /** [EditorContext.insertText(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertText.html)
  8733. *
  8734. * 覆盖当前选区,设置一段文本
  8735. *
  8736. * 最低基础库: `2.7.0` */
  8737. insertText(option: InsertTextOption): void
  8738. /** [EditorContext.redo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.redo.html)
  8739. *
  8740. * 恢复
  8741. *
  8742. * 最低基础库: `2.7.0` */
  8743. redo(option?: RedoOption): void
  8744. /** [EditorContext.removeFormat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.removeFormat.html)
  8745. *
  8746. * 清除当前选区的样式
  8747. *
  8748. * 最低基础库: `2.7.0` */
  8749. removeFormat(option?: RemoveFormatOption): void
  8750. /** [EditorContext.scrollIntoView()](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.scrollIntoView.html)
  8751. *
  8752. * 使得编辑器光标处滚动到窗口可视区域内。
  8753. *
  8754. * 最低基础库: `2.8.3` */
  8755. scrollIntoView(): void
  8756. /** [EditorContext.setContents(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.setContents.html)
  8757. *
  8758. * 初始化编辑器内容,html和delta同时存在时仅delta生效
  8759. *
  8760. * 最低基础库: `2.7.0` */
  8761. setContents(option: SetContentsOption): void
  8762. /** [EditorContext.undo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.undo.html)
  8763. *
  8764. * 撤销
  8765. *
  8766. * 最低基础库: `2.7.0` */
  8767. undo(option?: UndoOption): void
  8768. }
  8769. interface EntryList {
  8770. /** [Array EntryList.getEntries()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/EntryList.getEntries.html)
  8771. *
  8772. * 该方法返回当前列表中的所有性能数据
  8773. *
  8774. * 最低基础库: `2.11.0` */
  8775. getEntries(): any[]
  8776. /** [Array EntryList.getEntriesByName(string name, string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/EntryList.getEntriesByName.html)
  8777. *
  8778. * 获取当前列表中所有名称为 [name] 且类型为 [entryType] 的性能数据
  8779. *
  8780. * 最低基础库: `2.11.0` */
  8781. getEntriesByName(name: string, entryType?: string): any[]
  8782. /** [Array EntryList.getEntriesByType(string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/EntryList.getEntriesByType.html)
  8783. *
  8784. * 获取当前列表中所有类型为 [entryType] 的性能数据
  8785. *
  8786. * 最低基础库: `2.11.0` */
  8787. getEntriesByType(entryType: string): any[]
  8788. }
  8789. interface EventChannel {
  8790. /** [EventChannel.emit(string eventName, any args)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.emit.html)
  8791. *
  8792. * 触发一个事件
  8793. *
  8794. * 最低基础库: `2.7.3` */
  8795. emit(
  8796. /** 事件名称 */
  8797. eventName: string,
  8798. /** 事件参数 */
  8799. ...args: any
  8800. ): void
  8801. /** [EventChannel.off(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.off.html)
  8802. *
  8803. * 取消监听一个事件。给出第二个参数时,只取消给出的监听函数,否则取消所有监听函数
  8804. *
  8805. * 最低基础库: `2.7.3` */
  8806. off(
  8807. /** 事件名称 */
  8808. eventName: string,
  8809. /** 事件监听函数 */
  8810. fn: EventCallback
  8811. ): void
  8812. /** [EventChannel.on(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.on.html)
  8813. *
  8814. * 持续监听一个事件
  8815. *
  8816. * 最低基础库: `2.7.3` */
  8817. on(
  8818. /** 事件名称 */
  8819. eventName: string,
  8820. /** 事件监听函数 */
  8821. fn: EventCallback
  8822. ): void
  8823. /** [EventChannel.once(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.once.html)
  8824. *
  8825. * 监听一个事件一次,触发后失效
  8826. *
  8827. * 最低基础库: `2.7.3` */
  8828. once(
  8829. /** 事件名称 */
  8830. eventName: string,
  8831. /** 事件监听函数 */
  8832. fn: EventCallback
  8833. ): void
  8834. }
  8835. interface FileSystemManager {
  8836. /** [Array.&lt;string&gt; FileSystemManager.readdirSync(string dirPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdirSync.html)
  8837. *
  8838. * [FileSystemManager.readdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdir.html) 的同步版本 */
  8839. readdirSync(
  8840. /** 要读取的目录路径 (本地路径) */
  8841. dirPath: string
  8842. ): string[]
  8843. /** [FileSystemManager.access(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html)
  8844. *
  8845. * 判断文件/目录是否存在 */
  8846. access(option: AccessOption): void
  8847. /** [FileSystemManager.accessSync(string path)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.accessSync.html)
  8848. *
  8849. * [FileSystemManager.access](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html) 的同步版本 */
  8850. accessSync(
  8851. /** 要判断是否存在的文件/目录路径 (本地路径) */
  8852. path: string
  8853. ): void
  8854. /** [FileSystemManager.appendFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFile.html)
  8855. *
  8856. * 在文件结尾追加内容
  8857. *
  8858. * 最低基础库: `2.1.0` */
  8859. appendFile(option: AppendFileOption): void
  8860. /** [FileSystemManager.appendFileSync(string filePath, string|ArrayBuffer data, string encoding)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFileSync.html)
  8861. *
  8862. * [FileSystemManager.appendFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFile.html) 的同步版本
  8863. *
  8864. * 最低基础库: `2.1.0` */
  8865. appendFileSync(
  8866. /** 要追加内容的文件路径 (本地路径) */
  8867. filePath: string,
  8868. /** 要追加的文本或二进制数据 */
  8869. data: string | ArrayBuffer,
  8870. /** 指定写入文件的字符编码
  8871. *
  8872. * 参数 encoding 可选值:
  8873. * - 'ascii': ;
  8874. * - 'base64': ;
  8875. * - 'binary': ;
  8876. * - 'hex': ;
  8877. * - 'ucs2': 以小端序读取;
  8878. * - 'ucs-2': 以小端序读取;
  8879. * - 'utf16le': 以小端序读取;
  8880. * - 'utf-16le': 以小端序读取;
  8881. * - 'utf-8': ;
  8882. * - 'utf8': ;
  8883. * - 'latin1': ; */
  8884. encoding?:
  8885. | 'ascii'
  8886. | 'base64'
  8887. | 'binary'
  8888. | 'hex'
  8889. | 'ucs2'
  8890. | 'ucs-2'
  8891. | 'utf16le'
  8892. | 'utf-16le'
  8893. | 'utf-8'
  8894. | 'utf8'
  8895. | 'latin1'
  8896. ): void
  8897. /** [FileSystemManager.copyFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html)
  8898. *
  8899. * 复制文件 */
  8900. copyFile(option: CopyFileOption): void
  8901. /** [FileSystemManager.copyFileSync(string srcPath, string destPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFileSync.html)
  8902. *
  8903. * [FileSystemManager.copyFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html) 的同步版本 */
  8904. copyFileSync(
  8905. /** 源文件路径,支持本地路径 */
  8906. srcPath: string,
  8907. /** 目标文件路径,支持本地路径 */
  8908. destPath: string
  8909. ): void
  8910. /** [FileSystemManager.getFileInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.getFileInfo.html)
  8911. *
  8912. * 获取该小程序下的 本地临时文件 或 本地缓存文件 信息 */
  8913. getFileInfo(option: FileSystemManagerGetFileInfoOption): void
  8914. /** [FileSystemManager.getSavedFileList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.getSavedFileList.html)
  8915. *
  8916. * 获取该小程序下已保存的本地缓存文件列表 */
  8917. getSavedFileList(option?: FileSystemManagerGetSavedFileListOption): void
  8918. /** [FileSystemManager.mkdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdir.html)
  8919. *
  8920. * 创建目录 */
  8921. mkdir(option: MkdirOption): void
  8922. /** [FileSystemManager.mkdirSync(string dirPath, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdirSync.html)
  8923. *
  8924. * [FileSystemManager.mkdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdir.html) 的同步版本 */
  8925. mkdirSync(
  8926. /** 创建的目录路径 (本地路径) */
  8927. dirPath: string,
  8928. /** 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。
  8929. *
  8930. * 最低基础库: `2.3.0` */
  8931. recursive?: boolean
  8932. ): void
  8933. /** [FileSystemManager.readFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html)
  8934. *
  8935. * 读取本地文件内容 */
  8936. readFile(option: ReadFileOption): void
  8937. /** [FileSystemManager.readdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdir.html)
  8938. *
  8939. * 读取目录内文件列表 */
  8940. readdir(option: ReaddirOption): void
  8941. /** [FileSystemManager.removeSavedFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.removeSavedFile.html)
  8942. *
  8943. * 删除该小程序下已保存的本地缓存文件 */
  8944. removeSavedFile(option: FileSystemManagerRemoveSavedFileOption): void
  8945. /** [FileSystemManager.rename(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rename.html)
  8946. *
  8947. * 重命名文件。可以把文件从 oldPath 移动到 newPath */
  8948. rename(option: RenameOption): void
  8949. /** [FileSystemManager.renameSync(string oldPath, string newPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.renameSync.html)
  8950. *
  8951. * [FileSystemManager.rename](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rename.html) 的同步版本 */
  8952. renameSync(
  8953. /** 源文件路径,支持本地路径 */
  8954. oldPath: string,
  8955. /** 新文件路径,支持本地路径 */
  8956. newPath: string
  8957. ): void
  8958. /** [FileSystemManager.rmdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdir.html)
  8959. *
  8960. * 删除目录 */
  8961. rmdir(option: RmdirOption): void
  8962. /** [FileSystemManager.rmdirSync(string dirPath, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdirSync.html)
  8963. *
  8964. * [FileSystemManager.rmdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdir.html) 的同步版本 */
  8965. rmdirSync(
  8966. /** 要删除的目录路径 (本地路径) */
  8967. dirPath: string,
  8968. /** 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。
  8969. *
  8970. * 最低基础库: `2.3.0` */
  8971. recursive?: boolean
  8972. ): void
  8973. /** [FileSystemManager.saveFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFile.html)
  8974. *
  8975. * 保存临时文件到本地。此接口会移动临时文件,因此调用成功后,tempFilePath 将不可用。 */
  8976. saveFile(option: FileSystemManagerSaveFileOption): void
  8977. /** [FileSystemManager.stat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.stat.html)
  8978. *
  8979. * 获取文件 Stats 对象 */
  8980. stat(option: StatOption): void
  8981. /** [FileSystemManager.unlink(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlink.html)
  8982. *
  8983. * 删除文件 */
  8984. unlink(option: UnlinkOption): void
  8985. /** [FileSystemManager.unlinkSync(string filePath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlinkSync.html)
  8986. *
  8987. * [FileSystemManager.unlink](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlink.html) 的同步版本 */
  8988. unlinkSync(
  8989. /** 要删除的文件路径 (本地路径) */
  8990. filePath: string
  8991. ): void
  8992. /** [FileSystemManager.unzip(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unzip.html)
  8993. *
  8994. * 解压文件 */
  8995. unzip(option: UnzipOption): void
  8996. /** [FileSystemManager.writeFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFile.html)
  8997. *
  8998. * 写文件 */
  8999. writeFile(option: WriteFileOption): void
  9000. /** [FileSystemManager.writeFileSync(string filePath, string|ArrayBuffer data, string encoding)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFileSync.html)
  9001. *
  9002. * [FileSystemManager.writeFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFile.html) 的同步版本 */
  9003. writeFileSync(
  9004. /** 要写入的文件路径 (本地路径) */
  9005. filePath: string,
  9006. /** 要写入的文本或二进制数据 */
  9007. data: string | ArrayBuffer,
  9008. /** 指定写入文件的字符编码
  9009. *
  9010. * 参数 encoding 可选值:
  9011. * - 'ascii': ;
  9012. * - 'base64': ;
  9013. * - 'binary': ;
  9014. * - 'hex': ;
  9015. * - 'ucs2': 以小端序读取;
  9016. * - 'ucs-2': 以小端序读取;
  9017. * - 'utf16le': 以小端序读取;
  9018. * - 'utf-16le': 以小端序读取;
  9019. * - 'utf-8': ;
  9020. * - 'utf8': ;
  9021. * - 'latin1': ; */
  9022. encoding?:
  9023. | 'ascii'
  9024. | 'base64'
  9025. | 'binary'
  9026. | 'hex'
  9027. | 'ucs2'
  9028. | 'ucs-2'
  9029. | 'utf16le'
  9030. | 'utf-16le'
  9031. | 'utf-8'
  9032. | 'utf8'
  9033. | 'latin1'
  9034. ): void
  9035. /** [[Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)|Object FileSystemManager.statSync(string path, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.statSync.html)
  9036. *
  9037. * [FileSystemManager.stat](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.stat.html) 的同步版本 */
  9038. statSync(
  9039. /** 文件/目录路径 (本地路径) */
  9040. path: string,
  9041. /** 是否递归获取目录下的每个文件的 Stats 信息
  9042. *
  9043. * 最低基础库: `2.3.0` */
  9044. recursive?: boolean
  9045. ): Stats | IAnyObject
  9046. /** [string FileSystemManager.saveFileSync(string tempFilePath, string filePath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFileSync.html)
  9047. *
  9048. * [FileSystemManager.saveFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFile.html) 的同步版本 */
  9049. saveFileSync(
  9050. /** 临时存储文件路径 (本地路径) */
  9051. tempFilePath: string,
  9052. /** 要存储的文件路径 (本地路径) */
  9053. filePath?: string
  9054. ): string
  9055. /** [string|ArrayBuffer FileSystemManager.readFileSync(string filePath, string encoding, number position, number length)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFileSync.html)
  9056. *
  9057. * [FileSystemManager.readFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html) 的同步版本 */
  9058. readFileSync(
  9059. /** 要读取的文件的路径 (本地路径) */
  9060. filePath: string,
  9061. /** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
  9062. *
  9063. * 参数 encoding 可选值:
  9064. * - 'ascii': ;
  9065. * - 'base64': ;
  9066. * - 'binary': ;
  9067. * - 'hex': ;
  9068. * - 'ucs2': 以小端序读取;
  9069. * - 'ucs-2': 以小端序读取;
  9070. * - 'utf16le': 以小端序读取;
  9071. * - 'utf-16le': 以小端序读取;
  9072. * - 'utf-8': ;
  9073. * - 'utf8': ;
  9074. * - 'latin1': ; */
  9075. encoding?:
  9076. | 'ascii'
  9077. | 'base64'
  9078. | 'binary'
  9079. | 'hex'
  9080. | 'ucs2'
  9081. | 'ucs-2'
  9082. | 'utf16le'
  9083. | 'utf-16le'
  9084. | 'utf-8'
  9085. | 'utf8'
  9086. | 'latin1',
  9087. /** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte
  9088. *
  9089. * 最低基础库: `2.10.0` */
  9090. position?: number,
  9091. /** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte
  9092. *
  9093. * 最低基础库: `2.10.0` */
  9094. length?: number
  9095. ): string | ArrayBuffer
  9096. }
  9097. interface GeneralCallbackResult {
  9098. errMsg: string
  9099. }
  9100. interface IBeaconError {
  9101. /** 错误信息
  9102. *
  9103. * | 错误码 | 错误信息 | 说明 |
  9104. * | - | - | - |
  9105. * | 0 | ok | 正常 |
  9106. * | 11000 | unsupport | 系统或设备不支持 |
  9107. * | 11001 | bluetooth service unavailable | 蓝牙服务不可用 |
  9108. * | 11002 | location service unavailable | 位置服务不可用 |
  9109. * | 11003 | already start | 已经开始搜索 |
  9110. * | 11004 | not startBeaconDiscovery | 还未开始搜索 |
  9111. * | 11005 | system error | 系统错误 |
  9112. * | 11006 | invalid data | 参数不正确 | */ errMsg: string
  9113. /** 错误码
  9114. *
  9115. * | 错误码 | 错误信息 | 说明 |
  9116. * | - | - | - |
  9117. * | 0 | ok | 正常 |
  9118. * | 11000 | unsupport | 系统或设备不支持 |
  9119. * | 11001 | bluetooth service unavailable | 蓝牙服务不可用 |
  9120. * | 11002 | location service unavailable | 位置服务不可用 |
  9121. * | 11003 | already start | 已经开始搜索 |
  9122. * | 11004 | not startBeaconDiscovery | 还未开始搜索 |
  9123. * | 11005 | system error | 系统错误 |
  9124. * | 11006 | invalid data | 参数不正确 | */ errCode: number
  9125. }
  9126. interface InnerAudioContext {
  9127. /** [InnerAudioContext.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.destroy.html)
  9128. *
  9129. * 销毁当前实例 */
  9130. destroy(): void
  9131. /** [InnerAudioContext.offCanplay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offCanplay.html)
  9132. *
  9133. * 取消监听音频进入可以播放状态的事件
  9134. *
  9135. * 最低基础库: `1.9.0` */
  9136. offCanplay(
  9137. /** 音频进入可以播放状态的事件的回调函数 */
  9138. callback?: OffCanplayCallback
  9139. ): void
  9140. /** [InnerAudioContext.offEnded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offEnded.html)
  9141. *
  9142. * 取消监听音频自然播放至结束的事件
  9143. *
  9144. * 最低基础库: `1.9.0` */
  9145. offEnded(
  9146. /** 音频自然播放至结束的事件的回调函数 */
  9147. callback?: OffEndedCallback
  9148. ): void
  9149. /** [InnerAudioContext.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offError.html)
  9150. *
  9151. * 取消监听音频播放错误事件
  9152. *
  9153. * 最低基础库: `1.9.0` */
  9154. offError(
  9155. /** 音频播放错误事件的回调函数 */
  9156. callback?: InnerAudioContextOffErrorCallback
  9157. ): void
  9158. /** [InnerAudioContext.offPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offPause.html)
  9159. *
  9160. * 取消监听音频暂停事件
  9161. *
  9162. * 最低基础库: `1.9.0` */
  9163. offPause(
  9164. /** 音频暂停事件的回调函数 */
  9165. callback?: OffPauseCallback
  9166. ): void
  9167. /** [InnerAudioContext.offPlay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offPlay.html)
  9168. *
  9169. * 取消监听音频播放事件
  9170. *
  9171. * 最低基础库: `1.9.0` */
  9172. offPlay(
  9173. /** 音频播放事件的回调函数 */
  9174. callback?: OffPlayCallback
  9175. ): void
  9176. /** [InnerAudioContext.offSeeked(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offSeeked.html)
  9177. *
  9178. * 取消监听音频完成跳转操作的事件
  9179. *
  9180. * 最低基础库: `1.9.0` */
  9181. offSeeked(
  9182. /** 音频完成跳转操作的事件的回调函数 */
  9183. callback?: OffSeekedCallback
  9184. ): void
  9185. /** [InnerAudioContext.offSeeking(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offSeeking.html)
  9186. *
  9187. * 取消监听音频进行跳转操作的事件
  9188. *
  9189. * 最低基础库: `1.9.0` */
  9190. offSeeking(
  9191. /** 音频进行跳转操作的事件的回调函数 */
  9192. callback?: OffSeekingCallback
  9193. ): void
  9194. /** [InnerAudioContext.offStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offStop.html)
  9195. *
  9196. * 取消监听音频停止事件
  9197. *
  9198. * 最低基础库: `1.9.0` */
  9199. offStop(
  9200. /** 音频停止事件的回调函数 */
  9201. callback?: OffStopCallback
  9202. ): void
  9203. /** [InnerAudioContext.offTimeUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offTimeUpdate.html)
  9204. *
  9205. * 取消监听音频播放进度更新事件
  9206. *
  9207. * 最低基础库: `1.9.0` */
  9208. offTimeUpdate(
  9209. /** 音频播放进度更新事件的回调函数 */
  9210. callback?: OffTimeUpdateCallback
  9211. ): void
  9212. /** [InnerAudioContext.offWaiting(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offWaiting.html)
  9213. *
  9214. * 取消监听音频加载中事件
  9215. *
  9216. * 最低基础库: `1.9.0` */
  9217. offWaiting(
  9218. /** 音频加载中事件的回调函数 */
  9219. callback?: OffWaitingCallback
  9220. ): void
  9221. /** [InnerAudioContext.onCanplay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onCanplay.html)
  9222. *
  9223. * 监听音频进入可以播放状态的事件。但不保证后面可以流畅播放 */
  9224. onCanplay(
  9225. /** 音频进入可以播放状态的事件的回调函数 */
  9226. callback: OnCanplayCallback
  9227. ): void
  9228. /** [InnerAudioContext.onEnded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onEnded.html)
  9229. *
  9230. * 监听音频自然播放至结束的事件 */
  9231. onEnded(
  9232. /** 音频自然播放至结束的事件的回调函数 */
  9233. callback: OnEndedCallback
  9234. ): void
  9235. /** [InnerAudioContext.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onError.html)
  9236. *
  9237. * 监听音频播放错误事件
  9238. *
  9239. * **Tips**
  9240. *
  9241. *
  9242. * 1. errCode=100001 时,如若 errMsg 中有 INNERCODE -11828 ,请先检查 response header 是否缺少 Content-Length
  9243. * 2. errCode=100001 时,如若 errMsg 中有 systemErrCode:200333420,请检查文件编码格式和 fileExtension 是否一致 */
  9244. onError(
  9245. /** 音频播放错误事件的回调函数 */
  9246. callback: InnerAudioContextOnErrorCallback
  9247. ): void
  9248. /** [InnerAudioContext.onPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onPause.html)
  9249. *
  9250. * 监听音频暂停事件 */
  9251. onPause(
  9252. /** 音频暂停事件的回调函数 */
  9253. callback: OnPauseCallback
  9254. ): void
  9255. /** [InnerAudioContext.onPlay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onPlay.html)
  9256. *
  9257. * 监听音频播放事件 */
  9258. onPlay(
  9259. /** 音频播放事件的回调函数 */
  9260. callback: OnPlayCallback
  9261. ): void
  9262. /** [InnerAudioContext.onSeeked(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onSeeked.html)
  9263. *
  9264. * 监听音频完成跳转操作的事件 */
  9265. onSeeked(
  9266. /** 音频完成跳转操作的事件的回调函数 */
  9267. callback: OnSeekedCallback
  9268. ): void
  9269. /** [InnerAudioContext.onSeeking(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onSeeking.html)
  9270. *
  9271. * 监听音频进行跳转操作的事件 */
  9272. onSeeking(
  9273. /** 音频进行跳转操作的事件的回调函数 */
  9274. callback: OnSeekingCallback
  9275. ): void
  9276. /** [InnerAudioContext.onStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onStop.html)
  9277. *
  9278. * 监听音频停止事件 */
  9279. onStop(
  9280. /** 音频停止事件的回调函数 */
  9281. callback: InnerAudioContextOnStopCallback
  9282. ): void
  9283. /** [InnerAudioContext.onTimeUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onTimeUpdate.html)
  9284. *
  9285. * 监听音频播放进度更新事件 */
  9286. onTimeUpdate(
  9287. /** 音频播放进度更新事件的回调函数 */
  9288. callback: OnTimeUpdateCallback
  9289. ): void
  9290. /** [InnerAudioContext.onWaiting(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onWaiting.html)
  9291. *
  9292. * 监听音频加载中事件。当音频因为数据不足,需要停下来加载时会触发 */
  9293. onWaiting(
  9294. /** 音频加载中事件的回调函数 */
  9295. callback: OnWaitingCallback
  9296. ): void
  9297. /** [InnerAudioContext.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.pause.html)
  9298. *
  9299. * 暂停。暂停后的音频再播放会从暂停处开始播放 */
  9300. pause(): void
  9301. /** [InnerAudioContext.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.play.html)
  9302. *
  9303. * 播放 */
  9304. play(): void
  9305. /** [InnerAudioContext.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.seek.html)
  9306. *
  9307. * 跳转到指定位置 */
  9308. seek(
  9309. /** 跳转的时间,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */
  9310. position: number
  9311. ): void
  9312. /** [InnerAudioContext.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.stop.html)
  9313. *
  9314. * 停止。停止后的音频再播放会从头开始播放。 */
  9315. stop(): void
  9316. }
  9317. interface IntersectionObserver {
  9318. /** [IntersectionObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.disconnect.html)
  9319. *
  9320. * 停止监听。回调函数将不再触发 */
  9321. disconnect(): void
  9322. /** [IntersectionObserver.observe(string targetSelector, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.observe.html)
  9323. *
  9324. * 指定目标节点并开始监听相交状态变化情况 */
  9325. observe(
  9326. /** 选择器 */
  9327. targetSelector: string,
  9328. /** 监听相交状态变化的回调函数 */
  9329. callback: IntersectionObserverObserveCallback
  9330. ): void
  9331. /** [[IntersectionObserver](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.html) IntersectionObserver.relativeTo(string selector, Object margins)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.relativeTo.html)
  9332. *
  9333. * 使用选择器指定一个节点,作为参照区域之一。 */
  9334. relativeTo(
  9335. /** 选择器 */
  9336. selector: string,
  9337. /** 用来扩展(或收缩)参照节点布局区域的边界 */
  9338. margins?: Margins
  9339. ): IntersectionObserver
  9340. /** [[IntersectionObserver](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.html) IntersectionObserver.relativeToViewport(Object margins)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.relativeToViewport.html)
  9341. *
  9342. * 指定页面显示区域作为参照区域之一
  9343. *
  9344. * **示例代码**
  9345. *
  9346. *
  9347. * 下面的示例代码中,如果目标节点(用选择器 .target-class 指定)进入显示区域以下 100px 时,就会触发回调函数。
  9348. * ```javascript
  9349. Page({
  9350. onLoad: function(){
  9351. wx.createIntersectionObserver().relativeToViewport({bottom: 100}).observe('.target-class', (res) => {
  9352. res.intersectionRatio // 相交区域占目标节点的布局区域的比例
  9353. res.intersectionRect // 相交区域
  9354. res.intersectionRect.left // 相交区域的左边界坐标
  9355. res.intersectionRect.top // 相交区域的上边界坐标
  9356. res.intersectionRect.width // 相交区域的宽度
  9357. res.intersectionRect.height // 相交区域的高度
  9358. })
  9359. }
  9360. })
  9361. ``` */
  9362. relativeToViewport(
  9363. /** 用来扩展(或收缩)参照节点布局区域的边界 */
  9364. margins?: Margins
  9365. ): IntersectionObserver
  9366. }
  9367. interface InterstitialAd {
  9368. /** [InterstitialAd.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.destroy.html)
  9369. *
  9370. * 销毁插屏广告实例。
  9371. *
  9372. * 最低基础库: `2.8.0` */
  9373. destroy(): void
  9374. /** [InterstitialAd.offClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offClose.html)
  9375. *
  9376. * 取消监听插屏广告关闭事件 */
  9377. offClose(
  9378. /** 插屏广告关闭事件的回调函数 */
  9379. callback?: UDPSocketOffCloseCallback
  9380. ): void
  9381. /** [InterstitialAd.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offError.html)
  9382. *
  9383. * 取消监听插屏错误事件 */
  9384. offError(
  9385. /** 插屏错误事件的回调函数 */
  9386. callback?: InterstitialAdOffErrorCallback
  9387. ): void
  9388. /** [InterstitialAd.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offLoad.html)
  9389. *
  9390. * 取消监听插屏广告加载事件 */
  9391. offLoad(
  9392. /** 插屏广告加载事件的回调函数 */
  9393. callback?: OffLoadCallback
  9394. ): void
  9395. /** [InterstitialAd.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onClose.html)
  9396. *
  9397. * 监听插屏广告关闭事件。 */
  9398. onClose(
  9399. /** 插屏广告关闭事件的回调函数 */
  9400. callback: UDPSocketOnCloseCallback
  9401. ): void
  9402. /** [InterstitialAd.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onError.html)
  9403. *
  9404. * 监听插屏错误事件。
  9405. *
  9406. * **错误码信息与解决方案表**
  9407. *
  9408. *
  9409. * 错误码是通过onError获取到的错误信息。调试期间,可以通过异常返回来捕获信息。
  9410. * 在小程序发布上线之后,如果遇到异常问题,可以在[“运维中心“](https://mp.weixin.qq.com/)里面搜寻错误日志,还可以针对异常返回加上适当的监控信息。
  9411. *
  9412. * | 代码 | 异常情况 | 理由 | 解决方案 |
  9413. * | ------ | -------------- | --------------- | -------------------------- |
  9414. * | 1000 | 后端错误调用失败 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。 |
  9415. * | 1001 | 参数错误 | 使用方法错误 | 可以前往developers.weixin.qq.com确认具体教程(小程序和小游戏分别有各自的教程,可以在顶部选项中,“设计”一栏的右侧进行切换。|
  9416. * | 1002 | 广告单元无效 | 可能是拼写错误、或者误用了其他APP的广告ID | 请重新前往mp.weixin.qq.com确认广告位ID。 |
  9417. * | 1003 | 内部错误 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。|
  9418. * | 1004 | 无适合的广告 | 广告不是每一次都会出现,这次没有出现可能是由于该用户不适合浏览广告 | 属于正常情况,且开发者需要针对这种情况做形态上的兼容。 |
  9419. * | 1005 | 广告组件审核中 | 你的广告正在被审核,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。|
  9420. * | 1006 | 广告组件被驳回 | 你的广告审核失败,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。|
  9421. * | 1007 | 广告组件被驳回 | 你的广告能力已经被封禁,封禁期间无法展现广告 | 请前往mp.weixin.qq.com确认小程序广告封禁状态。 |
  9422. * | 1008 | 广告单元已关闭 | 该广告位的广告能力已经被关闭 | 请前往mp.weixin.qq.com重新打开对应广告位的展现。| */
  9423. onError(
  9424. /** 插屏错误事件的回调函数 */
  9425. callback: InterstitialAdOnErrorCallback
  9426. ): void
  9427. /** [InterstitialAd.onLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onLoad.html)
  9428. *
  9429. * 监听插屏广告加载事件。 */
  9430. onLoad(
  9431. /** 插屏广告加载事件的回调函数 */
  9432. callback: OnLoadCallback
  9433. ): void
  9434. /** [Promise InterstitialAd.load()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.load.html)
  9435. *
  9436. * 加载插屏广告。
  9437. *
  9438. * 最低基础库: `2.8.0` */
  9439. load(): Promise<any>
  9440. /** [Promise InterstitialAd.show()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.show.html)
  9441. *
  9442. * 显示插屏广告。
  9443. *
  9444. * **错误码信息表**
  9445. *
  9446. *
  9447. * 如果插屏广告显示失败,InterstitialAd.show() 方法会返回一个rejected Promise,开发者可以获取到错误码及对应的错误信息。
  9448. *
  9449. * | 代码 | 异常情况 | 理由 |
  9450. * | ------ | -------------- | -------------------------- |
  9451. * | 2001 | 触发频率限制 | 小程序启动一定时间内不允许展示插屏广告 |
  9452. * | 2002 | 触发频率限制 | 距离小程序插屏广告或者激励视频广告上次播放时间间隔不足,不允许展示插屏广告 |
  9453. * | 2003 | 触发频率限制 | 当前正在播放激励视频广告或者插屏广告,不允许再次展示插屏广告 |
  9454. * | 2004 | 广告渲染失败 | 该项错误不是开发者的异常情况,或因小程序页面切换导致广告渲染失败 |
  9455. * | 2005 | 广告调用异常 | 插屏广告实例不允许跨页面调用 | */
  9456. show(): Promise<any>
  9457. }
  9458. interface IsoDep {
  9459. /** [IsoDep.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.close.html)
  9460. *
  9461. * 断开连接
  9462. *
  9463. * 最低基础库: `2.11.2` */
  9464. close(option?: NdefCloseOption): void
  9465. /** [IsoDep.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.connect.html)
  9466. *
  9467. * 连接 NFC 标签
  9468. *
  9469. * 最低基础库: `2.11.2` */
  9470. connect(option?: ConnectOption): void
  9471. /** [IsoDep.getHistoricalBytes(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.getHistoricalBytes.html)
  9472. *
  9473. * 获取复位信息
  9474. *
  9475. * 最低基础库: `2.11.2` */
  9476. getHistoricalBytes(option?: GetHistoricalBytesOption): void
  9477. /** [IsoDep.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.getMaxTransceiveLength.html)
  9478. *
  9479. * 获取最大传输长度
  9480. *
  9481. * 最低基础库: `2.11.2` */
  9482. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  9483. /** [IsoDep.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.isConnected.html)
  9484. *
  9485. * 检查是否已连接
  9486. *
  9487. * 最低基础库: `2.11.2` */
  9488. isConnected(option?: IsConnectedOption): void
  9489. /** [IsoDep.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.setTimeout.html)
  9490. *
  9491. * 设置超时时间
  9492. *
  9493. * 最低基础库: `2.11.2` */
  9494. setTimeout(option: SetTimeoutOption): void
  9495. /** [IsoDep.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.transceive.html)
  9496. *
  9497. * 发送数据
  9498. *
  9499. * 最低基础库: `2.11.2` */
  9500. transceive(option: TransceiveOption): void
  9501. }
  9502. interface JoinVoIPChatError {
  9503. /** 错误信息
  9504. *
  9505. * | 错误码 | 错误信息 | 说明 |
  9506. * | - | - | - |
  9507. * | -1 | 当前已在房间内 | |
  9508. * | -2 | 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 | |
  9509. * | -3 | 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 | |
  9510. * | -1000 | 系统错误 | | */ errMsg: string
  9511. /** 错误码
  9512. *
  9513. * | 错误码 | 错误信息 | 说明 |
  9514. * | - | - | - |
  9515. * | -1 | 当前已在房间内 | |
  9516. * | -2 | 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 | |
  9517. * | -3 | 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 | |
  9518. * | -1000 | 系统错误 | | */ errCode: number
  9519. }
  9520. interface LivePlayerContext {
  9521. /** [LivePlayerContext.exitFullScreen(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitFullScreen.html)
  9522. *
  9523. * 退出全屏 */
  9524. exitFullScreen(option?: ExitFullScreenOption): void
  9525. /** [LivePlayerContext.exitPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitPictureInPicture.html)
  9526. *
  9527. * 退出小窗,该方法可在任意页面调用 */
  9528. exitPictureInPicture(option?: ExitPictureInPictureOption): void
  9529. /** [LivePlayerContext.mute(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.mute.html)
  9530. *
  9531. * 静音 */
  9532. mute(option?: MuteOption): void
  9533. /** [LivePlayerContext.pause(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.pause.html)
  9534. *
  9535. * 暂停
  9536. *
  9537. * 最低基础库: `1.9.90` */
  9538. pause(option?: PauseOption): void
  9539. /** [LivePlayerContext.play(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.play.html)
  9540. *
  9541. * 播放 */
  9542. play(option?: PlayOption): void
  9543. /** [LivePlayerContext.requestFullScreen(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.requestFullScreen.html)
  9544. *
  9545. * 进入全屏 */
  9546. requestFullScreen(
  9547. option: LivePlayerContextRequestFullScreenOption
  9548. ): void
  9549. /** [LivePlayerContext.requestPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.requestPictureInPicture.html)
  9550. *
  9551. * 进入小窗
  9552. *
  9553. * 最低基础库: `2.15.0` */
  9554. requestPictureInPicture(option?: RequestPictureInPictureOption): void
  9555. /** [LivePlayerContext.resume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.resume.html)
  9556. *
  9557. * 恢复
  9558. *
  9559. * 最低基础库: `1.9.90` */
  9560. resume(option?: ResumeOption): void
  9561. /** [LivePlayerContext.snapshot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.snapshot.html)
  9562. *
  9563. * 截图
  9564. *
  9565. * 最低基础库: `2.7.1` */
  9566. snapshot(option: LivePlayerContextSnapshotOption): void
  9567. /** [LivePlayerContext.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.stop.html)
  9568. *
  9569. * 停止 */
  9570. stop(option?: StopOption): void
  9571. }
  9572. interface LivePusherContext {
  9573. /** [LivePusherContext.pause(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.pause.html)
  9574. *
  9575. * 暂停推流 */
  9576. pause(option?: PauseOption): void
  9577. /** [LivePusherContext.pauseBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.pauseBGM.html)
  9578. *
  9579. * 暂停背景音
  9580. *
  9581. * 最低基础库: `2.4.0` */
  9582. pauseBGM(option?: PauseBGMOption): void
  9583. /** [LivePusherContext.playBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.playBGM.html)
  9584. *
  9585. * 播放背景音
  9586. *
  9587. * 最低基础库: `2.4.0` */
  9588. playBGM(option: PlayBGMOption): void
  9589. /** [LivePusherContext.resume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.resume.html)
  9590. *
  9591. * 恢复推流 */
  9592. resume(option?: ResumeOption): void
  9593. /** [LivePusherContext.resumeBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.resumeBGM.html)
  9594. *
  9595. * 恢复背景音
  9596. *
  9597. * 最低基础库: `2.4.0` */
  9598. resumeBGM(option?: ResumeBGMOption): void
  9599. /** [LivePusherContext.sendMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.sendMessage.html)
  9600. *
  9601. * 发送SEI消息
  9602. *
  9603. * 最低基础库: `2.10.0` */
  9604. sendMessage(option?: SendMessageOption): void
  9605. /** [LivePusherContext.setBGMVolume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.setBGMVolume.html)
  9606. *
  9607. * 设置背景音音量
  9608. *
  9609. * 最低基础库: `2.4.0` */
  9610. setBGMVolume(option: SetBGMVolumeOption): void
  9611. /** [LivePusherContext.setMICVolume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.setMICVolume.html)
  9612. *
  9613. * 设置麦克风音量
  9614. *
  9615. * 最低基础库: `2.10.0` */
  9616. setMICVolume(option: SetMICVolumeOption): void
  9617. /** [LivePusherContext.snapshot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.snapshot.html)
  9618. *
  9619. * 快照
  9620. *
  9621. * 最低基础库: `1.9.90` */
  9622. snapshot(option: LivePusherContextSnapshotOption): void
  9623. /** [LivePusherContext.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.start.html)
  9624. *
  9625. * 开始推流,同时开启摄像头预览 */
  9626. start(option?: CameraFrameListenerStartOption): void
  9627. /** [LivePusherContext.startPreview(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.startPreview.html)
  9628. *
  9629. * 开启摄像头预览
  9630. *
  9631. * 最低基础库: `2.7.0` */
  9632. startPreview(option?: StartPreviewOption): void
  9633. /** [LivePusherContext.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.stop.html)
  9634. *
  9635. * 停止推流,同时停止摄像头预览 */
  9636. stop(option?: StopOption): void
  9637. /** [LivePusherContext.stopBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.stopBGM.html)
  9638. *
  9639. * 停止背景音
  9640. *
  9641. * 最低基础库: `2.4.0` */
  9642. stopBGM(option?: StopBGMOption): void
  9643. /** [LivePusherContext.stopPreview(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.stopPreview.html)
  9644. *
  9645. * 关闭摄像头预览
  9646. *
  9647. * 最低基础库: `2.7.0` */
  9648. stopPreview(option?: StopPreviewOption): void
  9649. /** [LivePusherContext.switchCamera(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.switchCamera.html)
  9650. *
  9651. * 切换前后摄像头 */
  9652. switchCamera(option?: SwitchCameraOption): void
  9653. /** [LivePusherContext.toggleTorch(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.toggleTorch.html)
  9654. *
  9655. * 切换手电筒
  9656. *
  9657. * 最低基础库: `2.1.0` */
  9658. toggleTorch(option?: ToggleTorchOption): void
  9659. }
  9660. interface LogManager {
  9661. /** [LogManager.debug()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.debug.html)
  9662. *
  9663. * 写 debug 日志 */
  9664. debug(
  9665. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */
  9666. ...args: any[]
  9667. ): void
  9668. /** [LogManager.info()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.info.html)
  9669. *
  9670. * 写 info 日志 */
  9671. info(
  9672. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */
  9673. ...args: any[]
  9674. ): void
  9675. /** [LogManager.log()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.log.html)
  9676. *
  9677. * 写 log 日志 */
  9678. log(
  9679. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */
  9680. ...args: any[]
  9681. ): void
  9682. /** [LogManager.warn()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.warn.html)
  9683. *
  9684. * 写 warn 日志 */
  9685. warn(
  9686. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */
  9687. ...args: any[]
  9688. ): void
  9689. }
  9690. interface MapContext {
  9691. /** [MapContext.addCustomLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addCustomLayer.html)
  9692. *
  9693. * 添加个性化图层。
  9694. *
  9695. * 最低基础库: `2.12.0` */
  9696. addCustomLayer(option: AddCustomLayerOption): void
  9697. /** [MapContext.addGroundOverlay(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addGroundOverlay.html)
  9698. *
  9699. * 创建自定义图片图层,图片会随着地图缩放而缩放。
  9700. *
  9701. * 最低基础库: `2.14.0` */
  9702. addGroundOverlay(option: AddGroundOverlayOption): void
  9703. /** [MapContext.addMarkers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addMarkers.html)
  9704. *
  9705. * 添加 marker。
  9706. *
  9707. * 最低基础库: `2.13.0` */
  9708. addMarkers(option: AddMarkersOption): void
  9709. /** [MapContext.fromScreenLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.fromScreenLocation.html)
  9710. *
  9711. * 获取屏幕上的点对应的经纬度,坐标原点为地图左上角。
  9712. *
  9713. * 最低基础库: `2.14.0` */
  9714. fromScreenLocation(option: FromScreenLocationOption): void
  9715. /** [MapContext.getCenterLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getCenterLocation.html)
  9716. *
  9717. * 获取当前地图中心的经纬度。返回的是 gcj02 坐标系,可以用于 [wx.openLocation()](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.openLocation.html) */
  9718. getCenterLocation(option?: GetCenterLocationOption): void
  9719. /** [MapContext.getRegion(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getRegion.html)
  9720. *
  9721. * 获取当前地图的视野范围
  9722. *
  9723. * 最低基础库: `1.4.0` */
  9724. getRegion(option?: GetRegionOption): void
  9725. /** [MapContext.getRotate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getRotate.html)
  9726. *
  9727. * 获取当前地图的旋转角
  9728. *
  9729. * 最低基础库: `2.8.0` */
  9730. getRotate(option?: GetRotateOption): void
  9731. /** [MapContext.getScale(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getScale.html)
  9732. *
  9733. * 获取当前地图的缩放级别
  9734. *
  9735. * 最低基础库: `1.4.0` */
  9736. getScale(option?: GetScaleOption): void
  9737. /** [MapContext.getSkew(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getSkew.html)
  9738. *
  9739. * 获取当前地图的倾斜角
  9740. *
  9741. * 最低基础库: `2.8.0` */
  9742. getSkew(option?: GetSkewOption): void
  9743. /** [MapContext.includePoints(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.includePoints.html)
  9744. *
  9745. * 缩放视野展示所有经纬度
  9746. *
  9747. * 最低基础库: `1.2.0` */
  9748. includePoints(option: IncludePointsOption): void
  9749. /** [MapContext.initMarkerCluster(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.initMarkerCluster.html)
  9750. *
  9751. * 初始化点聚合的配置,未调用时采用默认配置。
  9752. *
  9753. * 最低基础库: `2.13.0` */
  9754. initMarkerCluster(option: InitMarkerClusterOption): void
  9755. /** [MapContext.moveAlong(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.moveAlong.html)
  9756. *
  9757. * 沿指定路径移动 `marker`,用于轨迹回放等场景。动画完成时触发回调事件,若动画进行中,对同一 `marker` 再次调用 `moveAlong` 方法,前一次的动画将被打断。
  9758. *
  9759. * 最低基础库: `2.13.0` */
  9760. moveAlong(option: MoveAlongOption): void
  9761. /** [MapContext.moveToLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.moveToLocation.html)
  9762. *
  9763. * 将地图中心移置当前定位点,此时需设置地图组件 show-location 为true。[2.8.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起支持将地图中心移动到指定位置。
  9764. *
  9765. * 最低基础库: `1.2.0` */
  9766. moveToLocation(option?: MoveToLocationOption): void
  9767. /** [MapContext.on(string event, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.on.html)
  9768. *
  9769. * 监听地图事件。
  9770. *
  9771. * ### markerClusterCreate
  9772. *
  9773. * 缩放或拖动导致新的聚合簇产生时触发,仅返回新创建的聚合簇信息。
  9774. *
  9775. * #### 返回参数
  9776. *
  9777. * | 参数 | 类型 | 说明 |
  9778. * | --------- | ------ | --------- |
  9779. * | clusters | `Array&lt;ClusterInfo&gt;` | 聚合簇数据 |
  9780. *
  9781. * ### markerClusterClick
  9782. *
  9783. * 聚合簇的点击事件。
  9784. *
  9785. * #### 返回参数
  9786. *
  9787. * | 参数 | 类型 | 说明 |
  9788. * | --------- | ------------- | --------- |
  9789. * | cluster | ClusterInfo | 聚合簇 |
  9790. *
  9791. *
  9792. * #### ClusterInfo 结构
  9793. *
  9794. * | 参数 | 类型 | 说明 |
  9795. * | ---------- | -------------------- | -------------------------- |
  9796. * | clusterId | Number | 聚合簇的 id |
  9797. * | center | LatLng | 聚合簇的坐标 |
  9798. * | markerIds | `Array&lt;Number&gt;` | 该聚合簇内的点标记数据数组 |
  9799. *
  9800. * **示例代码**
  9801. *
  9802. *
  9803. *
  9804. * ```js
  9805. MapContext.on('markerClusterCreate', (res) => {})
  9806. MapContext.on('markerClusterClick', (res) => {})
  9807. ```
  9808. *
  9809. * 最低基础库: `2.13.0` */
  9810. on(
  9811. /** 事件名
  9812. *
  9813. * 参数 event 可选值:
  9814. * - 'markerClusterCreate': ;
  9815. * - 'markerClusterClick': ; */
  9816. event: 'markerClusterCreate' | 'markerClusterClick',
  9817. /** 事件的回调函数 */
  9818. callback: (...args: any[]) => any
  9819. ): void
  9820. /** [MapContext.openMapApp(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.openMapApp.html)
  9821. *
  9822. * 拉起地图APP选择导航。
  9823. *
  9824. * 最低基础库: `2.14.0` */
  9825. openMapApp(option: OpenMapAppOption): void
  9826. /** [MapContext.removeCustomLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeCustomLayer.html)
  9827. *
  9828. * 移除个性化图层。
  9829. *
  9830. * 最低基础库: `2.12.0` */
  9831. removeCustomLayer(option: RemoveCustomLayerOption): void
  9832. /** [MapContext.removeGroundOverlay(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeGroundOverlay.html)
  9833. *
  9834. * 移除自定义图片图层。
  9835. *
  9836. * 最低基础库: `2.14.0` */
  9837. removeGroundOverlay(option: RemoveGroundOverlayOption): void
  9838. /** [MapContext.removeMarkers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeMarkers.html)
  9839. *
  9840. * 移除 marker。
  9841. *
  9842. * 最低基础库: `2.13.0` */
  9843. removeMarkers(option: RemoveMarkersOption): void
  9844. /** [MapContext.setCenterOffset(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setCenterOffset.html)
  9845. *
  9846. * 设置地图中心点偏移,向后向下为增长,屏幕比例范围(0.25~0.75),默认偏移为[0.5, 0.5]
  9847. *
  9848. * 最低基础库: `2.10.0` */
  9849. setCenterOffset(option: SetCenterOffsetOption): void
  9850. /** [MapContext.toScreenLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.toScreenLocation.html)
  9851. *
  9852. * 获取经纬度对应的屏幕坐标,坐标原点为地图左上角。
  9853. *
  9854. * 最低基础库: `2.14.0` */
  9855. toScreenLocation(option: ToScreenLocationOption): void
  9856. /** [MapContext.translateMarker(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.translateMarker.html)
  9857. *
  9858. * 平移marker,带动画。
  9859. *
  9860. * 最低基础库: `1.2.0` */
  9861. translateMarker(option: TranslateMarkerOption): void
  9862. /** [MapContext.updateGroundOverlay(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.updateGroundOverlay.html)
  9863. *
  9864. * 更新自定义图片图层。
  9865. *
  9866. * 最低基础库: `2.14.0` */
  9867. updateGroundOverlay(option: UpdateGroundOverlayOption): void
  9868. }
  9869. interface MediaAudioPlayer {
  9870. /** [Promise MediaAudioPlayer.addAudioSource([VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) source)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.addAudioSource.html)
  9871. *
  9872. * 添加音频源 */
  9873. addAudioSource(
  9874. /** [VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html)
  9875. *
  9876. * 视频解码器实例。作为音频源添加到音频播放器中 */
  9877. source: VideoDecoder
  9878. ): Promise<any>
  9879. /** [Promise MediaAudioPlayer.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.destroy.html)
  9880. *
  9881. * 销毁播放器 */
  9882. destroy(): Promise<any>
  9883. /** [Promise MediaAudioPlayer.removeAudioSource([VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) source)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.removeAudioSource.html)
  9884. *
  9885. * 移除音频源 */
  9886. removeAudioSource(
  9887. /** [VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html)
  9888. *
  9889. * 视频解码器实例 */
  9890. source: VideoDecoder
  9891. ): Promise<any>
  9892. /** [Promise MediaAudioPlayer.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.start.html)
  9893. *
  9894. * 启动播放器 */
  9895. start(): Promise<any>
  9896. /** [Promise MediaAudioPlayer.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.stop.html)
  9897. *
  9898. * 停止播放器 */
  9899. stop(): Promise<any>
  9900. }
  9901. interface MediaContainer {
  9902. /** [MediaContainer.addTrack([MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) track)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.addTrack.html)
  9903. *
  9904. * 将音频或视频轨道添加到容器
  9905. *
  9906. * 最低基础库: `2.9.0` */
  9907. addTrack(
  9908. /** [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html)
  9909. *
  9910. * 要添加的音频或视频轨道 */
  9911. track: MediaTrack
  9912. ): void
  9913. /** [MediaContainer.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.destroy.html)
  9914. *
  9915. * 将容器销毁,释放资源
  9916. *
  9917. * 最低基础库: `2.9.0` */
  9918. destroy(): void
  9919. /** [MediaContainer.export()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.export.html)
  9920. *
  9921. * 将容器内的轨道合并并导出视频文件
  9922. *
  9923. * 最低基础库: `2.9.0` */
  9924. export(): void
  9925. /** [MediaContainer.extractDataSource(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.extractDataSource.html)
  9926. *
  9927. * 将传入的视频源分离轨道。不会自动将轨道添加到待合成的容器里。
  9928. *
  9929. * 最低基础库: `2.9.0` */
  9930. extractDataSource(option: ExtractDataSourceOption): void
  9931. /** [MediaContainer.removeTrack([MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) track)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.removeTrack.html)
  9932. *
  9933. * 将音频或视频轨道从容器中移除
  9934. *
  9935. * 最低基础库: `2.9.0` */
  9936. removeTrack(
  9937. /** [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html)
  9938. *
  9939. * 要移除的音频或视频轨道 */
  9940. track: MediaTrack
  9941. ): void
  9942. }
  9943. interface MediaQueryObserver {
  9944. /** [MediaQueryObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/MediaQueryObserver.disconnect.html)
  9945. *
  9946. * 停止监听。回调函数将不再触发 */
  9947. disconnect(): void
  9948. /** [MediaQueryObserver.observe(Object descriptor, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/MediaQueryObserver.observe.html)
  9949. *
  9950. * 开始监听页面 media query 变化情况 */
  9951. observe(
  9952. /** media query 描述符 */
  9953. descriptor: ObserveDescriptor,
  9954. /** 监听 media query 状态变化的回调函数 */
  9955. callback: MediaQueryObserverObserveCallback
  9956. ): void
  9957. }
  9958. interface MediaRecorder {
  9959. /** [MediaRecorder.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.destroy.html)
  9960. *
  9961. * 销毁录制器
  9962. *
  9963. * 最低基础库: `2.11.0` */
  9964. destroy(): void
  9965. /** [MediaRecorder.off(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.off.html)
  9966. *
  9967. * 取消监听录制事件。当对应事件触发时,该回调函数不再执行。
  9968. *
  9969. * 最低基础库: `2.11.0` */
  9970. off(
  9971. /** 事件名 */
  9972. eventName: string,
  9973. /** 事件触发时执行的回调函数 */
  9974. callback: (...args: any[]) => any
  9975. ): void
  9976. /** [MediaRecorder.on(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.on.html)
  9977. *
  9978. * 注册监听录制事件的回调函数。当对应事件触发时,回调函数会被执行。
  9979. *
  9980. * 最低基础库: `2.11.0` */
  9981. on(
  9982. /** 事件名
  9983. *
  9984. * 参数 eventName 可选值:
  9985. * - 'start': 录制开始事件。;
  9986. * - 'stop': 录制结束事件。返回 {tempFilePath, duration, fileSize}; */
  9987. eventName: 'start' | 'stop',
  9988. /** 事件触发时执行的回调函数 */
  9989. callback: (...args: any[]) => any
  9990. ): void
  9991. /** [MediaRecorder.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.pause.html)
  9992. *
  9993. * 暂停录制
  9994. *
  9995. * 最低基础库: `2.11.0` */
  9996. pause(): void
  9997. /** [MediaRecorder.requestFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.requestFrame.html)
  9998. *
  9999. * 请求下一帧录制,在 callback 里完成一帧渲染后开始录制当前帧
  10000. *
  10001. * 最低基础库: `2.11.0` */
  10002. requestFrame(callback: (...args: any[]) => any): void
  10003. /** [MediaRecorder.resume()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.resume.html)
  10004. *
  10005. * 恢复录制
  10006. *
  10007. * 最低基础库: `2.11.0` */
  10008. resume(): void
  10009. /** [MediaRecorder.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.start.html)
  10010. *
  10011. * 开始录制
  10012. *
  10013. * 最低基础库: `2.11.0` */
  10014. start(): void
  10015. /** [MediaRecorder.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.stop.html)
  10016. *
  10017. * 结束录制
  10018. *
  10019. * 最低基础库: `2.11.0` */
  10020. stop(): void
  10021. }
  10022. interface MifareClassic {
  10023. /** [MifareClassic.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.close.html)
  10024. *
  10025. * 断开连接
  10026. *
  10027. * 最低基础库: `2.11.2` */
  10028. close(option?: NdefCloseOption): void
  10029. /** [MifareClassic.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.connect.html)
  10030. *
  10031. * 连接 NFC 标签
  10032. *
  10033. * 最低基础库: `2.11.2` */
  10034. connect(option?: ConnectOption): void
  10035. /** [MifareClassic.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.getMaxTransceiveLength.html)
  10036. *
  10037. * 获取最大传输长度
  10038. *
  10039. * 最低基础库: `2.11.2` */
  10040. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  10041. /** [MifareClassic.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.isConnected.html)
  10042. *
  10043. * 检查是否已连接
  10044. *
  10045. * 最低基础库: `2.11.2` */
  10046. isConnected(option?: IsConnectedOption): void
  10047. /** [MifareClassic.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.setTimeout.html)
  10048. *
  10049. * 设置超时时间
  10050. *
  10051. * 最低基础库: `2.11.2` */
  10052. setTimeout(option: SetTimeoutOption): void
  10053. /** [MifareClassic.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.transceive.html)
  10054. *
  10055. * 发送数据
  10056. *
  10057. * 最低基础库: `2.11.2` */
  10058. transceive(option: TransceiveOption): void
  10059. }
  10060. interface MifareUltralight {
  10061. /** [MifareUltralight.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.close.html)
  10062. *
  10063. * 断开连接
  10064. *
  10065. * 最低基础库: `2.11.2` */
  10066. close(option?: NdefCloseOption): void
  10067. /** [MifareUltralight.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.connect.html)
  10068. *
  10069. * 连接 NFC 标签
  10070. *
  10071. * 最低基础库: `2.11.2` */
  10072. connect(option?: ConnectOption): void
  10073. /** [MifareUltralight.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.getMaxTransceiveLength.html)
  10074. *
  10075. * 获取最大传输长度
  10076. *
  10077. * 最低基础库: `2.11.2` */
  10078. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  10079. /** [MifareUltralight.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.isConnected.html)
  10080. *
  10081. * 检查是否已连接
  10082. *
  10083. * 最低基础库: `2.11.2` */
  10084. isConnected(option?: IsConnectedOption): void
  10085. /** [MifareUltralight.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.setTimeout.html)
  10086. *
  10087. * 设置超时时间
  10088. *
  10089. * 最低基础库: `2.11.2` */
  10090. setTimeout(option: SetTimeoutOption): void
  10091. /** [MifareUltralight.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.transceive.html)
  10092. *
  10093. * 发送数据
  10094. *
  10095. * 最低基础库: `2.11.2` */
  10096. transceive(option: TransceiveOption): void
  10097. }
  10098. interface NFCAdapter {
  10099. /** [NFCAdapter.offDiscovered(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.offDiscovered.html)
  10100. *
  10101. * 取消监听 NFC Tag
  10102. *
  10103. * 最低基础库: `2.11.2` */
  10104. offDiscovered(
  10105. /** 的回调函数 */
  10106. callback?: OffDiscoveredCallback
  10107. ): void
  10108. /** [NFCAdapter.onDiscovered(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.onDiscovered.html)
  10109. *
  10110. * 监听 NFC Tag
  10111. *
  10112. * 最低基础库: `2.11.2` */
  10113. onDiscovered(
  10114. /** 的回调函数 */
  10115. callback: OnDiscoveredCallback
  10116. ): void
  10117. /** [NFCAdapter.startDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.startDiscovery.html)
  10118. *
  10119. *
  10120. *
  10121. * 最低基础库: `2.11.2` */
  10122. startDiscovery(option?: StartDiscoveryOption): void
  10123. /** [NFCAdapter.stopDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.stopDiscovery.html)
  10124. *
  10125. *
  10126. *
  10127. * 最低基础库: `2.11.2` */
  10128. stopDiscovery(option?: StopDiscoveryOption): void
  10129. /** [[IsoDep](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.html) NFCAdapter.getIsoDep()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getIsoDep.html)
  10130. *
  10131. * 获取IsoDep实例,实例支持ISO-DEP (ISO 14443-4)标准的读写
  10132. *
  10133. * 最低基础库: `2.11.2` */
  10134. getIsoDep(): IsoDep
  10135. /** [[MifareClassic](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.html) NFCAdapter.getMifareClassic()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getMifareClassic.html)
  10136. *
  10137. * 获取MifareClassic实例,实例支持MIFARE Classic标签的读写
  10138. *
  10139. * 最低基础库: `2.11.2` */
  10140. getMifareClassic(): MifareClassic
  10141. /** [[MifareUltralight](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.html) NFCAdapter.getMifareUltralight()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getMifareUltralight.html)
  10142. *
  10143. * 获取MifareUltralight实例,实例支持MIFARE Ultralight标签的读写
  10144. *
  10145. * 最低基础库: `2.11.2` */
  10146. getMifareUltralight(): MifareUltralight
  10147. /** [[Ndef](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.html) NFCAdapter.getNdef()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNdef.html)
  10148. *
  10149. * 获取Ndef实例,实例支持对NDEF格式的NFC标签上的NDEF数据的读写
  10150. *
  10151. * 最低基础库: `2.11.2` */
  10152. getNdef(): Ndef
  10153. /** [[NfcA](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.html) NFCAdapter.getNfcA()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcA.html)
  10154. *
  10155. * 获取NfcA实例,实例支持NFC-A (ISO 14443-3A)标准的读写
  10156. *
  10157. * 最低基础库: `2.11.2` */
  10158. getNfcA(): NfcA
  10159. /** [[NfcB](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.html) NFCAdapter.getNfcB()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcB.html)
  10160. *
  10161. * 获取NfcB实例,实例支持NFC-B (ISO 14443-3B)标准的读写
  10162. *
  10163. * 最低基础库: `2.11.2` */
  10164. getNfcB(): NfcB
  10165. /** [[NfcF](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.html) NFCAdapter.getNfcF()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcF.html)
  10166. *
  10167. * 获取NfcF实例,实例支持NFC-F (JIS 6319-4)标准的读写
  10168. *
  10169. * 最低基础库: `2.11.2` */
  10170. getNfcF(): NfcF
  10171. /** [[NfcV](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.html) NFCAdapter.getNfcV()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.getNfcV.html)
  10172. *
  10173. * 获取NfcV实例,实例支持NFC-V (ISO 15693)标准的读写
  10174. *
  10175. * 最低基础库: `2.11.2` */
  10176. getNfcV(): NfcV
  10177. }
  10178. interface NFCError {
  10179. /** 错误信息
  10180. *
  10181. * | 错误码 | 错误信息 | 说明 |
  10182. * | - | - | - |
  10183. * | 0 | ok | 正常 |
  10184. * | 13000 | | 当前设备不支持NFC |
  10185. * | 13001 | | 当前设备支持NFC,但系统NFC开关未开启 |
  10186. * | 13002 | | 当前设备支持NFC,但不支持HCE |
  10187. * | 13003 | | AID列表参数格式错误 |
  10188. * | 13004 | | 未设置微信为默认NFC支付应用 |
  10189. * | 13005 | | 返回的指令不合法 |
  10190. * | 13006 | | 注册AID失败 | */ errMsg: string
  10191. /** 错误码
  10192. *
  10193. * | 错误码 | 错误信息 | 说明 |
  10194. * | - | - | - |
  10195. * | 0 | ok | 正常 |
  10196. * | 13000 | | 当前设备不支持NFC |
  10197. * | 13001 | | 当前设备支持NFC,但系统NFC开关未开启 |
  10198. * | 13002 | | 当前设备支持NFC,但不支持HCE |
  10199. * | 13003 | | AID列表参数格式错误 |
  10200. * | 13004 | | 未设置微信为默认NFC支付应用 |
  10201. * | 13005 | | 返回的指令不合法 |
  10202. * | 13006 | | 注册AID失败 | */ errCode: number
  10203. }
  10204. interface Ndef {
  10205. /** [Ndef.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.close.html)
  10206. *
  10207. * 断开连接
  10208. *
  10209. * 最低基础库: `2.11.2` */
  10210. close(option?: NdefCloseOption): void
  10211. /** [Ndef.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.connect.html)
  10212. *
  10213. * 连接 NFC 标签
  10214. *
  10215. * 最低基础库: `2.11.2` */
  10216. connect(option?: ConnectOption): void
  10217. /** [Ndef.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.isConnected.html)
  10218. *
  10219. * 检查是否已连接
  10220. *
  10221. * 最低基础库: `2.11.2` */
  10222. isConnected(option?: IsConnectedOption): void
  10223. /** [Ndef.offNdefMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.offNdefMessage.html)
  10224. *
  10225. * 取消监听 Ndef 消息
  10226. *
  10227. * 最低基础库: `2.11.2` */
  10228. offNdefMessage(callback: (...args: any[]) => any): void
  10229. /** [Ndef.onNdefMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.onNdefMessage.html)
  10230. *
  10231. * 监听 Ndef 消息
  10232. *
  10233. * 最低基础库: `2.11.2` */
  10234. onNdefMessage(callback: (...args: any[]) => any): void
  10235. /** [Ndef.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.setTimeout.html)
  10236. *
  10237. * 设置超时时间
  10238. *
  10239. * 最低基础库: `2.11.2` */
  10240. setTimeout(option: SetTimeoutOption): void
  10241. /** [Ndef.writeNdefMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.writeNdefMessage.html)
  10242. *
  10243. * 重写 Ndef 标签内容
  10244. *
  10245. * 最低基础库: `2.11.2` */
  10246. writeNdefMessage(option: WriteNdefMessageOption): void
  10247. }
  10248. interface NfcA {
  10249. /** [NfcA.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.close.html)
  10250. *
  10251. * 断开连接
  10252. *
  10253. * 最低基础库: `2.11.2` */
  10254. close(option?: NdefCloseOption): void
  10255. /** [NfcA.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.connect.html)
  10256. *
  10257. * 连接 NFC 标签
  10258. *
  10259. * 最低基础库: `2.11.2` */
  10260. connect(option?: ConnectOption): void
  10261. /** [NfcA.getAtqa(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getAtqa.html)
  10262. *
  10263. * 获取ATQA信息
  10264. *
  10265. * 最低基础库: `2.11.2` */
  10266. getAtqa(option?: GetAtqaOption): void
  10267. /** [NfcA.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getMaxTransceiveLength.html)
  10268. *
  10269. * 获取最大传输长度
  10270. *
  10271. * 最低基础库: `2.11.2` */
  10272. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  10273. /** [NfcA.getSak(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getSak.html)
  10274. *
  10275. * 获取SAK信息
  10276. *
  10277. * 最低基础库: `2.11.2` */
  10278. getSak(option?: GetSakOption): void
  10279. /** [NfcA.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.isConnected.html)
  10280. *
  10281. * 检查是否已连接
  10282. *
  10283. * 最低基础库: `2.11.2` */
  10284. isConnected(option?: IsConnectedOption): void
  10285. /** [NfcA.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.setTimeout.html)
  10286. *
  10287. * 设置超时时间
  10288. *
  10289. * 最低基础库: `2.11.2` */
  10290. setTimeout(option: SetTimeoutOption): void
  10291. /** [NfcA.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.transceive.html)
  10292. *
  10293. * 发送数据
  10294. *
  10295. * 最低基础库: `2.11.2` */
  10296. transceive(option: TransceiveOption): void
  10297. }
  10298. interface NfcB {
  10299. /** [NfcB.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.close.html)
  10300. *
  10301. * 断开连接
  10302. *
  10303. * 最低基础库: `2.11.2` */
  10304. close(option?: NdefCloseOption): void
  10305. /** [NfcB.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.connect.html)
  10306. *
  10307. * 连接 NFC 标签
  10308. *
  10309. * 最低基础库: `2.11.2` */
  10310. connect(option?: ConnectOption): void
  10311. /** [NfcB.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.getMaxTransceiveLength.html)
  10312. *
  10313. * 获取最大传输长度
  10314. *
  10315. * 最低基础库: `2.11.2` */
  10316. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  10317. /** [NfcB.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.isConnected.html)
  10318. *
  10319. * 检查是否已连接
  10320. *
  10321. * 最低基础库: `2.11.2` */
  10322. isConnected(option?: IsConnectedOption): void
  10323. /** [NfcB.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.setTimeout.html)
  10324. *
  10325. * 设置超时时间
  10326. *
  10327. * 最低基础库: `2.11.2` */
  10328. setTimeout(option: SetTimeoutOption): void
  10329. /** [NfcB.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.transceive.html)
  10330. *
  10331. * 发送数据
  10332. *
  10333. * 最低基础库: `2.11.2` */
  10334. transceive(option: TransceiveOption): void
  10335. }
  10336. interface NfcF {
  10337. /** [NfcF.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.close.html)
  10338. *
  10339. * 断开连接
  10340. *
  10341. * 最低基础库: `2.11.2` */
  10342. close(option?: NdefCloseOption): void
  10343. /** [NfcF.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.connect.html)
  10344. *
  10345. * 连接 NFC 标签
  10346. *
  10347. * 最低基础库: `2.11.2` */
  10348. connect(option?: ConnectOption): void
  10349. /** [NfcF.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.getMaxTransceiveLength.html)
  10350. *
  10351. * 获取最大传输长度
  10352. *
  10353. * 最低基础库: `2.11.2` */
  10354. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  10355. /** [NfcF.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.isConnected.html)
  10356. *
  10357. * 检查是否已连接
  10358. *
  10359. * 最低基础库: `2.11.2` */
  10360. isConnected(option?: IsConnectedOption): void
  10361. /** [NfcF.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.setTimeout.html)
  10362. *
  10363. * 设置超时时间
  10364. *
  10365. * 最低基础库: `2.11.2` */
  10366. setTimeout(option: SetTimeoutOption): void
  10367. /** [NfcF.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.transceive.html)
  10368. *
  10369. * 发送数据
  10370. *
  10371. * 最低基础库: `2.11.2` */
  10372. transceive(option: TransceiveOption): void
  10373. }
  10374. interface NfcV {
  10375. /** [NfcV.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.close.html)
  10376. *
  10377. * 断开连接
  10378. *
  10379. * 最低基础库: `2.11.2` */
  10380. close(option?: NdefCloseOption): void
  10381. /** [NfcV.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.connect.html)
  10382. *
  10383. * 连接 NFC 标签
  10384. *
  10385. * 最低基础库: `2.11.2` */
  10386. connect(option?: ConnectOption): void
  10387. /** [NfcV.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.getMaxTransceiveLength.html)
  10388. *
  10389. * 获取最大传输长度
  10390. *
  10391. * 最低基础库: `2.11.2` */
  10392. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  10393. /** [NfcV.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.isConnected.html)
  10394. *
  10395. * 检查是否已连接
  10396. *
  10397. * 最低基础库: `2.11.2` */
  10398. isConnected(option?: IsConnectedOption): void
  10399. /** [NfcV.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.setTimeout.html)
  10400. *
  10401. * 设置超时时间
  10402. *
  10403. * 最低基础库: `2.11.2` */
  10404. setTimeout(option: SetTimeoutOption): void
  10405. /** [NfcV.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.transceive.html)
  10406. *
  10407. * 发送数据
  10408. *
  10409. * 最低基础库: `2.11.2` */
  10410. transceive(option: TransceiveOption): void
  10411. }
  10412. interface Nfcrwerror {
  10413. /** 错误信息
  10414. *
  10415. * | 错误码 | 错误信息 | 说明 |
  10416. * | - | - | - |
  10417. * | 13000 | 设备不支持NFC | |
  10418. * | 13001 | 系统NFC开关未打开 | |
  10419. * | 13010 | 未知错误 | |
  10420. * | 13019 | user is not authorized | 用户未授权 |
  10421. * | 13011 | invalid parameter | 参数无效 |
  10422. * | 13012 | parse NdefMessage failed | 将参数解析为NdefMessage失败 |
  10423. * | 13021 | NFC discovery already started | 已经开始NFC扫描 |
  10424. * | 13018 | NFC discovery has not started | 尝试在未开始NFC扫描时停止NFC扫描 |
  10425. * | 13022 | Tech already connected | 标签已经连接 |
  10426. * | 13023 | Tech has not connected | 尝试在未连接标签时断开连接 |
  10427. * | 13013 | NFC tag has not been discovered | 未扫描到NFC标签 |
  10428. * | 13014 | invalid tech | 无效的标签技术 |
  10429. * | 13015 | unavailable tech | 从标签上获取对应技术失败 |
  10430. * | 13024 | function not support | 当前标签技术不支持该功能 |
  10431. * | 13017 | system internal error | 相关读写操作失败 |
  10432. * | 13016 | connect fail | 连接失败 | */ errMsg: string
  10433. /** 错误码
  10434. *
  10435. * | 错误码 | 错误信息 | 说明 |
  10436. * | - | - | - |
  10437. * | 13000 | 设备不支持NFC | |
  10438. * | 13001 | 系统NFC开关未打开 | |
  10439. * | 13010 | 未知错误 | |
  10440. * | 13019 | user is not authorized | 用户未授权 |
  10441. * | 13011 | invalid parameter | 参数无效 |
  10442. * | 13012 | parse NdefMessage failed | 将参数解析为NdefMessage失败 |
  10443. * | 13021 | NFC discovery already started | 已经开始NFC扫描 |
  10444. * | 13018 | NFC discovery has not started | 尝试在未开始NFC扫描时停止NFC扫描 |
  10445. * | 13022 | Tech already connected | 标签已经连接 |
  10446. * | 13023 | Tech has not connected | 尝试在未连接标签时断开连接 |
  10447. * | 13013 | NFC tag has not been discovered | 未扫描到NFC标签 |
  10448. * | 13014 | invalid tech | 无效的标签技术 |
  10449. * | 13015 | unavailable tech | 从标签上获取对应技术失败 |
  10450. * | 13024 | function not support | 当前标签技术不支持该功能 |
  10451. * | 13017 | system internal error | 相关读写操作失败 |
  10452. * | 13016 | connect fail | 连接失败 | */ errCode: number
  10453. }
  10454. interface NodesRef {
  10455. /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.boundingClientRect(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.boundingClientRect.html)
  10456. *
  10457. * 添加节点的布局位置的查询请求。相对于显示区域,以像素为单位。其功能类似于 DOM 的 `getBoundingClientRect`。返回 `NodesRef` 对应的 `SelectorQuery`。
  10458. *
  10459. * **示例代码**
  10460. *
  10461. *
  10462. * ```js
  10463. Page({
  10464. getRect () {
  10465. wx.createSelectorQuery().select('#the-id').boundingClientRect(function(rect){
  10466. rect.id // 节点的ID
  10467. rect.dataset // 节点的dataset
  10468. rect.left // 节点的左边界坐标
  10469. rect.right // 节点的右边界坐标
  10470. rect.top // 节点的上边界坐标
  10471. rect.bottom // 节点的下边界坐标
  10472. rect.width // 节点的宽度
  10473. rect.height // 节点的高度
  10474. }).exec()
  10475. },
  10476. getAllRects () {
  10477. wx.createSelectorQuery().selectAll('.a-class').boundingClientRect(function(rects){
  10478. rects.forEach(function(rect){
  10479. rect.id // 节点的ID
  10480. rect.dataset // 节点的dataset
  10481. rect.left // 节点的左边界坐标
  10482. rect.right // 节点的右边界坐标
  10483. rect.top // 节点的上边界坐标
  10484. rect.bottom // 节点的下边界坐标
  10485. rect.width // 节点的宽度
  10486. rect.height // 节点的高度
  10487. })
  10488. }).exec()
  10489. }
  10490. })
  10491. ``` */
  10492. boundingClientRect(
  10493. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */
  10494. callback?: BoundingClientRectCallback
  10495. ): SelectorQuery
  10496. /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.context(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.context.html)
  10497. *
  10498. * 添加节点的 Context 对象查询请求。目前支持 [VideoContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html)、[CanvasContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html)、[LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html)、[EditorContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.html)和 [MapContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.html) 的获取。
  10499. *
  10500. * **示例代码**
  10501. *
  10502. *
  10503. * ```js
  10504. Page({
  10505. getContext () {
  10506. wx.createSelectorQuery().select('.the-video-class').context(function(res){
  10507. console.log(res.context) // 节点对应的 Context 对象。如:选中的节点是 <video> 组件,那么此处即返回 VideoContext 对象
  10508. }).exec()
  10509. }
  10510. })
  10511. ```
  10512. *
  10513. * 最低基础库: `2.4.2` */
  10514. context(
  10515. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,返回节点信息。 */
  10516. callback?: ContextCallback
  10517. ): SelectorQuery
  10518. /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.fields(Object fields, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.fields.html)
  10519. *
  10520. * 获取节点的相关信息。需要获取的字段在fields中指定。返回值是 `nodesRef` 对应的 `selectorQuery`
  10521. *
  10522. * **注意**
  10523. *
  10524. *
  10525. * computedStyle 的优先级高于 size,当同时在 computedStyle 里指定了 width/height 和传入了 size: true,则优先返回 computedStyle 获取到的 width/height。
  10526. *
  10527. * **示例代码**
  10528. *
  10529. *
  10530. * ```js
  10531. Page({
  10532. getFields () {
  10533. wx.createSelectorQuery().select('#the-id').fields({
  10534. dataset: true,
  10535. size: true,
  10536. scrollOffset: true,
  10537. properties: ['scrollX', 'scrollY'],
  10538. computedStyle: ['margin', 'backgroundColor'],
  10539. context: true,
  10540. }, function (res) {
  10541. res.dataset // 节点的dataset
  10542. res.width // 节点的宽度
  10543. res.height // 节点的高度
  10544. res.scrollLeft // 节点的水平滚动位置
  10545. res.scrollTop // 节点的竖直滚动位置
  10546. res.scrollX // 节点 scroll-x 属性的当前值
  10547. res.scrollY // 节点 scroll-y 属性的当前值
  10548. // 此处返回指定要返回的样式名
  10549. res.margin
  10550. res.backgroundColor
  10551. res.context // 节点对应的 Context 对象
  10552. }).exec()
  10553. }
  10554. })
  10555. ``` */
  10556. fields(
  10557. fields: Fields,
  10558. /** 回调函数 */
  10559. callback?: FieldsCallback
  10560. ): SelectorQuery
  10561. /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.node(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.node.html)
  10562. *
  10563. * 获取 Node 节点实例。目前支持 [Canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 的获取。
  10564. *
  10565. * **示例代码**
  10566. *
  10567. *
  10568. * ```js
  10569. Page({
  10570. getNode() {
  10571. wx.createSelectorQuery().select('.canvas').node(function(res){
  10572. console.log(res.node) // 节点对应的 Canvas 实例。
  10573. }).exec()
  10574. }
  10575. })
  10576. ```
  10577. *
  10578. * 最低基础库: `2.7.0` */
  10579. node(
  10580. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,返回节点信息。 */
  10581. callback?: NodeCallback
  10582. ): SelectorQuery
  10583. /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) NodesRef.scrollOffset(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.scrollOffset.html)
  10584. *
  10585. * 添加节点的滚动位置查询请求。以像素为单位。节点必须是 `scroll-view` 或者 `viewport`,返回 `NodesRef` 对应的 `SelectorQuery`。
  10586. *
  10587. * **示例代码**
  10588. *
  10589. *
  10590. * ```js
  10591. Page({
  10592. getScrollOffset () {
  10593. wx.createSelectorQuery().selectViewport().scrollOffset(function(res){
  10594. res.id // 节点的ID
  10595. res.dataset // 节点的dataset
  10596. res.scrollLeft // 节点的水平滚动位置
  10597. res.scrollTop // 节点的竖直滚动位置
  10598. }).exec()
  10599. }
  10600. })
  10601. ``` */
  10602. scrollOffset(
  10603. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */
  10604. callback?: ScrollOffsetCallback
  10605. ): SelectorQuery
  10606. }
  10607. interface OffscreenCanvas {
  10608. /** [[RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) OffscreenCanvas.getContext(string contextType)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.getContext.html)
  10609. *
  10610. * 该方法返回 OffscreenCanvas 的绘图上下文
  10611. *
  10612. * ****
  10613. *
  10614. * 注意不允许混用 WebGL 和 2d 绘图上下文
  10615. *
  10616. * 最低基础库: `2.7.0` */
  10617. getContext(
  10618. /**
  10619. *
  10620. * 参数 contextType 可选值:
  10621. * - 'webgl': 创建 WebGL 绘图上下文;
  10622. * - '2d': 创建 2d 绘图上下文; */
  10623. contextType: 'webgl' | '2d'
  10624. ): any
  10625. }
  10626. interface Performance {
  10627. /** [Array Performance.getEntries()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.getEntries.html)
  10628. *
  10629. * 该方法返回当前缓冲区中的所有性能数据
  10630. *
  10631. * 最低基础库: `2.11.0` */
  10632. getEntries(): any[]
  10633. /** [Array Performance.getEntriesByName(string name, string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.getEntriesByName.html)
  10634. *
  10635. * 获取当前缓冲区中所有名称为 [name] 且类型为 [entryType] 的性能数据
  10636. *
  10637. * 最低基础库: `2.11.0` */
  10638. getEntriesByName(name: string, entryType?: string): any[]
  10639. /** [Array Performance.getEntriesByType(string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.getEntriesByType.html)
  10640. *
  10641. * 获取当前缓冲区中所有类型为 [entryType] 的性能数据
  10642. *
  10643. * 最低基础库: `2.11.0` */
  10644. getEntriesByType(entryType: string): any[]
  10645. /** [Performance.setBufferSize(number size)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.setBufferSize.html)
  10646. *
  10647. * 设置缓冲区大小, 默认缓冲 30 条性能数据
  10648. *
  10649. * 最低基础库: `2.11.0` */
  10650. setBufferSize(size: number): void
  10651. /** [[PerformanceObserver](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/PerformanceObserver.html) Performance.createObserver(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.createObserver.html)
  10652. *
  10653. * 创建全局性能事件监听器
  10654. *
  10655. * 最低基础库: `2.11.0` */
  10656. createObserver(callback: (...args: any[]) => any): PerformanceObserver
  10657. }
  10658. interface PerformanceObserver {
  10659. /** [PerformanceObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/PerformanceObserver.disconnect.html)
  10660. *
  10661. * 停止监听
  10662. *
  10663. * 最低基础库: `2.11.0` */
  10664. disconnect(): void
  10665. /** [PerformanceObserver.observe(Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/PerformanceObserver.observe.html)
  10666. *
  10667. * 开始监听
  10668. *
  10669. * 最低基础库: `2.11.0` */
  10670. observe(
  10671. /** 设置 type 监听单个类型的指标,设置 entryTypes 监听多个类型指标。 */
  10672. options: IAnyObject
  10673. ): void
  10674. }
  10675. interface RealtimeLogManager {
  10676. /** [RealtimeLogManager.addFilterMsg(string msg)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.addFilterMsg.html)
  10677. *
  10678. * 添加过滤关键字
  10679. *
  10680. * 最低基础库: `2.8.1` */
  10681. addFilterMsg(
  10682. /** 是setFilterMsg的添加接口。用于设置多个过滤关键字。 */
  10683. msg: string
  10684. ): void
  10685. /** [RealtimeLogManager.error()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.error.html)
  10686. *
  10687. * 写 error 日志
  10688. *
  10689. * 最低基础库: `2.7.1` */
  10690. error(
  10691. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过5Kb */
  10692. ...args: any[]
  10693. ): void
  10694. /** [RealtimeLogManager.in(Page pageInstance)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.in.html)
  10695. *
  10696. * 设置实时日志page参数所在的页面
  10697. *
  10698. * 最低基础库: `2.9.1` */
  10699. in(
  10700. /** page实例 */
  10701. pageInstance: Page.TrivialInstance
  10702. ): void
  10703. /** [RealtimeLogManager.info()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.info.html)
  10704. *
  10705. * 写 info 日志
  10706. *
  10707. * 最低基础库: `2.7.1` */
  10708. info(
  10709. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过5Kb */
  10710. ...args: any[]
  10711. ): void
  10712. /** [RealtimeLogManager.setFilterMsg(string msg)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.setFilterMsg.html)
  10713. *
  10714. * 设置过滤关键字
  10715. *
  10716. * 最低基础库: `2.7.3` */
  10717. setFilterMsg(
  10718. /** 过滤关键字,最多不超过1Kb,可以在小程序管理后台根据设置的内容搜索得到对应的日志。 */
  10719. msg: string
  10720. ): void
  10721. /** [RealtimeLogManager.warn()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.warn.html)
  10722. *
  10723. * 写 warn 日志
  10724. *
  10725. * 最低基础库: `2.7.1` */
  10726. warn(
  10727. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过5Kb */
  10728. ...args: any[]
  10729. ): void
  10730. }
  10731. interface RecorderManager {
  10732. /** [RecorderManager.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onError.html)
  10733. *
  10734. * 监听录音错误事件 */
  10735. onError(
  10736. /** 录音错误事件的回调函数 */
  10737. callback: UDPSocketOnErrorCallback
  10738. ): void
  10739. /** [RecorderManager.onFrameRecorded(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onFrameRecorded.html)
  10740. *
  10741. * 监听已录制完指定帧大小的文件事件。如果设置了 frameSize,则会回调此事件。 */
  10742. onFrameRecorded(
  10743. /** 已录制完指定帧大小的文件事件的回调函数 */
  10744. callback: OnFrameRecordedCallback
  10745. ): void
  10746. /** [RecorderManager.onInterruptionBegin(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onInterruptionBegin.html)
  10747. *
  10748. * 监听录音因为受到系统占用而被中断开始事件。以下场景会触发此事件:微信语音聊天、微信视频聊天。此事件触发后,录音会被暂停。pause 事件在此事件后触发
  10749. *
  10750. * 最低基础库: `2.3.0` */
  10751. onInterruptionBegin(
  10752. /** 录音因为受到系统占用而被中断开始事件的回调函数 */
  10753. callback: OnInterruptionBeginCallback
  10754. ): void
  10755. /** [RecorderManager.onInterruptionEnd(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onInterruptionEnd.html)
  10756. *
  10757. * 监听录音中断结束事件。在收到 interruptionBegin 事件之后,小程序内所有录音会暂停,收到此事件之后才可再次录音成功。
  10758. *
  10759. * 最低基础库: `2.3.0` */
  10760. onInterruptionEnd(
  10761. /** 录音中断结束事件的回调函数 */
  10762. callback: OnInterruptionEndCallback
  10763. ): void
  10764. /** [RecorderManager.onPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onPause.html)
  10765. *
  10766. * 监听录音暂停事件 */
  10767. onPause(
  10768. /** 录音暂停事件的回调函数 */
  10769. callback: OnPauseCallback
  10770. ): void
  10771. /** [RecorderManager.onResume(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onResume.html)
  10772. *
  10773. * 监听录音继续事件 */
  10774. onResume(
  10775. /** 录音继续事件的回调函数 */
  10776. callback: OnResumeCallback
  10777. ): void
  10778. /** [RecorderManager.onStart(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onStart.html)
  10779. *
  10780. * 监听录音开始事件 */
  10781. onStart(
  10782. /** 录音开始事件的回调函数 */
  10783. callback: OnStartCallback
  10784. ): void
  10785. /** [RecorderManager.onStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onStop.html)
  10786. *
  10787. * 监听录音结束事件 */
  10788. onStop(
  10789. /** 录音结束事件的回调函数 */
  10790. callback: RecorderManagerOnStopCallback
  10791. ): void
  10792. /** [RecorderManager.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.pause.html)
  10793. *
  10794. * 暂停录音 */
  10795. pause(): void
  10796. /** [RecorderManager.resume()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.resume.html)
  10797. *
  10798. * 继续录音 */
  10799. resume(): void
  10800. /** [RecorderManager.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.start.html)
  10801. *
  10802. * 开始录音
  10803. *
  10804. * **采样率与编码码率限制**
  10805. *
  10806. *
  10807. * 每种采样率有对应的编码码率范围有效值,设置不合法的采样率或编码码率会导致录音失败,具体对应关系如下表。
  10808. *
  10809. * | 采样率 | 编码码率 |
  10810. * | ------ | -------------- |
  10811. * | 8000 | 16000 ~ 48000 |
  10812. * | 11025 | 16000 ~ 48000 |
  10813. * | 12000 | 24000 ~ 64000 |
  10814. * | 16000 | 24000 ~ 96000 |
  10815. * | 22050 | 32000 ~ 128000 |
  10816. * | 24000 | 32000 ~ 128000 |
  10817. * | 32000 | 48000 ~ 192000 |
  10818. * | 44100 | 64000 ~ 320000 |
  10819. * | 48000 | 64000 ~ 320000 | */
  10820. start(option: RecorderManagerStartOption): void
  10821. /** [RecorderManager.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.stop.html)
  10822. *
  10823. * 停止录音 */
  10824. stop(): void
  10825. }
  10826. interface RequestTask {
  10827. /** [RequestTask.abort()](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.abort.html)
  10828. *
  10829. * 中断请求任务
  10830. *
  10831. * 最低基础库: `1.4.0` */
  10832. abort(): void
  10833. /** [RequestTask.offHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.offHeadersReceived.html)
  10834. *
  10835. * 取消监听 HTTP Response Header 事件
  10836. *
  10837. * 最低基础库: `2.1.0` */
  10838. offHeadersReceived(
  10839. /** HTTP Response Header 事件的回调函数 */
  10840. callback?: OffHeadersReceivedCallback
  10841. ): void
  10842. /** [RequestTask.onHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.onHeadersReceived.html)
  10843. *
  10844. * 监听 HTTP Response Header 事件。会比请求完成事件更早
  10845. *
  10846. * 最低基础库: `2.1.0` */
  10847. onHeadersReceived(
  10848. /** HTTP Response Header 事件的回调函数 */
  10849. callback: OnHeadersReceivedCallback
  10850. ): void
  10851. }
  10852. interface RewardedVideoAd {
  10853. /** [Promise RewardedVideoAd.load()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.load.html)
  10854. *
  10855. * 加载激励视频广告。 */
  10856. load(): Promise<any>
  10857. /** [Promise RewardedVideoAd.show()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.show.html)
  10858. *
  10859. * 显示激励视频广告。激励视频广告将从屏幕下方推入。 */
  10860. show(): Promise<any>
  10861. /** [RewardedVideoAd.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.destroy.html)
  10862. *
  10863. * 销毁激励视频广告实例。
  10864. *
  10865. * 最低基础库: `2.8.0` */
  10866. destroy(): void
  10867. /** [RewardedVideoAd.offClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offClose.html)
  10868. *
  10869. * 取消监听用户点击 `关闭广告` 按钮的事件 */
  10870. offClose(
  10871. /** 用户点击 `关闭广告` 按钮的事件的回调函数 */
  10872. callback?: RewardedVideoAdOffCloseCallback
  10873. ): void
  10874. /** [RewardedVideoAd.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offError.html)
  10875. *
  10876. * 取消监听激励视频错误事件 */
  10877. offError(
  10878. /** 激励视频错误事件的回调函数 */
  10879. callback?: RewardedVideoAdOffErrorCallback
  10880. ): void
  10881. /** [RewardedVideoAd.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offLoad.html)
  10882. *
  10883. * 取消监听激励视频广告加载事件 */
  10884. offLoad(
  10885. /** 激励视频广告加载事件的回调函数 */
  10886. callback?: OffLoadCallback
  10887. ): void
  10888. /** [RewardedVideoAd.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onClose.html)
  10889. *
  10890. * 监听用户点击 `关闭广告` 按钮的事件。 */
  10891. onClose(
  10892. /** 用户点击 `关闭广告` 按钮的事件的回调函数 */
  10893. callback: RewardedVideoAdOnCloseCallback
  10894. ): void
  10895. /** [RewardedVideoAd.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onError.html)
  10896. *
  10897. * 监听激励视频错误事件。
  10898. *
  10899. * **错误码信息与解决方案表**
  10900. *
  10901. *
  10902. * 错误码是通过onError获取到的错误信息。调试期间,可以通过异常返回来捕获信息。
  10903. * 在小程序发布上线之后,如果遇到异常问题,可以在[“运维中心“](https://mp.weixin.qq.com/)里面搜寻错误日志,还可以针对异常返回加上适当的监控信息。
  10904. *
  10905. * | 代码 | 异常情况 | 理由 | 解决方案 |
  10906. * | ------ | -------------- | --------------- | -------------------------- |
  10907. * | 1000 | 后端错误调用失败 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。 |
  10908. * | 1001 | 参数错误 | 使用方法错误 | 可以前往developers.weixin.qq.com确认具体教程(小程序和小游戏分别有各自的教程,可以在顶部选项中,“设计”一栏的右侧进行切换。|
  10909. * | 1002 | 广告单元无效 | 可能是拼写错误、或者误用了其他APP的广告ID | 请重新前往mp.weixin.qq.com确认广告位ID。 |
  10910. * | 1003 | 内部错误 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。|
  10911. * | 1004 | 无适合的广告 | 广告不是每一次都会出现,这次没有出现可能是由于该用户不适合浏览广告 | 属于正常情况,且开发者需要针对这种情况做形态上的兼容。 |
  10912. * | 1005 | 广告组件审核中 | 你的广告正在被审核,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。|
  10913. * | 1006 | 广告组件被驳回 | 你的广告审核失败,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。|
  10914. * | 1007 | 广告组件被驳回 | 你的广告能力已经被封禁,封禁期间无法展现广告 | 请前往mp.weixin.qq.com确认小程序广告封禁状态。 |
  10915. * | 1008 | 广告单元已关闭 | 该广告位的广告能力已经被关闭 | 请前往mp.weixin.qq.com重新打开对应广告位的展现。| */
  10916. onError(
  10917. /** 激励视频错误事件的回调函数 */
  10918. callback: RewardedVideoAdOnErrorCallback
  10919. ): void
  10920. /** [RewardedVideoAd.onLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onLoad.html)
  10921. *
  10922. * 监听激励视频广告加载事件。 */
  10923. onLoad(
  10924. /** 激励视频广告加载事件的回调函数 */
  10925. callback: OnLoadCallback
  10926. ): void
  10927. }
  10928. interface ScrollViewContext {
  10929. /** [ScrollViewContext.scrollIntoView(string selector)](https://developers.weixin.qq.com/miniprogram/dev/api/media/scrollview/ScrollViewContext.scrollIntoView.html)
  10930. *
  10931. * 滚动至指定位置
  10932. *
  10933. * 最低基础库: `2.14.4` */
  10934. scrollIntoView(
  10935. /** 元素选择器 */
  10936. selector: string
  10937. ): void
  10938. /** [ScrollViewContext.scrollTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/scrollview/ScrollViewContext.scrollTo.html)
  10939. *
  10940. * 滚动至指定位置
  10941. *
  10942. * 最低基础库: `2.14.4` */
  10943. scrollTo(option: ScrollToOption): void
  10944. }
  10945. interface SelectorQuery {
  10946. /** [[NodesRef](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.html) SelectorQuery.exec(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.exec.html)
  10947. *
  10948. * 执行所有的请求。请求结果按请求次序构成数组,在callback的第一个参数中返回。 */
  10949. exec(
  10950. /** 回调函数 */
  10951. callback?: (...args: any[]) => any
  10952. ): NodesRef
  10953. /** [[NodesRef](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.html) SelectorQuery.select(string selector)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.select.html)
  10954. *
  10955. * 在当前页面下选择第一个匹配选择器 `selector` 的节点。返回一个 `NodesRef` 对象实例,可以用于获取节点信息。
  10956. *
  10957. * **selector 语法**
  10958. *
  10959. *
  10960. * selector类似于 CSS 的选择器,但仅支持下列语法。
  10961. *
  10962. * - ID选择器:#the-id
  10963. * - class选择器(可以连续指定多个):.a-class.another-class
  10964. * - 子元素选择器:.the-parent > .the-child
  10965. * - 后代选择器:.the-ancestor .the-descendant
  10966. * - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
  10967. * - 多选择器的并集:#a-node, .some-other-nodes */
  10968. select(
  10969. /** 选择器 */
  10970. selector: string
  10971. ): NodesRef
  10972. /** [[NodesRef](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.html) SelectorQuery.selectAll(string selector)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.selectAll.html)
  10973. *
  10974. * 在当前页面下选择匹配选择器 selector 的所有节点。
  10975. *
  10976. * **selector 语法**
  10977. *
  10978. *
  10979. * selector类似于 CSS 的选择器,但仅支持下列语法。
  10980. *
  10981. * - ID选择器:#the-id
  10982. * - class选择器(可以连续指定多个):.a-class.another-class
  10983. * - 子元素选择器:.the-parent > .the-child
  10984. * - 后代选择器:.the-ancestor .the-descendant
  10985. * - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
  10986. * - 多选择器的并集:#a-node, .some-other-nodes */
  10987. selectAll(
  10988. /** 选择器 */
  10989. selector: string
  10990. ): NodesRef
  10991. /** [[NodesRef](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.html) SelectorQuery.selectViewport()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.selectViewport.html)
  10992. *
  10993. * 选择显示区域。可用于获取显示区域的尺寸、滚动位置等信息。 */
  10994. selectViewport(): NodesRef
  10995. /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) SelectorQuery.in(Component component)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.in.html)
  10996. *
  10997. * 将选择器的选取范围更改为自定义组件 `component` 内。(初始时,选择器仅选取页面范围的节点,不会选取任何自定义组件中的节点)。
  10998. *
  10999. * **示例代码**
  11000. *
  11001. *
  11002. * ```js
  11003. Component({
  11004. queryMultipleNodes (){
  11005. const query = wx.createSelectorQuery().in(this)
  11006. query.select('#the-id').boundingClientRect(function(res){
  11007. res.top // 这个组件内 #the-id 节点的上边界坐标
  11008. }).exec()
  11009. }
  11010. })
  11011. ```
  11012. *
  11013. * 最低基础库: `1.6.0` */
  11014. in(
  11015. /** 自定义组件实例 */
  11016. component: Component.TrivialInstance | Page.TrivialInstance
  11017. ): SelectorQuery
  11018. }
  11019. interface SocketTask {
  11020. /** [SocketTask.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.close.html)
  11021. *
  11022. * 关闭 WebSocket 连接 */
  11023. close(option: SocketTaskCloseOption): void
  11024. /** [SocketTask.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onClose.html)
  11025. *
  11026. * 监听 WebSocket 连接关闭事件 */
  11027. onClose(
  11028. /** WebSocket 连接关闭事件的回调函数 */
  11029. callback: SocketTaskOnCloseCallback
  11030. ): void
  11031. /** [SocketTask.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onError.html)
  11032. *
  11033. * 监听 WebSocket 错误事件 */
  11034. onError(
  11035. /** WebSocket 错误事件的回调函数 */
  11036. callback: UDPSocketOnErrorCallback
  11037. ): void
  11038. /** [SocketTask.onMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onMessage.html)
  11039. *
  11040. * 监听 WebSocket 接受到服务器的消息事件 */
  11041. onMessage(
  11042. /** WebSocket 接受到服务器的消息事件的回调函数 */
  11043. callback: SocketTaskOnMessageCallback
  11044. ): void
  11045. /** [SocketTask.onOpen(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onOpen.html)
  11046. *
  11047. * 监听 WebSocket 连接打开事件 */
  11048. onOpen(
  11049. /** WebSocket 连接打开事件的回调函数 */
  11050. callback: OnOpenCallback
  11051. ): void
  11052. /** [SocketTask.send(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.send.html)
  11053. *
  11054. * 通过 WebSocket 连接发送数据 */
  11055. send(option: SocketTaskSendOption): void
  11056. }
  11057. interface Stats {
  11058. /** [boolean Stats.isDirectory()](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.isDirectory.html)
  11059. *
  11060. * 判断当前文件是否一个目录 */
  11061. isDirectory(): boolean
  11062. /** [boolean Stats.isFile()](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.isFile.html)
  11063. *
  11064. * 判断当前文件是否一个普通文件 */
  11065. isFile(): boolean
  11066. }
  11067. interface UDPSocket {
  11068. /** [UDPSocket.close()](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.close.html)
  11069. *
  11070. * 关闭 UDP Socket 实例,相当于销毁。 在关闭之后,UDP Socket 实例不能再发送消息,每次调用 `UDPSocket.send` 将会触发错误事件,并且 message 事件回调函数也不会再也执行。在 `UDPSocket` 实例被创建后将被 Native 强引用,保证其不被 GC。在 `UDPSocket.close` 后将解除对其的强引用,让 UDPSocket 实例遵从 GC。 */
  11071. close(): void
  11072. /** [UDPSocket.offClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offClose.html)
  11073. *
  11074. * 取消监听关闭事件 */
  11075. offClose(
  11076. /** 关闭事件的回调函数 */
  11077. callback?: UDPSocketOffCloseCallback
  11078. ): void
  11079. /** [UDPSocket.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offError.html)
  11080. *
  11081. * 取消监听错误事件 */
  11082. offError(
  11083. /** 错误事件的回调函数 */
  11084. callback?: UDPSocketOffErrorCallback
  11085. ): void
  11086. /** [UDPSocket.offListening(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offListening.html)
  11087. *
  11088. * 取消监听开始监听数据包消息的事件 */
  11089. offListening(
  11090. /** 开始监听数据包消息的事件的回调函数 */
  11091. callback?: OffListeningCallback
  11092. ): void
  11093. /** [UDPSocket.offMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offMessage.html)
  11094. *
  11095. * 取消监听收到消息的事件 */
  11096. offMessage(
  11097. /** 收到消息的事件的回调函数 */
  11098. callback?: OffMessageCallback
  11099. ): void
  11100. /** [UDPSocket.onClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onClose.html)
  11101. *
  11102. * 监听关闭事件 */
  11103. onClose(
  11104. /** 关闭事件的回调函数 */
  11105. callback: UDPSocketOnCloseCallback
  11106. ): void
  11107. /** [UDPSocket.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onError.html)
  11108. *
  11109. * 监听错误事件 */
  11110. onError(
  11111. /** 错误事件的回调函数 */
  11112. callback: UDPSocketOnErrorCallback
  11113. ): void
  11114. /** [UDPSocket.onListening(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onListening.html)
  11115. *
  11116. * 监听开始监听数据包消息的事件 */
  11117. onListening(
  11118. /** 开始监听数据包消息的事件的回调函数 */
  11119. callback: OnListeningCallback
  11120. ): void
  11121. /** [UDPSocket.onMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onMessage.html)
  11122. *
  11123. * 监听收到消息的事件 */
  11124. onMessage(
  11125. /** 收到消息的事件的回调函数 */
  11126. callback: UDPSocketOnMessageCallback
  11127. ): void
  11128. /** [UDPSocket.send(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.send.html)
  11129. *
  11130. * 向指定的 IP 和 port 发送消息 */
  11131. send(option: UDPSocketSendOption): void
  11132. /** [number UDPSocket.bind(number port)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.bind.html)
  11133. *
  11134. * 绑定一个系统随机分配的可用端口,或绑定一个指定的端口号 */
  11135. bind(
  11136. /** 指定要绑定的端口号,不传则返回系统随机分配的可用端口
  11137. *
  11138. * 最低基础库: `2.9.0` */
  11139. port?: number
  11140. ): number
  11141. }
  11142. interface UpdateManager {
  11143. /** [UpdateManager.applyUpdate()](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.applyUpdate.html)
  11144. *
  11145. * 强制小程序重启并使用新版本。在小程序新版本下载完成后(即收到 `onUpdateReady` 回调)调用。 */
  11146. applyUpdate(): void
  11147. /** [UpdateManager.onCheckForUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onCheckForUpdate.html)
  11148. *
  11149. * 监听向微信后台请求检查更新结果事件。微信在小程序冷启动时自动检查更新,不需由开发者主动触发。 */
  11150. onCheckForUpdate(
  11151. /** 向微信后台请求检查更新结果事件的回调函数 */
  11152. callback: OnCheckForUpdateCallback
  11153. ): void
  11154. /** [UpdateManager.onUpdateFailed(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateFailed.html)
  11155. *
  11156. * 监听小程序更新失败事件。小程序有新版本,客户端主动触发下载(无需开发者触发),下载失败(可能是网络原因等)后回调 */
  11157. onUpdateFailed(
  11158. /** 小程序更新失败事件的回调函数 */
  11159. callback: OnUpdateFailedCallback
  11160. ): void
  11161. /** [UpdateManager.onUpdateReady(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateReady.html)
  11162. *
  11163. * 监听小程序有版本更新事件。客户端主动触发下载(无需开发者触发),下载成功后回调 */
  11164. onUpdateReady(
  11165. /** 小程序有版本更新事件的回调函数 */
  11166. callback: OnUpdateReadyCallback
  11167. ): void
  11168. }
  11169. interface UploadTask {
  11170. /** [UploadTask.abort()](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.abort.html)
  11171. *
  11172. * 中断上传任务
  11173. *
  11174. * 最低基础库: `1.4.0` */
  11175. abort(): void
  11176. /** [UploadTask.offHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.offHeadersReceived.html)
  11177. *
  11178. * 取消监听 HTTP Response Header 事件
  11179. *
  11180. * 最低基础库: `2.1.0` */
  11181. offHeadersReceived(
  11182. /** HTTP Response Header 事件的回调函数 */
  11183. callback?: OffHeadersReceivedCallback
  11184. ): void
  11185. /** [UploadTask.offProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.offProgressUpdate.html)
  11186. *
  11187. * 取消监听上传进度变化事件
  11188. *
  11189. * 最低基础库: `2.1.0` */
  11190. offProgressUpdate(
  11191. /** 上传进度变化事件的回调函数 */
  11192. callback?: UploadTaskOffProgressUpdateCallback
  11193. ): void
  11194. /** [UploadTask.onHeadersReceived(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onHeadersReceived.html)
  11195. *
  11196. * 监听 HTTP Response Header 事件。会比请求完成事件更早
  11197. *
  11198. * 最低基础库: `2.1.0` */
  11199. onHeadersReceived(
  11200. /** HTTP Response Header 事件的回调函数 */
  11201. callback: OnHeadersReceivedCallback
  11202. ): void
  11203. /** [UploadTask.onProgressUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onProgressUpdate.html)
  11204. *
  11205. * 监听上传进度变化事件
  11206. *
  11207. * 最低基础库: `1.4.0` */
  11208. onProgressUpdate(
  11209. /** 上传进度变化事件的回调函数 */
  11210. callback: UploadTaskOnProgressUpdateCallback
  11211. ): void
  11212. }
  11213. interface VideoContext {
  11214. /** [VideoContext.exitFullScreen()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitFullScreen.html)
  11215. *
  11216. * 退出全屏
  11217. *
  11218. * 最低基础库: `1.4.0` */
  11219. exitFullScreen(): void
  11220. /** [VideoContext.exitPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitPictureInPicture.html)
  11221. *
  11222. * 退出小窗,该方法可在任意页面调用 */
  11223. exitPictureInPicture(option?: ExitPictureInPictureOption): void
  11224. /** [VideoContext.hideStatusBar()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.hideStatusBar.html)
  11225. *
  11226. * 隐藏状态栏,仅在iOS全屏下有效
  11227. *
  11228. * 最低基础库: `2.1.0` */
  11229. hideStatusBar(): void
  11230. /** [VideoContext.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.pause.html)
  11231. *
  11232. * 暂停视频 */
  11233. pause(): void
  11234. /** [VideoContext.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.play.html)
  11235. *
  11236. * 播放视频 */
  11237. play(): void
  11238. /** [VideoContext.playbackRate(number rate)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.playbackRate.html)
  11239. *
  11240. * 设置倍速播放
  11241. *
  11242. * 最低基础库: `1.4.0` */
  11243. playbackRate(
  11244. /** 倍率,支持 0.5/0.8/1.0/1.25/1.5,2.6.3 起支持 2.0 倍速 */
  11245. rate: number
  11246. ): void
  11247. /** [VideoContext.requestFullScreen(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.requestFullScreen.html)
  11248. *
  11249. * 进入全屏。若有自定义内容需在全屏时展示,需将内容节点放置到 video 节点内。
  11250. *
  11251. * 最低基础库: `1.4.0` */
  11252. requestFullScreen(option: VideoContextRequestFullScreenOption): void
  11253. /** [VideoContext.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.seek.html)
  11254. *
  11255. * 跳转到指定位置 */
  11256. seek(
  11257. /** 跳转到的位置,单位 s */
  11258. position: number
  11259. ): void
  11260. /** [VideoContext.sendDanmu(Object data)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.sendDanmu.html)
  11261. *
  11262. * 发送弹幕 */
  11263. sendDanmu(
  11264. /** 弹幕内容 */
  11265. data: Danmu
  11266. ): void
  11267. /** [VideoContext.showStatusBar()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.showStatusBar.html)
  11268. *
  11269. * 显示状态栏,仅在iOS全屏下有效
  11270. *
  11271. * 最低基础库: `2.1.0` */
  11272. showStatusBar(): void
  11273. /** [VideoContext.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.stop.html)
  11274. *
  11275. * 停止视频
  11276. *
  11277. * 最低基础库: `1.7.0` */
  11278. stop(): void
  11279. }
  11280. interface VideoDecoder {
  11281. /** [Object VideoDecoder.getFrameData()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.getFrameData.html)
  11282. *
  11283. * 获取下一帧的解码数据
  11284. *
  11285. * 最低基础库: `2.11.0` */
  11286. getFrameData(): FrameDataOptions
  11287. /** [VideoDecoder.off(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.off.html)
  11288. *
  11289. * 取消监听录制事件。当对应事件触发时,该回调函数不再执行
  11290. *
  11291. * 最低基础库: `2.11.0` */
  11292. off(
  11293. /** 事件名 */
  11294. eventName: string,
  11295. /** 事件触发时执行的回调函数 */
  11296. callback: (...args: any[]) => any
  11297. ): void
  11298. /** [VideoDecoder.on(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.on.html)
  11299. *
  11300. * 注册监听录制事件的回调函数。当对应事件触发时,回调函数会被执行
  11301. *
  11302. * 最低基础库: `2.11.0` */
  11303. on(
  11304. /** 事件名
  11305. *
  11306. * 参数 eventName 可选值:
  11307. * - 'start': 开始事件。返回 {width, height};
  11308. * - 'stop': 结束事件。;
  11309. * - 'seek': seek 完成事件。;
  11310. * - 'bufferchange': 缓冲区变化事件。;
  11311. * - 'ended': 解码结束事件。; */
  11312. eventName: 'start' | 'stop' | 'seek' | 'bufferchange' | 'ended',
  11313. /** 事件触发时执行的回调函数 */
  11314. callback: (...args: any[]) => any
  11315. ): void
  11316. /** [VideoDecoder.remove()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.remove.html)
  11317. *
  11318. * 移除解码器
  11319. *
  11320. * 最低基础库: `2.11.0` */
  11321. remove(): void
  11322. /** [VideoDecoder.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.seek.html)
  11323. *
  11324. * 跳到某个时间点解码
  11325. *
  11326. * 最低基础库: `2.11.0` */
  11327. seek(
  11328. /** 跳转的解码位置,单位 ms */
  11329. position: number
  11330. ): void
  11331. /** [VideoDecoder.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.start.html)
  11332. *
  11333. * 开始解码
  11334. *
  11335. * 最低基础库: `2.11.0` */
  11336. start(option: VideoDecoderStartOption): void
  11337. /** [VideoDecoder.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.stop.html)
  11338. *
  11339. * 停止解码
  11340. *
  11341. * 最低基础库: `2.11.0` */
  11342. stop(): void
  11343. }
  11344. interface WifiError {
  11345. /** 错误信息
  11346. *
  11347. * | 错误码 | 错误信息 | 说明 |
  11348. * | - | - | - |
  11349. * | 0 | ok | 正常 |
  11350. * | 12000 | not init | 未先调用 `startWifi` 接口 |
  11351. * | 12001 | system not support | 当前系统不支持相关能力 |
  11352. * | 12002 | password error Wi-Fi | 密码错误 |
  11353. * | 12003 | connection timeout | 连接超时 |
  11354. * | 12004 | duplicate request | 重复连接 Wi-Fi |
  11355. * | 12005 | wifi not turned on | Android 特有,未打开 Wi-Fi 开关 |
  11356. * | 12006 | gps not turned on | Android 特有,未打开 GPS 定位开关 |
  11357. * | 12007 | user denied | 用户拒绝授权链接 Wi-Fi |
  11358. * | 12008 | invalid SSID | 无效 SSID |
  11359. * | 12009 | system config err | 系统运营商配置拒绝连接 Wi-Fi |
  11360. * | 12010 | system internal error | 系统其他错误,需要在 errmsg 打印具体的错误原因 |
  11361. * | 12011 | weapp in background | 应用在后台无法配置 Wi-Fi |
  11362. * | 12013 | wifi config may be expired | 系统保存的 Wi-Fi 配置过期,建议忘记 Wi-Fi 后重试 | */ errMsg: string
  11363. /** 错误码
  11364. *
  11365. * | 错误码 | 错误信息 | 说明 |
  11366. * | - | - | - |
  11367. * | 0 | ok | 正常 |
  11368. * | 12000 | not init | 未先调用 `startWifi` 接口 |
  11369. * | 12001 | system not support | 当前系统不支持相关能力 |
  11370. * | 12002 | password error Wi-Fi | 密码错误 |
  11371. * | 12003 | connection timeout | 连接超时 |
  11372. * | 12004 | duplicate request | 重复连接 Wi-Fi |
  11373. * | 12005 | wifi not turned on | Android 特有,未打开 Wi-Fi 开关 |
  11374. * | 12006 | gps not turned on | Android 特有,未打开 GPS 定位开关 |
  11375. * | 12007 | user denied | 用户拒绝授权链接 Wi-Fi |
  11376. * | 12008 | invalid SSID | 无效 SSID |
  11377. * | 12009 | system config err | 系统运营商配置拒绝连接 Wi-Fi |
  11378. * | 12010 | system internal error | 系统其他错误,需要在 errmsg 打印具体的错误原因 |
  11379. * | 12011 | weapp in background | 应用在后台无法配置 Wi-Fi |
  11380. * | 12013 | wifi config may be expired | 系统保存的 Wi-Fi 配置过期,建议忘记 Wi-Fi 后重试 | */ errCode: number
  11381. }
  11382. interface Worker {
  11383. /** [Worker.onMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.onMessage.html)
  11384. *
  11385. * 监听主线程/Worker 线程向当前线程发送的消息的事件。 */
  11386. onMessage(
  11387. /** 主线程/Worker 线程向当前线程发送的消息的事件的回调函数 */
  11388. callback: WorkerOnMessageCallback
  11389. ): void
  11390. /** [Worker.onProcessKilled(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.onProcessKilled.html)
  11391. *
  11392. * 监听 worker进程被系统回收事件(当iOS系统资源紧张时,处于后台的小程序/小游戏的worker存在被系统回收的可能,开发者可监听此事件并重新创建一个worker) */
  11393. onProcessKilled(
  11394. /** worker进程被系统回收事件的回调函数 */
  11395. callback: OnProcessKilledCallback
  11396. ): void
  11397. /** [Worker.postMessage(Object message)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.postMessage.html)
  11398. *
  11399. * 向主线程/Worker 线程发送的消息。
  11400. *
  11401. * **示例代码**
  11402. *
  11403. *
  11404. * worker 线程中
  11405. * ```js
  11406. worker.postMessage({
  11407. msg: 'hello from worker'
  11408. })
  11409. ```
  11410. *
  11411. * 主线程中
  11412. * ```js
  11413. const worker = wx.createWorker('workers/request/index.js')
  11414. worker.postMessage({
  11415. msg: 'hello from main'
  11416. })
  11417. ``` */
  11418. postMessage(
  11419. /** 需要发送的消息,必须是一个可序列化的 JavaScript key-value 形式的对象。 */
  11420. message: IAnyObject
  11421. ): void
  11422. /** [Worker.terminate()](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.terminate.html)
  11423. *
  11424. * 结束当前 Worker 线程。仅限在主线程 worker 对象上调用。 */
  11425. terminate(): void
  11426. }
  11427. interface Wx {
  11428. /**
  11429. 小程序云开发
  11430. */
  11431. cloud: WxCloud
  11432. /**
  11433. 文件系统中的用户目录路径
  11434. */
  11435. env: { USER_DATA_PATH: string }
  11436. /** [ArrayBuffer wx.base64ToArrayBuffer(string base64)](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.base64ToArrayBuffer.html)
  11437. *
  11438. * 将 Base64 字符串转成 ArrayBuffer 对象
  11439. *
  11440. * 最低基础库: `1.1.0`
  11441. * @deprecated 基础库版本 [2.4.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃
  11442. * */
  11443. base64ToArrayBuffer(
  11444. /** 要转化成 ArrayBuffer 对象的 Base64 字符串 */
  11445. base64: string
  11446. ): ArrayBuffer
  11447. /** [Object wx.getAccountInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/account-info/wx.getAccountInfoSync.html)
  11448. *
  11449. * 获取当前帐号信息。线上小程序版本号仅支持在正式版小程序中获取,开发版和体验版中无法获取。
  11450. *
  11451. * **示例代码**
  11452. *
  11453. *
  11454. * ```js
  11455. const accountInfo = wx.getAccountInfoSync();
  11456. console.log(accountInfo.miniProgram.appId) // 小程序 appId
  11457. console.log(accountInfo.plugin.appId) // 插件 appId
  11458. console.log(accountInfo.plugin.version) // 插件版本号, 'a.b.c' 这样的形式
  11459. ```
  11460. *
  11461. * 最低基础库: `2.2.2` */
  11462. getAccountInfoSync(): AccountInfo
  11463. /** [Object wx.getBatteryInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfoSync.html)
  11464. *
  11465. * [wx.getBatteryInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfo.html) 的同步版本 */
  11466. getBatteryInfoSync(): GetBatteryInfoSyncResult
  11467. /** [Object wx.getEnterOptionsSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getEnterOptionsSync.html)
  11468. *
  11469. * 获取本次小程序启动时的参数。如果当前是冷启动,则返回值与 [`App.onLaunch`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onLaunch-Object-object) 的回调参数一致;如果当前是热启动,则返回值与 [`App.onShow`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onShow-Object-object) 一致。
  11470. *
  11471. * **返回有效 referrerInfo 的场景**
  11472. *
  11473. *
  11474. * | 场景值 | 场景 | appId含义 |
  11475. * | ------ | ------------------------------- | ---------- |
  11476. * | 1020 | 公众号 profile 页相关小程序列表 | 来源公众号 |
  11477. * | 1035 | 公众号自定义菜单 | 来源公众号 |
  11478. * | 1036 | App 分享消息卡片 | 来源App |
  11479. * | 1037 | 小程序打开小程序 | 来源小程序 |
  11480. * | 1038 | 从另一个小程序返回 | 来源小程序 |
  11481. * | 1043 | 公众号模板消息 | 来源公众号 |
  11482. *
  11483. * **注意**
  11484. *
  11485. *
  11486. * 部分版本在无 `referrerInfo` 的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。
  11487. *
  11488. * 最低基础库: `2.9.4` */
  11489. getEnterOptionsSync(): LaunchOptionsApp
  11490. /** [Object wx.getExptInfoSync(Array.&lt;string&gt; keys)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/report/wx.getExptInfoSync.html)
  11491. *
  11492. * 给定实验参数数组,获取对应的实验参数值
  11493. *
  11494. * 最低基础库: `2.14.4` */
  11495. getExptInfoSync(
  11496. /** 实验参数数组,不填则获取所有实验参数 */
  11497. keys?: string[]
  11498. ): IAnyObject
  11499. /** [Object wx.getExtConfigSync()](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfigSync.html)
  11500. *
  11501. * [wx.getExtConfig](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfig.html) 的同步版本。
  11502. *
  11503. * **Tips**
  11504. *
  11505. *
  11506. * 1. 本接口暂时无法通过 [wx.canIUse](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.canIUse.html) 判断是否兼容,开发者需要自行判断 [wx.getExtConfigSync](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfigSync.html) 是否存在来兼容
  11507. *
  11508. * ****
  11509. *
  11510. * ```js
  11511. let extConfig = wx.getExtConfigSync? wx.getExtConfigSync(): {}
  11512. console.log(extConfig)
  11513. ```
  11514. *
  11515. * 最低基础库: `1.1.0` */
  11516. getExtConfigSync(): IAnyObject
  11517. /** [Object wx.getLaunchOptionsSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html)
  11518. *
  11519. * 获取小程序启动时的参数。与 [`App.onLaunch`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onlaunchobject-object) 的回调参数一致。
  11520. *
  11521. * **返回有效 referrerInfo 的场景**
  11522. *
  11523. *
  11524. * | 场景值 | 场景 | appId含义 |
  11525. * | ------ | ------------------------------- | ---------- |
  11526. * | 1020 | 公众号 profile 页相关小程序列表 | 来源公众号 |
  11527. * | 1035 | 公众号自定义菜单 | 来源公众号 |
  11528. * | 1036 | App 分享消息卡片 | 来源App |
  11529. * | 1037 | 小程序打开小程序 | 来源小程序 |
  11530. * | 1038 | 从另一个小程序返回 | 来源小程序 |
  11531. * | 1043 | 公众号模板消息 | 来源公众号 |
  11532. * | 1069 | 移动应用 | 来源App |
  11533. *
  11534. * **注意**
  11535. *
  11536. *
  11537. * 部分版本在无`referrerInfo`的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。
  11538. *
  11539. * 最低基础库: `2.1.2` */
  11540. getLaunchOptionsSync(): LaunchOptionsApp
  11541. /** [Object wx.getMenuButtonBoundingClientRect()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/menu/wx.getMenuButtonBoundingClientRect.html)
  11542. *
  11543. * 获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。
  11544. *
  11545. * 最低基础库: `2.1.0` */
  11546. getMenuButtonBoundingClientRect(): Rect
  11547. /** [Object wx.getStorageInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfoSync.html)
  11548. *
  11549. * [wx.getStorageInfo](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfo.html) 的同步版本
  11550. *
  11551. * **示例代码**
  11552. *
  11553. *
  11554. * ```js
  11555. wx.getStorageInfo({
  11556. success (res) {
  11557. console.log(res.keys)
  11558. console.log(res.currentSize)
  11559. console.log(res.limitSize)
  11560. }
  11561. })
  11562. ```
  11563. *
  11564. * ```js
  11565. try {
  11566. const res = wx.getStorageInfoSync()
  11567. console.log(res.keys)
  11568. console.log(res.currentSize)
  11569. console.log(res.limitSize)
  11570. } catch (e) {
  11571. // Do something when catch error
  11572. }
  11573. ``` */
  11574. getStorageInfoSync(): GetStorageInfoSyncOption
  11575. /** [Object wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfoSync.html)
  11576. *
  11577. * [wx.getSystemInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfo.html) 的同步版本
  11578. *
  11579. * **示例代码**
  11580. *
  11581. *
  11582. * ```js
  11583. wx.getSystemInfo({
  11584. success (res) {
  11585. console.log(res.model)
  11586. console.log(res.pixelRatio)
  11587. console.log(res.windowWidth)
  11588. console.log(res.windowHeight)
  11589. console.log(res.language)
  11590. console.log(res.version)
  11591. console.log(res.platform)
  11592. }
  11593. })
  11594. ```
  11595. *
  11596. * ```js
  11597. try {
  11598. const res = wx.getSystemInfoSync()
  11599. console.log(res.model)
  11600. console.log(res.pixelRatio)
  11601. console.log(res.windowWidth)
  11602. console.log(res.windowHeight)
  11603. console.log(res.language)
  11604. console.log(res.version)
  11605. console.log(res.platform)
  11606. } catch (e) {
  11607. // Do something when catch error
  11608. }
  11609. ``` */
  11610. getSystemInfoSync(): SystemInfo
  11611. /** [[Animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html) wx.createAnimation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/wx.createAnimation.html)
  11612. *
  11613. * 创建一个动画实例 [animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html)。调用实例的方法来描述动画。最后通过动画实例的 export 方法导出动画数据传递给组件的 animation 属性。 */
  11614. createAnimation(option: StepOption): Animation
  11615. /** [[AudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.html) wx.createAudioContext(string id, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createAudioContext.html)
  11616. *
  11617. * 创建 [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 上下文 [AudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.html) 对象。
  11618. * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 替换
  11619. * */
  11620. createAudioContext(
  11621. /** [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 组件的 id */
  11622. id: string,
  11623. /** 在自定义组件下,当前组件实例的this,以操作组件内 [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 组件 */
  11624. component?: Component.TrivialInstance | Page.TrivialInstance
  11625. ): AudioContext
  11626. /** [[BackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.html) wx.getBackgroundAudioManager()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html)
  11627. *
  11628. * 获取**全局唯一**的背景音频管理器。
  11629. * 小程序切入后台,如果音频处于播放状态,可以继续播放。但是后台状态不能通过调用API操纵音频的播放状态。
  11630. *
  11631. * 从微信客户端6.7.2版本开始,若需要在小程序切后台后继续播放音频,需要在 [app.json](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html) 中配置 `requiredBackgroundModes` 属性。开发版和体验版上可以直接生效,正式版还需通过审核。
  11632. *
  11633. * 最低基础库: `1.2.0` */
  11634. getBackgroundAudioManager(): BackgroundAudioManager
  11635. /** [[CameraContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.html) wx.createCameraContext()](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/wx.createCameraContext.html)
  11636. *
  11637. * 创建 [camera](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html) 上下文 [CameraContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.html) 对象。
  11638. *
  11639. * 最低基础库: `1.6.0` */
  11640. createCameraContext(): CameraContext
  11641. /** [[CanvasContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) wx.createCanvasContext(string canvasId, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createCanvasContext.html)
  11642. *
  11643. * 创建 canvas 的绘图上下文 [CanvasContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 对象
  11644. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [Canvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.html) 替换
  11645. * */
  11646. createCanvasContext(
  11647. /** 要获取上下文的 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 canvas-id 属性 */
  11648. canvasId: string,
  11649. /** 在自定义组件下,当前组件实例的this,表示在这个自定义组件下查找拥有 canvas-id 的 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) ,如果省略则不在任何自定义组件内查找 */
  11650. component?: Component.TrivialInstance | Page.TrivialInstance
  11651. ): CanvasContext
  11652. /** [[DownloadTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.html) wx.downloadFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/wx.downloadFile.html)
  11653. *
  11654. * 下载文件资源到本地。客户端直接发起一个 HTTPS GET 请求,返回文件的本地临时路径 (本地路径),单次下载允许的最大文件为 200MB。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
  11655. *
  11656. * 注意:请在服务端响应的 header 中指定合理的 `Content-Type` 字段,以保证客户端正确处理文件类型。
  11657. *
  11658. * **示例代码**
  11659. *
  11660. *
  11661. * ```js
  11662. wx.downloadFile({
  11663. url: 'https://example.com/audio/123', //仅为示例,并非真实的资源
  11664. success (res) {
  11665. // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
  11666. if (res.statusCode === 200) {
  11667. wx.playVoice({
  11668. filePath: res.tempFilePath
  11669. })
  11670. }
  11671. }
  11672. })
  11673. ``` */
  11674. downloadFile(option: DownloadFileOption): DownloadTask
  11675. /** [[FileSystemManager](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.html) wx.getFileSystemManager()](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileSystemManager.html)
  11676. *
  11677. * 获取全局唯一的文件管理器
  11678. *
  11679. * 最低基础库: `1.9.9` */
  11680. getFileSystemManager(): FileSystemManager
  11681. /** [[InnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.html) wx.createInnerAudioContext()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html)
  11682. *
  11683. * 创建内部 [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 上下文 [InnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.html) 对象。
  11684. *
  11685. * 最低基础库: `1.6.0` */
  11686. createInnerAudioContext(): InnerAudioContext
  11687. /** [[IntersectionObserver](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.html) wx.createIntersectionObserver(Object component, Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createIntersectionObserver.html)
  11688. *
  11689. * 创建并返回一个 IntersectionObserver 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createIntersectionObserver([options])` 来代替。
  11690. *
  11691. * **示例代码**
  11692. *
  11693. *
  11694. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/LAbMxkmI7F2A)
  11695. *
  11696. * 最低基础库: `1.9.3` */
  11697. createIntersectionObserver(
  11698. /** 自定义组件实例 */
  11699. component: IAnyObject,
  11700. /** 选项 */
  11701. options?: CreateIntersectionObserverOption
  11702. ): IntersectionObserver
  11703. /** [[InterstitialAd](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.html) wx.createInterstitialAd(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/wx.createInterstitialAd.html)
  11704. *
  11705. * 创建插屏广告组件。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API。每次调用该方法创建插屏广告都会返回一个全新的实例(小程序端的插屏广告实例不允许跨页面使用)。
  11706. *
  11707. * 最低基础库: `2.6.0` */
  11708. createInterstitialAd(option: CreateInterstitialAdOption): InterstitialAd
  11709. /** [[LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html) wx.createLivePlayerContext(string id, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/wx.createLivePlayerContext.html)
  11710. *
  11711. * 创建 [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 上下文 [LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html) 对象。建议使用 [wx.createSelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html) 获取 context 对象。
  11712. *
  11713. * 最低基础库: `1.7.0` */
  11714. createLivePlayerContext(
  11715. /** [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 组件的 id */
  11716. id: string,
  11717. /** 在自定义组件下,当前组件实例的this,以操作组件内 [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 组件 */
  11718. component?: Component.TrivialInstance | Page.TrivialInstance
  11719. ): LivePlayerContext
  11720. /** [[LivePusherContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.html) wx.createLivePusherContext()](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/wx.createLivePusherContext.html)
  11721. *
  11722. * 创建 [live-pusher](https://developers.weixin.qq.com/miniprogram/dev/component/live-pusher.html) 上下文 [LivePusherContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.html) 对象。
  11723. *
  11724. * 最低基础库: `1.7.0` */
  11725. createLivePusherContext(): LivePusherContext
  11726. /** [[LogManager](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.html) wx.getLogManager(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.getLogManager.html)
  11727. *
  11728. * 获取日志管理器对象。
  11729. *
  11730. * **示例代码**
  11731. *
  11732. *
  11733. * ```js
  11734. const logger = wx.getLogManager({level: 1})
  11735. logger.log({str: 'hello world'}, 'basic log', 100, [1, 2, 3])
  11736. logger.info({str: 'hello world'}, 'info log', 100, [1, 2, 3])
  11737. logger.debug({str: 'hello world'}, 'debug log', 100, [1, 2, 3])
  11738. logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3])
  11739. ```
  11740. *
  11741. * 最低基础库: `2.1.0` */
  11742. getLogManager(option: GetLogManagerOption): LogManager
  11743. /** [[MapContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.html) wx.createMapContext(string mapId, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/wx.createMapContext.html)
  11744. *
  11745. * 创建 [map](https://developers.weixin.qq.com/miniprogram/dev/component/map.html) 上下文 [MapContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.html) 对象。建议使用 [wx.createSelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html) 获取 context 对象。 */
  11746. createMapContext(
  11747. /** [map](https://developers.weixin.qq.com/miniprogram/dev/component/map.html) 组件的 id */
  11748. mapId: string,
  11749. /** 在自定义组件下,当前组件实例的this,以操作组件内 [map](https://developers.weixin.qq.com/miniprogram/dev/component/map.html) 组件 */
  11750. component?: Component.TrivialInstance | Page.TrivialInstance
  11751. ): MapContext
  11752. /** [[MediaAudioPlayer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.html) wx.createMediaAudioPlayer()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createMediaAudioPlayer.html)
  11753. *
  11754. * 创建媒体音频播放器对象 [MediaAudioPlayer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.html) 对象,可用于播放视频解码器 [VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) 输出的音频。
  11755. *
  11756. * **示例代码**
  11757. *
  11758. *
  11759. * ```js
  11760. // 创建视频解码器,具体参数见 createVideoDecoder 文档
  11761. const videoDecoder = wx.createVideoDecoder()
  11762. // 创建媒体音频播放器
  11763. const mediaAudioPlayer = wx.createMediaAudioPlayer()
  11764. // 启动视频解码器
  11765. videoDecoder.start()
  11766. // 启动播放器
  11767. mediaAudioPlayer.start().then(() => {
  11768. // 添加播放器音频来源
  11769. mediaAudioPlayer.addAudioSource(videoDecoder).then(res => {
  11770. videoDecoder.getFrameData() // 建议在 requestAnimationFrame 里获取每一帧视频数据
  11771. console.log(res)
  11772. })
  11773. // 移除播放器音频来源
  11774. mediaAudioPlaye.removeAudioSource(videoDecoder).then()
  11775. // 停止播放器
  11776. mediaAudioPlaye.stop().then()
  11777. // 销毁播放器
  11778. mediaAudioPlaye.destroy().then()
  11779. // 设置播放器音量
  11780. mediaAudioPlayer.volume = 0.5
  11781. })
  11782. ```
  11783. *
  11784. * **完整demo(小游戏)**
  11785. *
  11786. *
  11787. * - https://developers.weixin.qq.com/s/SF2duHmb7MjI
  11788. *
  11789. * 最低基础库: `2.13.0` */
  11790. createMediaAudioPlayer(): MediaAudioPlayer
  11791. /** [[MediaContainer](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.html) wx.createMediaContainer()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/wx.createMediaContainer.html)
  11792. *
  11793. * 创建音视频处理容器,最终可将容器中的轨道合成一个视频
  11794. *
  11795. * 最低基础库: `2.9.0` */
  11796. createMediaContainer(): MediaContainer
  11797. /** [[MediaRecorder](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.html) wx.createMediaRecorder(Object canvas, Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/wx.createMediaRecorder.html)
  11798. *
  11799. * 创建 WebGL 画面录制器,可逐帧录制在 WebGL 上渲染的画面并导出视频文件
  11800. *
  11801. * 最低基础库: `2.11.0` */
  11802. createMediaRecorder(
  11803. /** WebGL 对象,通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取到的 node 对象 */
  11804. canvas: IAnyObject,
  11805. options: CreateMediaRecorderOption
  11806. ): MediaRecorder
  11807. /** [[NFCAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.html) wx.getNFCAdapter()](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.getNFCAdapter.html)
  11808. *
  11809. * 获取 NFC 实例
  11810. *
  11811. * **示例代码**
  11812. *
  11813. *
  11814. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/1WsbDwmb75ig)
  11815. *
  11816. * 最低基础库: `2.11.2` */
  11817. getNFCAdapter(): NFCAdapter
  11818. /** [[OffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.html) wx.createOffscreenCanvas()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html)
  11819. *
  11820. * 创建离屏 canvas 实例
  11821. *
  11822. * 最低基础库: `2.7.0` */
  11823. createOffscreenCanvas(): OffscreenCanvas
  11824. /** [[Performance](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/Performance.html) wx.getPerformance()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/wx.getPerformance.html)
  11825. *
  11826. * 获取当前小程序性能相关的信息。
  11827. *
  11828. * ****
  11829. *
  11830. * 目前支持获取以下几类性能指标:
  11831. *
  11832. * | 指标类型(entryType) | 指标名称 |
  11833. * | ------------------- | ---------------- |
  11834. * | 路由(navigation) | route: 路由性能;appLaunch: 小程序启动耗时 |
  11835. * | 渲染(render) | firstRender: 页面首次渲染耗时 |
  11836. * | 脚本(script) | evaluateScript: 注入脚本耗时 |
  11837. *
  11838. * 性能数据详情:
  11839. *
  11840. * | 属性 | 说明 |
  11841. * | ---- | ----- |
  11842. * | entryType | 指标类型 |
  11843. * | name | 指标名称 |
  11844. * | startTime | 指标调用开始时间 |
  11845. * | duration | 耗时 |
  11846. * | path | 路径 |
  11847. * | navigationStart | 路由真正响应开始时间 |
  11848. * | navigationType | 路由详细类型 |
  11849. *
  11850. * **示例代码**
  11851. *
  11852. *
  11853. * ```js
  11854. const performance = wx.getPerformance()
  11855. const observer = performance.createObserver((entryList) => {
  11856. console.log(entryList.getEntries())
  11857. })
  11858. observer.observe({ entryTypes: ['render', 'script'] })
  11859. ```
  11860. *
  11861. * 最低基础库: `2.11.0` */
  11862. getPerformance(): Performance
  11863. /** [[RealtimeLogManager](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.html) wx.getRealtimeLogManager()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.getRealtimeLogManager.html)
  11864. *
  11865. * 获取实时日志管理器对象。
  11866. *
  11867. * **示例代码**
  11868. *
  11869. *
  11870. * ```js
  11871. const logger = wx.getRealtimeLogManager()
  11872. logger.info({str: 'hello world'}, 'info log', 100, [1, 2, 3])
  11873. logger.error({str: 'hello world'}, 'error log', 100, [1, 2, 3])
  11874. logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3])
  11875. ```
  11876. *
  11877. * 最低基础库: `2.7.1` */
  11878. getRealtimeLogManager(): RealtimeLogManager
  11879. /** [[RecorderManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.html) wx.getRecorderManager()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.getRecorderManager.html)
  11880. *
  11881. * 获取**全局唯一**的录音管理器 RecorderManager
  11882. *
  11883. * 最低基础库: `1.6.0` */
  11884. getRecorderManager(): RecorderManager
  11885. /** [[RequestTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.html) wx.request(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.request.html)
  11886. *
  11887. * 发起 HTTPS 网络请求。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
  11888. *
  11889. * **data 参数说明**
  11890. *
  11891. *
  11892. * 最终发送给服务器的数据是 String 类型,如果传入的 data 不是 String 类型,会被转换成 String 。转换规则如下:
  11893. * - 对于 `GET` 方法的数据,会将数据转换成 query string(`encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...`)
  11894. * - 对于 `POST` 方法且 `header['content-type']` 为 `application/json` 的数据,会对数据进行 JSON 序列化
  11895. * - 对于 `POST` 方法且 `header['content-type']` 为 `application/x-www-form-urlencoded` 的数据,会将数据转换成 query string `(encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...)`
  11896. *
  11897. * **示例代码**
  11898. *
  11899. *
  11900. * ```js
  11901. wx.request({
  11902. url: 'test.php', //仅为示例,并非真实的接口地址
  11903. data: {
  11904. x: '',
  11905. y: ''
  11906. },
  11907. header: {
  11908. 'content-type': 'application/json' // 默认值
  11909. },
  11910. success (res) {
  11911. console.log(res.data)
  11912. }
  11913. })
  11914. ``` */
  11915. request<
  11916. T extends string | IAnyObject | ArrayBuffer =
  11917. | string
  11918. | IAnyObject
  11919. | ArrayBuffer
  11920. >(
  11921. option: RequestOption<T>
  11922. ): RequestTask
  11923. /** [[RewardedVideoAd](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.html) wx.createRewardedVideoAd(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/wx.createRewardedVideoAd.html)
  11924. *
  11925. * 创建激励视频广告组件。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API(小游戏端要求 >= 2.0.4, 小程序端要求 >= 2.6.0)。调用该方法创建的激励视频广告是一个单例(小游戏端是全局单例,小程序端是页面内单例,在小程序端的单例对象不允许跨页面使用)。
  11926. *
  11927. * 最低基础库: `2.0.4` */
  11928. createRewardedVideoAd(
  11929. option: CreateRewardedVideoAdOption
  11930. ): RewardedVideoAd
  11931. /** [[SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) wx.createSelectorQuery()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html)
  11932. *
  11933. * 返回一个 SelectorQuery 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createSelectorQuery()` 来代替。
  11934. *
  11935. * **示例代码**
  11936. *
  11937. *
  11938. * ```js
  11939. const query = wx.createSelectorQuery()
  11940. query.select('#the-id').boundingClientRect()
  11941. query.selectViewport().scrollOffset()
  11942. query.exec(function(res){
  11943. res[0].top // #the-id节点的上边界坐标
  11944. res[1].scrollTop // 显示区域的竖直滚动位置
  11945. })
  11946. ```
  11947. *
  11948. * 最低基础库: `1.4.0` */
  11949. createSelectorQuery(): SelectorQuery
  11950. /** [[SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) wx.connectSocket(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.connectSocket.html)
  11951. *
  11952. * 创建一个 WebSocket 连接。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
  11953. *
  11954. * **并发数**
  11955. *
  11956. *
  11957. * - 1.7.0 及以上版本,最多可以同时存在 5 个 WebSocket 连接。
  11958. * - 1.7.0 以下版本,一个小程序同时只能有一个 WebSocket 连接,如果当前已存在一个 WebSocket 连接,会自动关闭该连接,并重新创建一个 WebSocket 连接。
  11959. *
  11960. * **示例代码**
  11961. *
  11962. *
  11963. * ```js
  11964. wx.connectSocket({
  11965. url: 'wss://example.qq.com',
  11966. header:{
  11967. 'content-type': 'application/json'
  11968. },
  11969. protocols: ['protocol1']
  11970. })
  11971. ``` */
  11972. connectSocket(option: ConnectSocketOption): SocketTask
  11973. /** [[UDPSocket](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.html) wx.createUDPSocket()](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/wx.createUDPSocket.html)
  11974. *
  11975. * 创建一个 UDP Socket 实例。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
  11976. *
  11977. * 最低基础库: `2.7.0` */
  11978. createUDPSocket(): UDPSocket
  11979. /** [[UpdateManager](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html) wx.getUpdateManager()](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/wx.getUpdateManager.html)
  11980. *
  11981. * 获取**全局唯一**的版本更新管理器,用于管理小程序更新。关于小程序的更新机制,可以查看[运行机制](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/operating-mechanism.html)文档。
  11982. *
  11983. * 最低基础库: `1.9.90` */
  11984. getUpdateManager(): UpdateManager
  11985. /** [[UploadTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.html) wx.uploadFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/wx.uploadFile.html)
  11986. *
  11987. * 将本地资源上传到服务器。客户端发起一个 HTTPS POST 请求,其中 `content-type` 为 `multipart/form-data`。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
  11988. *
  11989. * **示例代码**
  11990. *
  11991. *
  11992. * ```js
  11993. wx.chooseImage({
  11994. success (res) {
  11995. const tempFilePaths = res.tempFilePaths
  11996. wx.uploadFile({
  11997. url: 'https://example.weixin.qq.com/upload', //仅为示例,非真实的接口地址
  11998. filePath: tempFilePaths[0],
  11999. name: 'file',
  12000. formData: {
  12001. 'user': 'test'
  12002. },
  12003. success (res){
  12004. const data = res.data
  12005. //do something
  12006. }
  12007. })
  12008. }
  12009. })
  12010. ``` */
  12011. uploadFile(option: UploadFileOption): UploadTask
  12012. /** [[VideoContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html) wx.createVideoContext(string id, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.createVideoContext.html)
  12013. *
  12014. * 创建 [video](https://developers.weixin.qq.com/miniprogram/dev/component/video.html) 上下文 [VideoContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html) 对象。建议使用 [wx.createSelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html) 获取 context 对象。 */
  12015. createVideoContext(
  12016. /** [video](https://developers.weixin.qq.com/miniprogram/dev/component/video.html) 组件的 id */
  12017. id: string,
  12018. /** 在自定义组件下,当前组件实例的this,以操作组件内 [video](https://developers.weixin.qq.com/miniprogram/dev/component/video.html) 组件 */
  12019. component?: Component.TrivialInstance | Page.TrivialInstance
  12020. ): VideoContext
  12021. /** [[VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html) wx.createVideoDecoder()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/wx.createVideoDecoder.html)
  12022. *
  12023. * 创建视频解码器,可逐帧获取解码后的数据
  12024. *
  12025. * 最低基础库: `2.11.0` */
  12026. createVideoDecoder(): VideoDecoder
  12027. /** [[Worker](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.html) wx.createWorker(string scriptPath, object options)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/wx.createWorker.html)
  12028. *
  12029. * 创建一个 [Worker 线程](https://developers.weixin.qq.com/miniprogram/dev/framework/workers.html)
  12030. *
  12031. * **示例代码**
  12032. *
  12033. *
  12034. * ```js
  12035. // 创建普通worker
  12036. wx.createWorker('workers/index.js')
  12037. ```
  12038. * ```js
  12039. // 创建实验worker
  12040. wx.createWorker('workers/index.js', {
  12041. useExperimentalWorker: true
  12042. })
  12043. ```
  12044. *
  12045. * 最低基础库: `1.9.90` */
  12046. createWorker(
  12047. /** worker 入口文件的**绝对路径** */
  12048. scriptPath: string,
  12049. /** 可选参数 */
  12050. options?: CreateWorkerOption
  12051. ): Worker
  12052. /** [any wx.getStorageSync(string key)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageSync.html)
  12053. *
  12054. * [wx.getStorage](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorage.html) 的同步版本
  12055. *
  12056. * **示例代码**
  12057. *
  12058. *
  12059. * ```js
  12060. wx.getStorage({
  12061. key: 'key',
  12062. success (res) {
  12063. console.log(res.data)
  12064. }
  12065. })
  12066. ```
  12067. *
  12068. * ```js
  12069. try {
  12070. var value = wx.getStorageSync('key')
  12071. if (value) {
  12072. // Do something with return value
  12073. }
  12074. } catch (e) {
  12075. // Do something when catch error
  12076. }
  12077. ``` */
  12078. getStorageSync<T = any>(
  12079. /** 本地缓存中指定的 key */
  12080. key: string
  12081. ): T
  12082. /** [boolean wx.canIUse(string schema)](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.canIUse.html)
  12083. *
  12084. * 判断小程序的API,回调,参数,组件等是否在当前版本可用。
  12085. *
  12086. * **参数说明**
  12087. *
  12088. *
  12089. * - `${API}` 代表 API 名字
  12090. * - `${method}` 代表调用方式,有效值为return, success, object, callback
  12091. * - `${param}` 代表参数或者返回值
  12092. * - `${option}` 代表参数的可选值或者返回值的属性
  12093. * - `${component}` 代表组件名字
  12094. * - `${attribute}` 代表组件属性
  12095. * - `${option}` 代表组件属性的可选值
  12096. *
  12097. * **示例代码**
  12098. *
  12099. *
  12100. * ```js
  12101. // 对象的属性或方法
  12102. wx.canIUse('console.log')
  12103. wx.canIUse('CameraContext.onCameraFrame')
  12104. wx.canIUse('CameraFrameListener.start')
  12105. wx.canIUse('Image.src')
  12106. // wx接口参数、回调或者返回值
  12107. wx.canIUse('openBluetoothAdapter')
  12108. wx.canIUse('getSystemInfoSync.return.safeArea.left')
  12109. wx.canIUse('getSystemInfo.success.screenWidth')
  12110. wx.canIUse('showToast.object.image')
  12111. wx.canIUse('onCompassChange.callback.direction')
  12112. wx.canIUse('request.object.method.GET')
  12113. // 组件的属性
  12114. wx.canIUse('live-player')
  12115. wx.canIUse('text.selectable')
  12116. wx.canIUse('button.open-type.contact')
  12117. ```
  12118. *
  12119. * 最低基础库: `1.1.1` */
  12120. canIUse(
  12121. /** 使用 `${API}.${method}.${param}.${option}` 或者 `${component}.${attribute}.${option}` 方式来调用 */
  12122. schema: string
  12123. ): boolean
  12124. /** [string wx.arrayBufferToBase64(ArrayBuffer arrayBuffer)](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.arrayBufferToBase64.html)
  12125. *
  12126. * 将 ArrayBuffer 对象转成 Base64 字符串
  12127. *
  12128. * 最低基础库: `1.1.0`
  12129. * @deprecated 基础库版本 [2.4.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃
  12130. * */
  12131. arrayBufferToBase64(
  12132. /** 要转换成 Base64 字符串的 ArrayBuffer 对象 */
  12133. arrayBuffer: ArrayBuffer
  12134. ): string
  12135. /** [wx.addCard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/card/wx.addCard.html)
  12136. *
  12137. * 批量添加卡券。只有通过 [认证](https://developers.weixin.qq.com/miniprogram/product/renzheng.html) 的小程序或文化互动类目的小游戏才能使用。更多文档请参考 [微信卡券接口文档](https://mp.weixin.qq.com/cgi-bin/announce?action=getannouncement&key=1490190158&version=1&lang=zh_CN&platform=2)。
  12138. *
  12139. * **cardExt 说明**
  12140. *
  12141. *
  12142. * cardExt 是卡券的扩展参数,其值是一个 JSON 字符串。
  12143. *
  12144. * **示例代码**
  12145. *
  12146. *
  12147. * ```js
  12148. wx.addCard({
  12149. cardList: [
  12150. {
  12151. cardId: '',
  12152. cardExt: '{"code": "", "openid": "", "timestamp": "", "signature":""}'
  12153. }, {
  12154. cardId: '',
  12155. cardExt: '{"code": "", "openid": "", "timestamp": "", "signature":""}'
  12156. }
  12157. ],
  12158. success (res) {
  12159. console.log(res.cardList) // 卡券添加结果
  12160. }
  12161. })
  12162. ```
  12163. *
  12164. * 最低基础库: `1.1.0` */
  12165. addCard<T extends AddCardOption = AddCardOption>(
  12166. option: T
  12167. ): PromisifySuccessResult<T, AddCardOption>
  12168. /** [wx.addPhoneCalendar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneCalendar.html)
  12169. *
  12170. * 向系统日历添加事件
  12171. *
  12172. * 最低基础库: `2.15.0` */
  12173. addPhoneCalendar<
  12174. T extends AddPhoneCalendarOption = AddPhoneCalendarOption
  12175. >(
  12176. option: T
  12177. ): PromisifySuccessResult<T, AddPhoneCalendarOption>
  12178. /** [wx.addPhoneContact(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.addPhoneContact.html)
  12179. *
  12180. * 添加手机通讯录联系人。用户可以选择将该表单以「新增联系人」或「添加到已有联系人」的方式,写入手机系统通讯录。
  12181. *
  12182. * 最低基础库: `1.2.0` */
  12183. addPhoneContact<
  12184. T extends AddPhoneContactOption = AddPhoneContactOption
  12185. >(
  12186. option: T
  12187. ): PromisifySuccessResult<T, AddPhoneContactOption>
  12188. /** [wx.addPhoneRepeatCalendar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneRepeatCalendar.html)
  12189. *
  12190. * 向系统日历添加重复事件
  12191. *
  12192. * 最低基础库: `2.15.0` */
  12193. addPhoneRepeatCalendar<
  12194. T extends AddPhoneRepeatCalendarOption = AddPhoneRepeatCalendarOption
  12195. >(
  12196. option: T
  12197. ): PromisifySuccessResult<T, AddPhoneRepeatCalendarOption>
  12198. /** [wx.authPrivateMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.authPrivateMessage.html)
  12199. *
  12200. * 验证私密消息。用法详情见 [小程序私密消息使用指南](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share/private-message.html)
  12201. *
  12202. * **示例代码**
  12203. *
  12204. *
  12205. * ```js
  12206. wx.authPrivateMessage({
  12207. shareTicket: 'xxxxxx',
  12208. success(res) {
  12209. console.log('authPrivateMessage success', res)
  12210. // res
  12211. // {
  12212. // errMsg: 'authPrivateMessage:ok'
  12213. // valid: true
  12214. // iv: 'xxxx',
  12215. // encryptedData: 'xxxxxx'
  12216. // }
  12217. },
  12218. fail(res) {
  12219. console.log('authPrivateMessage fail', res)
  12220. }
  12221. })
  12222. ```
  12223. *
  12224. * 最低基础库: `2.13.0` */
  12225. authPrivateMessage(option?: AuthPrivateMessageOption): void
  12226. /** [wx.authorize(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorize.html)
  12227. *
  12228. * 提前向用户发起授权请求。调用后会立刻弹窗询问用户是否同意授权小程序使用某项功能或获取用户的某些数据,但不会实际调用对应接口。如果用户之前已经同意授权,则不会出现弹窗,直接返回成功。更多用法详见 [用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)。
  12229. * > 小程序插件可以使用 [wx.authorizeForMiniProgram](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorizeForMiniProgram.html)
  12230. *
  12231. * **示例代码**
  12232. *
  12233. *
  12234. * ```js
  12235. // 可以通过 wx.getSetting 先查询一下用户是否授权了 "scope.record" 这个 scope
  12236. wx.getSetting({
  12237. success(res) {
  12238. if (!res.authSetting['scope.record']) {
  12239. wx.authorize({
  12240. scope: 'scope.record',
  12241. success () {
  12242. // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
  12243. wx.startRecord()
  12244. }
  12245. })
  12246. }
  12247. }
  12248. })
  12249. ```
  12250. *
  12251. * 最低基础库: `1.2.0` */
  12252. authorize<T extends AuthorizeOption = AuthorizeOption>(
  12253. option: T
  12254. ): PromisifySuccessResult<T, AuthorizeOption>
  12255. /** [wx.authorizeForMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorizeForMiniProgram.html)
  12256. *
  12257. * **仅小程序插件中能调用该接口**,用法同 [wx.authorize](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorize.html)。目前仅支持三种 scope(见下)
  12258. *
  12259. * **示例代码**
  12260. *
  12261. *
  12262. * ```js
  12263. wx.authorizeForMiniProgram({
  12264. scope: 'scope.record',
  12265. success () {
  12266. // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
  12267. wx.startRecord()
  12268. }
  12269. })
  12270. ```
  12271. *
  12272. * 最低基础库: `2.14.4` */
  12273. authorizeForMiniProgram(option: AuthorizeForMiniProgramOption): void
  12274. /** [wx.canvasGetImageData(Object object, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasGetImageData.html)
  12275. *
  12276. * 获取 canvas 区域隐含的像素数据。
  12277. *
  12278. * **示例代码**
  12279. *
  12280. *
  12281. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/yufmRjmZ7W8f)
  12282. *
  12283. * ```js
  12284. wx.canvasGetImageData({
  12285. canvasId: 'myCanvas',
  12286. x: 0,
  12287. y: 0,
  12288. width: 100,
  12289. height: 100,
  12290. success(res) {
  12291. console.log(res.width) // 100
  12292. console.log(res.height) // 100
  12293. console.log(res.data instanceof Uint8ClampedArray) // true
  12294. console.log(res.data.length) // 100 * 100 * 4
  12295. }
  12296. })
  12297. ```
  12298. *
  12299. * 最低基础库: `1.9.0` */
  12300. canvasGetImageData<
  12301. T extends CanvasGetImageDataOption = CanvasGetImageDataOption
  12302. >(
  12303. option: T,
  12304. /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 */
  12305. component?: Component.TrivialInstance | Page.TrivialInstance
  12306. ): PromisifySuccessResult<T, CanvasGetImageDataOption>
  12307. /** [wx.canvasPutImageData(Object object, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasPutImageData.html)
  12308. *
  12309. * 将像素数据绘制到画布。在自定义组件下,第二个参数传入自定义组件实例 this,以操作组件内 <canvas> 组件
  12310. *
  12311. * 最低基础库: `1.9.0` */
  12312. canvasPutImageData<
  12313. T extends CanvasPutImageDataOption = CanvasPutImageDataOption
  12314. >(
  12315. option: T,
  12316. /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 */
  12317. component?: Component.TrivialInstance | Page.TrivialInstance
  12318. ): PromisifySuccessResult<T, CanvasPutImageDataOption>
  12319. /** [wx.canvasToTempFilePath(Object object, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasToTempFilePath.html)
  12320. *
  12321. * 把当前画布指定区域的内容导出生成指定大小的图片。在 `draw()` 回调里调用该方法才能保证图片导出成功。 */
  12322. canvasToTempFilePath<
  12323. T extends CanvasToTempFilePathOption = CanvasToTempFilePathOption
  12324. >(
  12325. option: T,
  12326. /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 */
  12327. component?: Component.TrivialInstance | Page.TrivialInstance
  12328. ): PromisifySuccessResult<T, CanvasToTempFilePathOption>
  12329. /** [wx.checkIsOpenAccessibility(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accessibility/wx.checkIsOpenAccessibility.html)
  12330. *
  12331. * 检测是否开启视觉无障碍功能。
  12332. *
  12333. * 最低基础库: `2.13.0` */
  12334. checkIsOpenAccessibility<
  12335. T extends CheckIsOpenAccessibilityOption = CheckIsOpenAccessibilityOption
  12336. >(
  12337. option?: T
  12338. ): PromisifySuccessResult<T, CheckIsOpenAccessibilityOption>
  12339. /** [wx.checkIsSoterEnrolledInDevice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.checkIsSoterEnrolledInDevice.html)
  12340. *
  12341. * 获取设备内是否录入如指纹等生物信息的接口
  12342. *
  12343. * **示例代码**
  12344. *
  12345. *
  12346. * ```js
  12347. wx.checkIsSoterEnrolledInDevice({
  12348. checkAuthMode: 'fingerPrint',
  12349. success(res) {
  12350. console.log(res.isEnrolled)
  12351. }
  12352. })
  12353. ```
  12354. *
  12355. * 最低基础库: `1.6.0` */
  12356. checkIsSoterEnrolledInDevice<
  12357. T extends CheckIsSoterEnrolledInDeviceOption = CheckIsSoterEnrolledInDeviceOption
  12358. >(
  12359. option: T
  12360. ): PromisifySuccessResult<T, CheckIsSoterEnrolledInDeviceOption>
  12361. /** [wx.checkIsSupportSoterAuthentication(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.checkIsSupportSoterAuthentication.html)
  12362. *
  12363. * 获取本机支持的 SOTER 生物认证方式
  12364. *
  12365. * **示例代码**
  12366. *
  12367. *
  12368. * ```js
  12369. wx.checkIsSupportSoterAuthentication({
  12370. success(res) {
  12371. // res.supportMode = [] 不具备任何被SOTER支持的生物识别方式
  12372. // res.supportMode = ['fingerPrint'] 只支持指纹识别
  12373. // res.supportMode = ['fingerPrint', 'facial'] 支持指纹识别和人脸识别
  12374. }
  12375. })
  12376. ```
  12377. *
  12378. * 最低基础库: `1.5.0` */
  12379. checkIsSupportSoterAuthentication<
  12380. T extends CheckIsSupportSoterAuthenticationOption = CheckIsSupportSoterAuthenticationOption
  12381. >(
  12382. option?: T
  12383. ): PromisifySuccessResult<T, CheckIsSupportSoterAuthenticationOption>
  12384. /** [wx.checkSession(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.checkSession.html)
  12385. *
  12386. * 检查登录态是否过期。
  12387. *
  12388. * 通过 wx.login 接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能失效。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。开发者只需要调用 wx.checkSession 接口检测当前用户登录态是否有效。
  12389. *
  12390. * 登录态过期后开发者可以再调用 wx.login 获取新的用户登录态。调用成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
  12391. *
  12392. * **示例代码**
  12393. *
  12394. *
  12395. * ```js
  12396. wx.checkSession({
  12397. success () {
  12398. //session_key 未过期,并且在本生命周期一直有效
  12399. },
  12400. fail () {
  12401. // session_key 已经失效,需要重新执行登录流程
  12402. wx.login() //重新登录
  12403. }
  12404. })
  12405. ``` */
  12406. checkSession<T extends CheckSessionOption = CheckSessionOption>(
  12407. option?: T
  12408. ): PromisifySuccessResult<T, CheckSessionOption>
  12409. /** [wx.chooseAddress(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/address/wx.chooseAddress.html)
  12410. *
  12411. * 获取用户收货地址。调起用户编辑收货地址原生界面,并在编辑完成后返回用户选择的地址。
  12412. *
  12413. * **示例代码**
  12414. *
  12415. *
  12416. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/024hHnmd772y)
  12417. * ```js
  12418. wx.chooseAddress({
  12419. success (res) {
  12420. console.log(res.userName)
  12421. console.log(res.postalCode)
  12422. console.log(res.provinceName)
  12423. console.log(res.cityName)
  12424. console.log(res.countyName)
  12425. console.log(res.detailInfo)
  12426. console.log(res.nationalCode)
  12427. console.log(res.telNumber)
  12428. }
  12429. })
  12430. ```
  12431. *
  12432. * 最低基础库: `1.1.0` */
  12433. chooseAddress<T extends ChooseAddressOption = ChooseAddressOption>(
  12434. option?: T
  12435. ): PromisifySuccessResult<T, ChooseAddressOption>
  12436. /** [wx.chooseImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html)
  12437. *
  12438. * 从本地相册选择图片或使用相机拍照。
  12439. *
  12440. * ****
  12441. *
  12442. * ```js
  12443. wx.chooseImage({
  12444. count: 1,
  12445. sizeType: ['original', 'compressed'],
  12446. sourceType: ['album', 'camera'],
  12447. success (res) {
  12448. // tempFilePath可以作为img标签的src属性显示图片
  12449. const tempFilePaths = res.tempFilePaths
  12450. }
  12451. })
  12452. ``` */
  12453. chooseImage<T extends ChooseImageOption = ChooseImageOption>(
  12454. option?: T
  12455. ): PromisifySuccessResult<T, ChooseImageOption>
  12456. /** [wx.chooseInvoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoice.html)
  12457. *
  12458. * 选择用户已有的发票。
  12459. *
  12460. * **通过 cardId 和 encryptCode 获得报销发票的信息**
  12461. *
  12462. *
  12463. * 请参考[微信电子发票文档](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=21517918939oae3U)中,「查询报销发票信息」部分。
  12464. * 其中 `access_token` 的获取请参考[auth.getAccessToken](https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/access-token/auth.getAccessToken.html)文档
  12465. *
  12466. * 最低基础库: `2.3.0` */
  12467. chooseInvoice<T extends ChooseInvoiceOption = ChooseInvoiceOption>(
  12468. option?: T
  12469. ): PromisifySuccessResult<T, ChooseInvoiceOption>
  12470. /** [wx.chooseInvoiceTitle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoiceTitle.html)
  12471. *
  12472. * 选择用户的发票抬头。当前小程序必须关联一个公众号,且这个公众号是完成了[微信认证](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1496554031_RD4xe)的,才能调用 chooseInvoiceTitle。
  12473. *
  12474. * **示例代码**
  12475. *
  12476. *
  12477. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/GJ4S9nmQ7x2E)
  12478. *
  12479. * ```js
  12480. wx.chooseInvoiceTitle({
  12481. success(res) {}
  12482. })
  12483. ```
  12484. *
  12485. * 最低基础库: `1.5.0` */
  12486. chooseInvoiceTitle<
  12487. T extends ChooseInvoiceTitleOption = ChooseInvoiceTitleOption
  12488. >(
  12489. option?: T
  12490. ): PromisifySuccessResult<T, ChooseInvoiceTitleOption>
  12491. /** [wx.chooseLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.chooseLocation.html)
  12492. *
  12493. * 打开地图选择位置。 */
  12494. chooseLocation<T extends ChooseLocationOption = ChooseLocationOption>(
  12495. option: T
  12496. ): PromisifySuccessResult<T, ChooseLocationOption>
  12497. /** [wx.chooseMedia(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html)
  12498. *
  12499. * 拍摄或从手机相册中选择图片或视频。
  12500. *
  12501. * **示例代码**
  12502. *
  12503. *
  12504. * ```js
  12505. wx.chooseMedia({
  12506. count: 9,
  12507. mediaType: ['image','video'],
  12508. sourceType: ['album', 'camera'],
  12509. maxDuration: 30,
  12510. camera: 'back',
  12511. success(res) {
  12512. console.log(res.tempFiles.tempFilePath)
  12513. console.log(res.tempFiles.size)
  12514. }
  12515. })
  12516. ```
  12517. *
  12518. * 最低基础库: `2.10.0` */
  12519. chooseMedia<T extends ChooseMediaOption = ChooseMediaOption>(
  12520. option: T
  12521. ): PromisifySuccessResult<T, ChooseMediaOption>
  12522. /** [wx.chooseMessageFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseMessageFile.html)
  12523. *
  12524. * 从客户端会话选择文件。
  12525. *
  12526. * ****
  12527. *
  12528. * ```js
  12529. wx.chooseMessageFile({
  12530. count: 10,
  12531. type: 'image',
  12532. success (res) {
  12533. // tempFilePath可以作为img标签的src属性显示图片
  12534. const tempFilePaths = res.tempFiles
  12535. }
  12536. })
  12537. ```
  12538. *
  12539. * 最低基础库: `2.5.0` */
  12540. chooseMessageFile<
  12541. T extends ChooseMessageFileOption = ChooseMessageFileOption
  12542. >(
  12543. option: T
  12544. ): PromisifySuccessResult<T, ChooseMessageFileOption>
  12545. /** [wx.chooseVideo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseVideo.html)
  12546. *
  12547. * 拍摄视频或从手机相册中选视频。
  12548. *
  12549. * **示例代码**
  12550. *
  12551. *
  12552. * ```js
  12553. wx.chooseVideo({
  12554. sourceType: ['album','camera'],
  12555. maxDuration: 60,
  12556. camera: 'back',
  12557. success(res) {
  12558. console.log(res.tempFilePath)
  12559. }
  12560. })
  12561. ``` */
  12562. chooseVideo<T extends ChooseVideoOption = ChooseVideoOption>(
  12563. option: T
  12564. ): PromisifySuccessResult<T, ChooseVideoOption>
  12565. /** [wx.clearStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorage.html)
  12566. *
  12567. * 清理本地数据缓存。缓存相关策略请查看 [存储](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/storage.html)。
  12568. *
  12569. * **示例代码**
  12570. *
  12571. *
  12572. * ```js
  12573. wx.clearStorage()
  12574. ```
  12575. *
  12576. * ```js
  12577. try {
  12578. wx.clearStorageSync()
  12579. } catch(e) {
  12580. // Do something when catch error
  12581. }
  12582. ``` */
  12583. clearStorage<T extends ClearStorageOption = ClearStorageOption>(
  12584. option?: T
  12585. ): PromisifySuccessResult<T, ClearStorageOption>
  12586. /** [wx.clearStorageSync()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorageSync.html)
  12587. *
  12588. * [wx.clearStorage](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorage.html) 的同步版本
  12589. *
  12590. * **示例代码**
  12591. *
  12592. *
  12593. * ```js
  12594. wx.clearStorage()
  12595. ```
  12596. *
  12597. * ```js
  12598. try {
  12599. wx.clearStorageSync()
  12600. } catch(e) {
  12601. // Do something when catch error
  12602. }
  12603. ``` */
  12604. clearStorageSync(): void
  12605. /** [wx.closeBLEConnection(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.closeBLEConnection.html)
  12606. *
  12607. * 断开与低功耗蓝牙设备的连接。
  12608. *
  12609. * **示例代码**
  12610. *
  12611. *
  12612. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  12613. * ```js
  12614. wx.closeBLEConnection({
  12615. deviceId,
  12616. success (res) {
  12617. console.log(res)
  12618. }
  12619. })
  12620. ```
  12621. *
  12622. * 最低基础库: `1.1.0` */
  12623. closeBLEConnection<
  12624. T extends CloseBLEConnectionOption = CloseBLEConnectionOption
  12625. >(
  12626. option: T
  12627. ): PromisifySuccessResult<T, CloseBLEConnectionOption>
  12628. /** [wx.closeBluetoothAdapter(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.closeBluetoothAdapter.html)
  12629. *
  12630. * 关闭蓝牙模块。调用该方法将断开所有已建立的连接并释放系统资源。建议在使用蓝牙流程后,与 [wx.openBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html) 成对调用。
  12631. *
  12632. * **示例代码**
  12633. *
  12634. *
  12635. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  12636. * ```js
  12637. wx.closeBluetoothAdapter({
  12638. success (res) {
  12639. console.log(res)
  12640. }
  12641. })
  12642. ```
  12643. *
  12644. * 最低基础库: `1.1.0` */
  12645. closeBluetoothAdapter<
  12646. T extends CloseBluetoothAdapterOption = CloseBluetoothAdapterOption
  12647. >(
  12648. option?: T
  12649. ): PromisifySuccessResult<T, CloseBluetoothAdapterOption>
  12650. /** [wx.closeSocket(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.closeSocket.html)
  12651. *
  12652. * 关闭 WebSocket 连接
  12653. *
  12654. * **示例代码**
  12655. *
  12656. *
  12657. * ```js
  12658. wx.connectSocket({
  12659. url: 'test.php'
  12660. })
  12661. //注意这里有时序问题,
  12662. //如果 wx.connectSocket 还没回调 wx.onSocketOpen,而先调用 wx.closeSocket,那么就做不到关闭 WebSocket 的目的。
  12663. //必须在 WebSocket 打开期间调用 wx.closeSocket 才能关闭。
  12664. wx.onSocketOpen(function() {
  12665. wx.closeSocket()
  12666. })
  12667. wx.onSocketClose(function(res) {
  12668. console.log('WebSocket 已关闭!')
  12669. })
  12670. ``` */
  12671. closeSocket<T extends CloseSocketOption = CloseSocketOption>(
  12672. option?: T
  12673. ): PromisifySuccessResult<T, CloseSocketOption>
  12674. /** [wx.compressImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.compressImage.html)
  12675. *
  12676. * 压缩图片接口,可选压缩质量
  12677. *
  12678. * **示例代码**
  12679. *
  12680. *
  12681. * ```js
  12682. wx.compressImage({
  12683. src: '', // 图片路径
  12684. quality: 80 // 压缩质量
  12685. })
  12686. ```
  12687. *
  12688. * 最低基础库: `2.4.0` */
  12689. compressImage<T extends CompressImageOption = CompressImageOption>(
  12690. option: T
  12691. ): PromisifySuccessResult<T, CompressImageOption>
  12692. /** [wx.compressVideo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.compressVideo.html)
  12693. *
  12694. * 压缩视频接口。开发者可指定压缩质量 `quality` 进行压缩。当需要更精细的控制时,可指定 `bitrate`、`fps`、和 `resolution`,当 `quality` 传入时,这三个参数将被忽略。原视频的相关信息可通过 [getVideoInfo](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.getVideoInfo.html) 获取。
  12695. *
  12696. * 最低基础库: `2.11.0` */
  12697. compressVideo<T extends CompressVideoOption = CompressVideoOption>(
  12698. option: T
  12699. ): PromisifySuccessResult<T, CompressVideoOption>
  12700. /** [wx.connectWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.connectWifi.html)
  12701. *
  12702. * 连接 Wi-Fi。若已知 Wi-Fi 信息,可以直接利用该接口连接。仅 Android 与 iOS 11 以上版本支持。
  12703. *
  12704. * **示例代码**
  12705. *
  12706. *
  12707. * ```js
  12708. wx.connectWifi({
  12709. SSID: '',
  12710. password: '',
  12711. success (res) {
  12712. console.log(res.errMsg)
  12713. }
  12714. })
  12715. ```
  12716. *
  12717. * 最低基础库: `1.6.0` */
  12718. connectWifi<T extends ConnectWifiOption = ConnectWifiOption>(
  12719. option: T
  12720. ): PromisifySuccessResult<T, ConnectWifiOption>
  12721. /** [wx.createBLEConnection(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html)
  12722. *
  12723. * 连接低功耗蓝牙设备。
  12724. *
  12725. * 若小程序在之前已有搜索过某个蓝牙设备,并成功建立连接,可直接传入之前搜索获取的 deviceId 直接尝试连接该设备,无需进行搜索操作。
  12726. *
  12727. * **注意**
  12728. *
  12729. *
  12730. * - 请保证尽量成对的调用 `createBLEConnection` 和 `closeBLEConnection` 接口。安卓如果多次调用 `createBLEConnection` 创建连接,有可能导致系统持有同一设备多个连接的实例,导致调用 `closeBLEConnection` 的时候并不能真正的断开与设备的连接。
  12731. * - 蓝牙连接随时可能断开,建议监听 [wx.onBLEConnectionStateChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLEConnectionStateChange.html) 回调事件,当蓝牙设备断开时按需执行重连操作
  12732. * - 若对未连接的设备或已断开连接的设备调用数据读写操作的接口,会返回 10006 错误,建议进行重连操作。
  12733. *
  12734. * **示例代码**
  12735. *
  12736. *
  12737. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  12738. * ```js
  12739. wx.createBLEConnection({
  12740. // 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
  12741. deviceId,
  12742. success (res) {
  12743. console.log(res)
  12744. }
  12745. })
  12746. ```
  12747. *
  12748. * 最低基础库: `1.1.0` */
  12749. createBLEConnection<
  12750. T extends CreateBLEConnectionOption = CreateBLEConnectionOption
  12751. >(
  12752. option: T
  12753. ): PromisifySuccessResult<T, CreateBLEConnectionOption>
  12754. /** [wx.createBLEPeripheralServer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.createBLEPeripheralServer.html)
  12755. *
  12756. * 建立本地作为外围设备的服务端,可创建多个。
  12757. *
  12758. * 最低基础库: `2.10.3` */
  12759. createBLEPeripheralServer<
  12760. T extends CreateBLEPeripheralServerOption = CreateBLEPeripheralServerOption
  12761. >(
  12762. option?: T
  12763. ): PromisifySuccessResult<T, CreateBLEPeripheralServerOption>
  12764. /** [wx.disableAlertBeforeUnload(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.disableAlertBeforeUnload.html)
  12765. *
  12766. * 关闭小程序页面返回询问对话框
  12767. *
  12768. * 最低基础库: `2.12.0` */
  12769. disableAlertBeforeUnload(option?: DisableAlertBeforeUnloadOption): void
  12770. /** [wx.enableAlertBeforeUnload(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.enableAlertBeforeUnload.html)
  12771. *
  12772. * 开启小程序页面返回询问对话框
  12773. *
  12774. * 最低基础库: `2.12.0` */
  12775. enableAlertBeforeUnload(option: EnableAlertBeforeUnloadOption): void
  12776. /** [wx.exitVoIPChat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.exitVoIPChat.html)
  12777. *
  12778. * 退出(销毁)实时语音通话
  12779. *
  12780. * 最低基础库: `2.7.0` */
  12781. exitVoIPChat<T extends ExitVoIPChatOption = ExitVoIPChatOption>(
  12782. option?: T
  12783. ): PromisifySuccessResult<T, ExitVoIPChatOption>
  12784. /** [wx.getAvailableAudioSources(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.getAvailableAudioSources.html)
  12785. *
  12786. * 获取当前支持的音频输入源
  12787. *
  12788. * 最低基础库: `2.1.0` */
  12789. getAvailableAudioSources<
  12790. T extends GetAvailableAudioSourcesOption = GetAvailableAudioSourcesOption
  12791. >(
  12792. option?: T
  12793. ): PromisifySuccessResult<T, GetAvailableAudioSourcesOption>
  12794. /** [wx.getBLEDeviceCharacteristics(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceCharacteristics.html)
  12795. *
  12796. * 获取蓝牙设备某个服务中所有特征值(characteristic)。
  12797. *
  12798. * **示例代码**
  12799. *
  12800. *
  12801. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  12802. * ```js
  12803. wx.getBLEDeviceCharacteristics({
  12804. // 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
  12805. deviceId,
  12806. // 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
  12807. serviceId,
  12808. success (res) {
  12809. console.log('device getBLEDeviceCharacteristics:', res.characteristics)
  12810. }
  12811. })
  12812. ```
  12813. *
  12814. * 最低基础库: `1.1.0` */
  12815. getBLEDeviceCharacteristics<
  12816. T extends GetBLEDeviceCharacteristicsOption = GetBLEDeviceCharacteristicsOption
  12817. >(
  12818. option: T
  12819. ): PromisifySuccessResult<T, GetBLEDeviceCharacteristicsOption>
  12820. /** [wx.getBLEDeviceRSSI(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceRSSI.html)
  12821. *
  12822. * 获取蓝牙设备的信号强度。
  12823. *
  12824. * 最低基础库: `2.11.0` */
  12825. getBLEDeviceRSSI<
  12826. T extends GetBLEDeviceRSSIOption = GetBLEDeviceRSSIOption
  12827. >(
  12828. option: T
  12829. ): PromisifySuccessResult<T, GetBLEDeviceRSSIOption>
  12830. /** [wx.getBLEDeviceServices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceServices.html)
  12831. *
  12832. * 获取蓝牙设备所有服务(service)。
  12833. *
  12834. * **示例代码**
  12835. *
  12836. *
  12837. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  12838. * ```js
  12839. wx.getBLEDeviceServices({
  12840. // 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
  12841. deviceId,
  12842. success (res) {
  12843. console.log('device services:', res.services)
  12844. }
  12845. })
  12846. ```
  12847. *
  12848. * 最低基础库: `1.1.0` */
  12849. getBLEDeviceServices<
  12850. T extends GetBLEDeviceServicesOption = GetBLEDeviceServicesOption
  12851. >(
  12852. option: T
  12853. ): PromisifySuccessResult<T, GetBLEDeviceServicesOption>
  12854. /** [wx.getBackgroundAudioPlayerState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioPlayerState.html)
  12855. *
  12856. * 获取后台音乐播放状态。
  12857. *
  12858. * **示例代码**
  12859. *
  12860. *
  12861. * ```js
  12862. wx.getBackgroundAudioPlayerState({
  12863. success (res) {
  12864. const status = res.status
  12865. const dataUrl = res.dataUrl
  12866. const currentPosition = res.currentPosition
  12867. const duration = res.duration
  12868. const downloadPercent = res.downloadPercent
  12869. }
  12870. })
  12871. ```
  12872. * @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
  12873. * */
  12874. getBackgroundAudioPlayerState<
  12875. T extends GetBackgroundAudioPlayerStateOption = GetBackgroundAudioPlayerStateOption
  12876. >(
  12877. option?: T
  12878. ): PromisifySuccessResult<T, GetBackgroundAudioPlayerStateOption>
  12879. /** [wx.getBackgroundFetchData(object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchData.html)
  12880. *
  12881. * 拉取 backgroundFetch 客户端缓存数据
  12882. *
  12883. * 最低基础库: `2.8.0` */
  12884. getBackgroundFetchData<
  12885. T extends GetBackgroundFetchDataOption = GetBackgroundFetchDataOption
  12886. >(
  12887. option: T
  12888. ): PromisifySuccessResult<T, GetBackgroundFetchDataOption>
  12889. /** [wx.getBackgroundFetchToken(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchToken.html)
  12890. *
  12891. * 获取设置过的自定义登录态。若无,则返回 fail。
  12892. *
  12893. * 最低基础库: `2.8.0` */
  12894. getBackgroundFetchToken<
  12895. T extends GetBackgroundFetchTokenOption = GetBackgroundFetchTokenOption
  12896. >(
  12897. option?: T
  12898. ): PromisifySuccessResult<T, GetBackgroundFetchTokenOption>
  12899. /** [wx.getBatteryInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfo.html)
  12900. *
  12901. * 获取设备电量。同步 API [wx.getBatteryInfoSync](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfoSync.html) 在 iOS 上不可用。 */
  12902. getBatteryInfo<T extends GetBatteryInfoOption = GetBatteryInfoOption>(
  12903. option?: T
  12904. ): PromisifySuccessResult<T, GetBatteryInfoOption>
  12905. /** [wx.getBeacons(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.getBeacons.html)
  12906. *
  12907. * 获取所有已搜索到的 iBeacon 设备
  12908. *
  12909. * 最低基础库: `1.2.0` */
  12910. getBeacons<T extends GetBeaconsOption = GetBeaconsOption>(
  12911. option?: T
  12912. ): PromisifySuccessResult<T, GetBeaconsOption>
  12913. /** [wx.getBluetoothAdapterState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getBluetoothAdapterState.html)
  12914. *
  12915. * 获取本机蓝牙适配器状态。
  12916. *
  12917. * **示例代码**
  12918. *
  12919. *
  12920. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  12921. * ```js
  12922. wx.getBluetoothAdapterState({
  12923. success (res) {
  12924. console.log(res)
  12925. }
  12926. })
  12927. ```
  12928. *
  12929. * 最低基础库: `1.1.0` */
  12930. getBluetoothAdapterState<
  12931. T extends GetBluetoothAdapterStateOption = GetBluetoothAdapterStateOption
  12932. >(
  12933. option?: T
  12934. ): PromisifySuccessResult<T, GetBluetoothAdapterStateOption>
  12935. /** [wx.getBluetoothDevices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getBluetoothDevices.html)
  12936. *
  12937. * 获取在蓝牙模块生效期间所有已发现的蓝牙设备。包括已经和本机处于连接状态的设备。
  12938. *
  12939. * **示例代码**
  12940. *
  12941. *
  12942. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  12943. *
  12944. * ```js
  12945. // ArrayBuffer转16进度字符串示例
  12946. function ab2hex(buffer) {
  12947. var hexArr = Array.prototype.map.call(
  12948. new Uint8Array(buffer),
  12949. function(bit) {
  12950. return ('00' + bit.toString(16)).slice(-2)
  12951. }
  12952. )
  12953. return hexArr.join('');
  12954. }
  12955. wx.getBluetoothDevices({
  12956. success: function (res) {
  12957. console.log(res)
  12958. if (res.devices[0]) {
  12959. console.log(ab2hex(res.devices[0].advertisData))
  12960. }
  12961. }
  12962. })
  12963. ```
  12964. *
  12965. * **注意事项**
  12966. *
  12967. *
  12968. * - 该接口获取到的设备列表为**蓝牙模块生效期间所有搜索到的蓝牙设备**,若在蓝牙模块使用流程结束后未及时调用 [wx.closeBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.closeBluetoothAdapter.html) 释放资源,会存在调用该接口会返回之前的蓝牙使用流程中搜索到的蓝牙设备,可能设备已经不在用户身边,无法连接。
  12969. * - 蓝牙设备在被搜索到时,系统返回的 name 字段一般为广播包中的 LocalName 字段中的设备名称,而如果与蓝牙设备建立连接,系统返回的 name 字段会改为从蓝牙设备上获取到的 `GattName`。若需要动态改变设备名称并展示,建议使用 `localName` 字段。
  12970. *
  12971. * 最低基础库: `1.1.0` */
  12972. getBluetoothDevices<
  12973. T extends GetBluetoothDevicesOption = GetBluetoothDevicesOption
  12974. >(
  12975. option?: T
  12976. ): PromisifySuccessResult<T, GetBluetoothDevicesOption>
  12977. /** [wx.getClipboardData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.getClipboardData.html)
  12978. *
  12979. * 获取系统剪贴板的内容
  12980. *
  12981. * **示例代码**
  12982. *
  12983. *
  12984. * ```js
  12985. wx.getClipboardData({
  12986. success (res){
  12987. console.log(res.data)
  12988. }
  12989. })
  12990. ```
  12991. *
  12992. * 最低基础库: `1.1.0` */
  12993. getClipboardData<
  12994. T extends GetClipboardDataOption = GetClipboardDataOption
  12995. >(
  12996. option?: T
  12997. ): PromisifySuccessResult<T, GetClipboardDataOption>
  12998. /** [wx.getConnectedBluetoothDevices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getConnectedBluetoothDevices.html)
  12999. *
  13000. * 根据 uuid 获取处于已连接状态的设备。
  13001. *
  13002. * **示例代码**
  13003. *
  13004. *
  13005. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  13006. * ```js
  13007. wx.getConnectedBluetoothDevices({
  13008. success (res) {
  13009. console.log(res)
  13010. }
  13011. })
  13012. ```
  13013. *
  13014. * 最低基础库: `1.1.0` */
  13015. getConnectedBluetoothDevices<
  13016. T extends GetConnectedBluetoothDevicesOption = GetConnectedBluetoothDevicesOption
  13017. >(
  13018. option: T
  13019. ): PromisifySuccessResult<T, GetConnectedBluetoothDevicesOption>
  13020. /** [wx.getConnectedWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.getConnectedWifi.html)
  13021. *
  13022. * 获取已连接中的 Wi-Fi 信息。
  13023. *
  13024. * 最低基础库: `1.6.0` */
  13025. getConnectedWifi<
  13026. T extends GetConnectedWifiOption = GetConnectedWifiOption
  13027. >(
  13028. option?: T
  13029. ): PromisifySuccessResult<T, GetConnectedWifiOption>
  13030. /** [wx.getExtConfig(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfig.html)
  13031. *
  13032. * 获取[第三方平台](https://developers.weixin.qq.com/miniprogram/dev/devtools/ext.html)自定义的数据字段。
  13033. *
  13034. * **Tips**
  13035. *
  13036. *
  13037. * 1. 本接口暂时无法通过 [wx.canIUse](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.canIUse.html) 判断是否兼容,开发者需要自行判断 [wx.getExtConfig](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfig.html) 是否存在来兼容
  13038. *
  13039. * ****
  13040. *
  13041. * ```js
  13042. if (wx.getExtConfig) {
  13043. wx.getExtConfig({
  13044. success (res) {
  13045. console.log(res.extConfig)
  13046. }
  13047. })
  13048. }
  13049. ```
  13050. *
  13051. * 最低基础库: `1.1.0` */
  13052. getExtConfig<T extends GetExtConfigOption = GetExtConfigOption>(
  13053. option?: T
  13054. ): PromisifySuccessResult<T, GetExtConfigOption>
  13055. /** [wx.getFileInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileInfo.html)
  13056. *
  13057. * 获取文件信息
  13058. *
  13059. * **示例代码**
  13060. *
  13061. *
  13062. * ```js
  13063. wx.getFileInfo({
  13064. success (res) {
  13065. console.log(res.size)
  13066. console.log(res.digest)
  13067. }
  13068. })
  13069. ```
  13070. *
  13071. * 最低基础库: `1.4.0` */
  13072. getFileInfo<T extends WxGetFileInfoOption = WxGetFileInfoOption>(
  13073. option: T
  13074. ): PromisifySuccessResult<T, WxGetFileInfoOption>
  13075. /** [wx.getGroupEnterInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/group/wx.getGroupEnterInfo.html)
  13076. *
  13077. * 获取群工具小程序启动信息
  13078. *
  13079. * **示例代码**
  13080. *
  13081. *
  13082. * ```js
  13083. wx.getGroupEnterInfo({
  13084. success(res) {
  13085. // res
  13086. {
  13087. errMsg: 'getGroupEnterInfo:ok',
  13088. encryptedData: '',
  13089. iv: ''
  13090. }
  13091. },
  13092. fail() {
  13093. }
  13094. })
  13095. ```
  13096. *
  13097. * 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法)) 。
  13098. * 获取得到的开放数据为以下 json 结构(其中 opengid 为当前群的唯一标识):
  13099. *
  13100. * ```json
  13101. {
  13102. "opengid": "OPENGID"
  13103. }
  13104. ```
  13105. *
  13106. * **Tips**
  13107. *
  13108. *
  13109. * - 如需要展示群名称,小程序可以使用[开放数据组件](https://developers.weixin.qq.com/miniprogram/dev/component/open-data.html)
  13110. * - 小游戏可以通过 `wx.getGroupInfo` 接口获取群名称
  13111. *
  13112. * 最低基础库: `2.10.4` */
  13113. getGroupEnterInfo(option: GetGroupEnterInfoOption): void
  13114. /** [wx.getHCEState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.getHCEState.html)
  13115. *
  13116. * 判断当前设备是否支持 HCE 能力。
  13117. *
  13118. * **示例代码**
  13119. *
  13120. *
  13121. * ```js
  13122. wx.getHCEState({
  13123. success (res) {
  13124. console.log(res.errCode)
  13125. }
  13126. })
  13127. ```
  13128. *
  13129. * 最低基础库: `1.7.0` */
  13130. getHCEState<T extends GetHCEStateOption = GetHCEStateOption>(
  13131. option?: T
  13132. ): PromisifySuccessResult<T, GetHCEStateOption>
  13133. /** [wx.getImageInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.getImageInfo.html)
  13134. *
  13135. * 获取图片信息。网络图片需先配置download域名才能生效。
  13136. *
  13137. * **示例代码**
  13138. *
  13139. *
  13140. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/Kd47Sbmr6yYu)
  13141. *
  13142. * ```js
  13143. wx.getImageInfo({
  13144. src: 'images/a.jpg',
  13145. success (res) {
  13146. console.log(res.width)
  13147. console.log(res.height)
  13148. }
  13149. })
  13150. wx.chooseImage({
  13151. success (res) {
  13152. wx.getImageInfo({
  13153. src: res.tempFilePaths[0],
  13154. success (res) {
  13155. console.log(res.width)
  13156. console.log(res.height)
  13157. }
  13158. })
  13159. }
  13160. })
  13161. ``` */
  13162. getImageInfo<T extends GetImageInfoOption = GetImageInfoOption>(
  13163. option: T
  13164. ): PromisifySuccessResult<T, GetImageInfoOption>
  13165. /** [wx.getLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html)
  13166. *
  13167. * 获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用。开启高精度定位,接口耗时会增加,可指定 highAccuracyExpireTime 作为超时时间。地图相关使用的坐标格式应为 gcj02。
  13168. *
  13169. * **示例代码**
  13170. *
  13171. *
  13172. * ```js
  13173. wx.getLocation({
  13174. type: 'wgs84',
  13175. success (res) {
  13176. const latitude = res.latitude
  13177. const longitude = res.longitude
  13178. const speed = res.speed
  13179. const accuracy = res.accuracy
  13180. }
  13181. })
  13182. ```
  13183. *
  13184. * **注意**
  13185. *
  13186. *
  13187. * - 工具中定位模拟使用IP定位,可能会有一定误差。且工具目前仅支持 gcj02 坐标。
  13188. * - 使用第三方服务进行逆地址解析时,请确认第三方服务默认的坐标系,正确进行坐标转换。 */
  13189. getLocation<T extends GetLocationOption = GetLocationOption>(
  13190. option: T
  13191. ): PromisifySuccessResult<T, GetLocationOption>
  13192. /** [wx.getNetworkType(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.getNetworkType.html)
  13193. *
  13194. * 获取网络类型
  13195. *
  13196. * **示例代码**
  13197. *
  13198. *
  13199. * ```js
  13200. wx.getNetworkType({
  13201. success (res) {
  13202. const networkType = res.networkType
  13203. }
  13204. })
  13205. ``` */
  13206. getNetworkType<T extends GetNetworkTypeOption = GetNetworkTypeOption>(
  13207. option?: T
  13208. ): PromisifySuccessResult<T, GetNetworkTypeOption>
  13209. /** [wx.getRandomValues(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/crypto/wx.getRandomValues.html)
  13210. *
  13211. * 获取密码学安全随机数
  13212. *
  13213. * **示例代码**
  13214. *
  13215. *
  13216. * ```js
  13217. wx.getRandomValues({
  13218. length: 6 // 生成 6 个字节长度的随机数,
  13219. success: res => {
  13220. console.log(wx.arrayBufferToBase64(res.randomValues)) // 转换为 base64 字符串后打印
  13221. }
  13222. })
  13223. ```
  13224. *
  13225. * 最低基础库: `2.15.0` */
  13226. getRandomValues<
  13227. T extends GetRandomValuesOption = GetRandomValuesOption
  13228. >(
  13229. option: T
  13230. ): PromisifySuccessResult<T, GetRandomValuesOption>
  13231. /** [wx.getSavedFileInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getSavedFileInfo.html)
  13232. *
  13233. * 获取本地文件的文件信息。此接口只能用于获取已保存到本地的文件,若需要获取临时文件信息,请使用 [wx.getFileInfo()](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getFileInfo.html) 接口。
  13234. *
  13235. * **示例代码**
  13236. *
  13237. *
  13238. * ```js
  13239. wx.getSavedFileList({
  13240. success (res) {
  13241. console.log(res.fileList)
  13242. }
  13243. })
  13244. ``` */
  13245. getSavedFileInfo<
  13246. T extends GetSavedFileInfoOption = GetSavedFileInfoOption
  13247. >(
  13248. option: T
  13249. ): PromisifySuccessResult<T, GetSavedFileInfoOption>
  13250. /** [wx.getSavedFileList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.getSavedFileList.html)
  13251. *
  13252. * 获取该小程序下已保存的本地缓存文件列表
  13253. *
  13254. * **示例代码**
  13255. *
  13256. *
  13257. * ```js
  13258. wx.getSavedFileList({
  13259. success (res) {
  13260. console.log(res.fileList)
  13261. }
  13262. })
  13263. ``` */
  13264. getSavedFileList<
  13265. T extends WxGetSavedFileListOption = WxGetSavedFileListOption
  13266. >(
  13267. option?: T
  13268. ): PromisifySuccessResult<T, WxGetSavedFileListOption>
  13269. /** [wx.getScreenBrightness(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenBrightness.html)
  13270. *
  13271. * 获取屏幕亮度
  13272. *
  13273. * **说明**
  13274. *
  13275. *
  13276. * - 若安卓系统设置中开启了自动调节亮度功能,则屏幕亮度会根据光线自动调整,该接口仅能获取自动调节亮度之前的值,而非实时的亮度值。
  13277. *
  13278. * 最低基础库: `1.2.0` */
  13279. getScreenBrightness<
  13280. T extends GetScreenBrightnessOption = GetScreenBrightnessOption
  13281. >(
  13282. option?: T
  13283. ): PromisifySuccessResult<T, GetScreenBrightnessOption>
  13284. /** [wx.getSelectedTextRange(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/keyboard/wx.getSelectedTextRange.html)
  13285. *
  13286. * 在input、textarea等focus之后,获取输入框的光标位置。注意:只有在focus的时候调用此接口才有效。
  13287. *
  13288. * **示例代码**
  13289. *
  13290. *
  13291. * ```js
  13292. wx.getSelectedTextRange({
  13293. complete: res => {
  13294. console.log('getSelectedTextRange res', res.start, res.end)
  13295. }
  13296. })
  13297. ```
  13298. *
  13299. * 最低基础库: `2.7.0` */
  13300. getSelectedTextRange<
  13301. T extends GetSelectedTextRangeOption = GetSelectedTextRangeOption
  13302. >(
  13303. option?: T
  13304. ): PromisifySuccessResult<T, GetSelectedTextRangeOption>
  13305. /** [wx.getSetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.getSetting.html)
  13306. *
  13307. * 获取用户的当前设置。**返回值中只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
  13308. *
  13309. * **示例代码**
  13310. *
  13311. *
  13312. * ```js
  13313. wx.getSetting({
  13314. success (res) {
  13315. console.log(res.authSetting)
  13316. // res.authSetting = {
  13317. // "scope.userInfo": true,
  13318. // "scope.userLocation": true
  13319. // }
  13320. }
  13321. })
  13322. ```
  13323. *
  13324. * ```js
  13325. wx.getSetting({
  13326. withSubscriptions: true,
  13327. success (res) {
  13328. console.log(res.authSetting)
  13329. // res.authSetting = {
  13330. // "scope.userInfo": true,
  13331. // "scope.userLocation": true
  13332. // }
  13333. console.log(res.subscriptionsSetting)
  13334. // res.subscriptionsSetting = {
  13335. // mainSwitch: true, // 订阅消息总开关
  13336. // itemSettings: { // 每一项开关
  13337. // SYS_MSG_TYPE_INTERACTIVE: 'accept', // 小游戏系统订阅消息
  13338. // SYS_MSG_TYPE_RANK: 'accept'
  13339. // zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: 'reject', // 普通一次性订阅消息
  13340. // ke_OZC_66gZxALLcsuI7ilCJSP2OJ2vWo2ooUPpkWrw: 'ban',
  13341. // }
  13342. // }
  13343. }
  13344. })
  13345. ```
  13346. *
  13347. * 最低基础库: `1.2.0` */
  13348. getSetting<T extends GetSettingOption = GetSettingOption>(
  13349. option?: T
  13350. ): PromisifySuccessResult<T, GetSettingOption>
  13351. /** [wx.getShareInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.getShareInfo.html)
  13352. *
  13353. * 获取转发详细信息
  13354. *
  13355. * **示例代码**
  13356. *
  13357. *
  13358. * 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法)) 。
  13359. * 获取得到的开放数据为以下 json 结构(其中 openGId 为当前群的唯一标识):
  13360. *
  13361. * ```json
  13362. {
  13363. "openGId": "OPENGID"
  13364. }
  13365. ```
  13366. *
  13367. * **Tips**
  13368. *
  13369. *
  13370. * - 如需要展示群名称,小程序可以使用[开放数据组件](https://developers.weixin.qq.com/miniprogram/dev/component/open-data.html)
  13371. * - 小游戏可以通过 `wx.getGroupInfo` 接口获取群名称
  13372. *
  13373. * 最低基础库: `1.1.0` */
  13374. getShareInfo<T extends GetShareInfoOption = GetShareInfoOption>(
  13375. option: T
  13376. ): PromisifySuccessResult<T, GetShareInfoOption>
  13377. /** [wx.getStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorage.html)
  13378. *
  13379. * 从本地缓存中异步获取指定 key 的内容。缓存相关策略请查看 [存储](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/storage.html)。
  13380. *
  13381. * **示例代码**
  13382. *
  13383. *
  13384. * ```js
  13385. wx.getStorage({
  13386. key: 'key',
  13387. success (res) {
  13388. console.log(res.data)
  13389. }
  13390. })
  13391. ```
  13392. *
  13393. * ```js
  13394. try {
  13395. var value = wx.getStorageSync('key')
  13396. if (value) {
  13397. // Do something with return value
  13398. }
  13399. } catch (e) {
  13400. // Do something when catch error
  13401. }
  13402. ``` */
  13403. getStorage<
  13404. T = any,
  13405. U extends GetStorageOption<T> = GetStorageOption<T>
  13406. >(
  13407. option: U
  13408. ): PromisifySuccessResult<U, GetStorageOption<T>>
  13409. /** [wx.getStorageInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfo.html)
  13410. *
  13411. * 异步获取当前storage的相关信息。缓存相关策略请查看 [存储](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/storage.html)。
  13412. *
  13413. * **示例代码**
  13414. *
  13415. *
  13416. * ```js
  13417. wx.getStorageInfo({
  13418. success (res) {
  13419. console.log(res.keys)
  13420. console.log(res.currentSize)
  13421. console.log(res.limitSize)
  13422. }
  13423. })
  13424. ```
  13425. *
  13426. * ```js
  13427. try {
  13428. const res = wx.getStorageInfoSync()
  13429. console.log(res.keys)
  13430. console.log(res.currentSize)
  13431. console.log(res.limitSize)
  13432. } catch (e) {
  13433. // Do something when catch error
  13434. }
  13435. ``` */
  13436. getStorageInfo<T extends GetStorageInfoOption = GetStorageInfoOption>(
  13437. option?: T
  13438. ): PromisifySuccessResult<T, GetStorageInfoOption>
  13439. /** [wx.getSystemInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfo.html)
  13440. *
  13441. * 获取系统信息
  13442. *
  13443. * **示例代码**
  13444. *
  13445. *
  13446. * ```js
  13447. wx.getSystemInfo({
  13448. success (res) {
  13449. console.log(res.model)
  13450. console.log(res.pixelRatio)
  13451. console.log(res.windowWidth)
  13452. console.log(res.windowHeight)
  13453. console.log(res.language)
  13454. console.log(res.version)
  13455. console.log(res.platform)
  13456. }
  13457. })
  13458. ```
  13459. *
  13460. * ```js
  13461. try {
  13462. const res = wx.getSystemInfoSync()
  13463. console.log(res.model)
  13464. console.log(res.pixelRatio)
  13465. console.log(res.windowWidth)
  13466. console.log(res.windowHeight)
  13467. console.log(res.language)
  13468. console.log(res.version)
  13469. console.log(res.platform)
  13470. } catch (e) {
  13471. // Do something when catch error
  13472. }
  13473. ``` */
  13474. getSystemInfo<T extends GetSystemInfoOption = GetSystemInfoOption>(
  13475. option?: T
  13476. ): PromisifySuccessResult<T, GetSystemInfoOption>
  13477. /** [wx.getSystemInfoAsync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfoAsync.html)
  13478. *
  13479. * 异步获取系统信息。需要一定的微信客户端版本支持,在不支持的客户端上,会使用同步实现来返回。
  13480. *
  13481. * **示例代码**
  13482. *
  13483. *
  13484. * ```js
  13485. wx.getSystemInfoAsync({
  13486. success (res) {
  13487. console.log(res.model)
  13488. console.log(res.pixelRatio)
  13489. console.log(res.windowWidth)
  13490. console.log(res.windowHeight)
  13491. console.log(res.language)
  13492. console.log(res.version)
  13493. console.log(res.platform)
  13494. }
  13495. })
  13496. ```
  13497. *
  13498. * 最低基础库: `2.14.1` */
  13499. getSystemInfoAsync(option?: GetSystemInfoAsyncOption): void
  13500. /** [wx.getUserInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html)
  13501. *
  13502. * 获取用户信息。
  13503. *
  13504. * **接口调整说明**
  13505. *
  13506. *
  13507. * 为优化用户登录体验,该接口将进行调整,详见 [用户信息接口调整说明](https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801)
  13508. *
  13509. * **示例代码**
  13510. *
  13511. *
  13512. *
  13513. * ```js
  13514. // 必须是在用户已经授权的情况下调用
  13515. wx.getUserInfo({
  13516. success: function(res) {
  13517. var userInfo = res.userInfo
  13518. var nickName = userInfo.nickName
  13519. var avatarUrl = userInfo.avatarUrl
  13520. var gender = userInfo.gender //性别 0:未知、1:男、2:女
  13521. var province = userInfo.province
  13522. var city = userInfo.city
  13523. var country = userInfo.country
  13524. }
  13525. })
  13526. ```
  13527. *
  13528. * 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法)) 。
  13529. * 获取得到的开放数据为以下 json 结构:
  13530. *
  13531. * ```json
  13532. {
  13533. "openId": "OPENID",
  13534. "nickName": "NICKNAME",
  13535. "gender": GENDER,
  13536. "city": "CITY",
  13537. "province": "PROVINCE",
  13538. "country": "COUNTRY",
  13539. "avatarUrl": "AVATARURL",
  13540. "unionId": "UNIONID",
  13541. "watermark": {
  13542. "appid":"APPID",
  13543. "timestamp":TIMESTAMP
  13544. }
  13545. }
  13546. ```
  13547. *
  13548. * **小程序用户信息组件示例代码**
  13549. *
  13550. *
  13551. * ```html
  13552. * <!-- 如果只是展示用户头像昵称,可以使用 <open-data /> 组件 -->
  13553. * <open-data type="userAvatarUrl"></open-data>
  13554. * <open-data type="userNickName"></open-data>
  13555. * <!-- 需要使用 button 来授权登录 -->
  13556. * <button wx:if="{{canIUse}}" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">授权登录</button>
  13557. * <view wx:else>请升级微信版本</view>
  13558. * ```
  13559. *
  13560. * ```js
  13561. Page({
  13562. data: {
  13563. canIUse: wx.canIUse('button.open-type.getUserInfo')
  13564. },
  13565. onLoad: function() {
  13566. // 查看是否授权
  13567. wx.getSetting({
  13568. success (res){
  13569. if (res.authSetting['scope.userInfo']) {
  13570. // 已经授权,可以直接调用 getUserInfo 获取头像昵称
  13571. wx.getUserInfo({
  13572. success: function(res) {
  13573. console.log(res.userInfo)
  13574. }
  13575. })
  13576. }
  13577. }
  13578. })
  13579. },
  13580. bindGetUserInfo (e) {
  13581. console.log(e.detail.userInfo)
  13582. }
  13583. })
  13584. ``` */
  13585. getUserInfo<T extends GetUserInfoOption = GetUserInfoOption>(
  13586. option: T
  13587. ): PromisifySuccessResult<T, GetUserInfoOption>
  13588. /** [wx.getUserProfile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html)
  13589. *
  13590. * 获取用户信息。每次请求都会弹出授权窗口,用户同意后返回 `userInfo`。
  13591. *
  13592. * 最低基础库: `2.10.4` */
  13593. getUserProfile<T extends GetUserProfileOption = GetUserProfileOption>(
  13594. option: T
  13595. ): PromisifySuccessResult<T, GetUserProfileOption>
  13596. /** [wx.getVideoInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.getVideoInfo.html)
  13597. *
  13598. * 获取视频详细信息。
  13599. *
  13600. * 最低基础库: `2.11.0` */
  13601. getVideoInfo<T extends GetVideoInfoOption = GetVideoInfoOption>(
  13602. option: T
  13603. ): PromisifySuccessResult<T, GetVideoInfoOption>
  13604. /** [wx.getWeRunData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.getWeRunData.html)
  13605. *
  13606. * 获取用户过去三十天微信运动步数。需要先调用 [wx.login](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html) 接口。步数信息会在用户主动进入小程序时更新。
  13607. *
  13608. * **示例代码**
  13609. *
  13610. *
  13611. * ```js
  13612. wx.getWeRunData({
  13613. success (res) {
  13614. // 拿 encryptedData 到开发者后台解密开放数据
  13615. const encryptedData = res.encryptedData
  13616. // 或拿 cloudID 通过云调用直接获取开放数据
  13617. const cloudID = res.cloudID
  13618. }
  13619. })
  13620. ```
  13621. *
  13622. * **开放数据 JSON 结构**
  13623. *
  13624. *
  13625. *
  13626. * 敏感数据有两种获取方式,一是使用 [加密数据解密算法]((open-ability/signature#加密数据解密算法)) 。
  13627. * 获取得到的开放数据为以下 json 结构:
  13628. *
  13629. * ```json
  13630. {
  13631. "stepInfoList": [
  13632. {
  13633. "timestamp": 1445866601,
  13634. "step": 100
  13635. },
  13636. {
  13637. "timestamp": 1445876601,
  13638. "step": 120
  13639. }
  13640. ]
  13641. }
  13642. ```
  13643. *
  13644. * stepInfoList 中,每一项结构如下:
  13645. *
  13646. * | 属性 | 类型 | 说明 |
  13647. * | --- | ---- | --- |
  13648. * | timestamp | number | 时间戳,表示数据对应的时间 |
  13649. * | step | number | 微信运动步数 |
  13650. *
  13651. * 最低基础库: `1.2.0` */
  13652. getWeRunData<T extends GetWeRunDataOption = GetWeRunDataOption>(
  13653. option?: T
  13654. ): PromisifySuccessResult<T, GetWeRunDataOption>
  13655. /** [wx.getWifiList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.getWifiList.html)
  13656. *
  13657. * 请求获取 Wi-Fi 列表。在 `onGetWifiList` 注册的回调中返回 `wifiList` 数据。 **Android 调用前需要 [用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.userLocation。**
  13658. *
  13659. * iOS 将跳转到系统的 Wi-Fi 界面,Android 不会跳转。 iOS 11.0 及 iOS 11.1 两个版本因系统问题,该方法失效。但在 iOS 11.2 中已修复。
  13660. *
  13661. * 最低基础库: `1.6.0` */
  13662. getWifiList<T extends GetWifiListOption = GetWifiListOption>(
  13663. option?: T
  13664. ): PromisifySuccessResult<T, GetWifiListOption>
  13665. /** [wx.hideHomeButton(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideHomeButton.html)
  13666. *
  13667. * 隐藏返回首页按钮。微信7.0.7版本起,当用户打开的小程序最底层页面是非首页时,默认展示“返回首页”按钮,开发者可在页面 onShow 中调用 hideHomeButton 进行隐藏。
  13668. *
  13669. * 最低基础库: `2.8.3` */
  13670. hideHomeButton<T extends HideHomeButtonOption = HideHomeButtonOption>(
  13671. option?: T
  13672. ): PromisifySuccessResult<T, HideHomeButtonOption>
  13673. /** [wx.hideKeyboard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/keyboard/wx.hideKeyboard.html)
  13674. *
  13675. * 在input、textarea等focus拉起键盘之后,手动调用此接口收起键盘
  13676. *
  13677. * **示例代码**
  13678. *
  13679. *
  13680. * ```js
  13681. wx.hideKeyboard({
  13682. complete: res => {
  13683. console.log('hideKeyboard res', res)
  13684. }
  13685. })
  13686. ```
  13687. *
  13688. * 最低基础库: `2.8.2` */
  13689. hideKeyboard<T extends HideKeyboardOption = HideKeyboardOption>(
  13690. option?: T
  13691. ): PromisifySuccessResult<T, HideKeyboardOption>
  13692. /** [wx.hideLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideLoading.html)
  13693. *
  13694. * 隐藏 loading 提示框
  13695. *
  13696. * 最低基础库: `1.1.0` */
  13697. hideLoading<T extends HideLoadingOption = HideLoadingOption>(
  13698. option?: T
  13699. ): PromisifySuccessResult<T, HideLoadingOption>
  13700. /** [wx.hideNavigationBarLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideNavigationBarLoading.html)
  13701. *
  13702. * 在当前页面隐藏导航条加载动画 */
  13703. hideNavigationBarLoading<
  13704. T extends HideNavigationBarLoadingOption = HideNavigationBarLoadingOption
  13705. >(
  13706. option?: T
  13707. ): PromisifySuccessResult<T, HideNavigationBarLoadingOption>
  13708. /** [wx.hideShareMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.hideShareMenu.html)
  13709. *
  13710. * 隐藏当前页面的转发按钮
  13711. *
  13712. * ****
  13713. *
  13714. * ## 注意事项
  13715. * - "shareAppMessage"表示“发送给朋友”按钮,"shareTimeline"表示“分享到朋友圈”按钮
  13716. * - 隐藏“发送给朋友”按钮时必须同时隐藏“分享到朋友圈”按钮,隐藏“分享到朋友圈”按钮时则允许不隐藏“发送给朋友”按钮
  13717. *
  13718. * **示例代码**
  13719. *
  13720. *
  13721. * ```js
  13722. wx.hideShareMenu({
  13723. menus: ['shareAppMessage', 'shareTimeline']
  13724. })
  13725. ```
  13726. *
  13727. * 最低基础库: `1.1.0` */
  13728. hideShareMenu<T extends HideShareMenuOption = HideShareMenuOption>(
  13729. option?: T
  13730. ): PromisifySuccessResult<T, HideShareMenuOption>
  13731. /** [wx.hideTabBar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBar.html)
  13732. *
  13733. * 隐藏 tabBar
  13734. *
  13735. * 最低基础库: `1.9.0` */
  13736. hideTabBar<T extends HideTabBarOption = HideTabBarOption>(
  13737. option: T
  13738. ): PromisifySuccessResult<T, HideTabBarOption>
  13739. /** [wx.hideTabBarRedDot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBarRedDot.html)
  13740. *
  13741. * 隐藏 tabBar 某一项的右上角的红点
  13742. *
  13743. * 最低基础库: `1.9.0` */
  13744. hideTabBarRedDot<
  13745. T extends HideTabBarRedDotOption = HideTabBarRedDotOption
  13746. >(
  13747. option: T
  13748. ): PromisifySuccessResult<T, HideTabBarRedDotOption>
  13749. /** [wx.hideToast(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideToast.html)
  13750. *
  13751. * 隐藏消息提示框 */
  13752. hideToast<T extends HideToastOption = HideToastOption>(
  13753. option?: T
  13754. ): PromisifySuccessResult<T, HideToastOption>
  13755. /** [wx.joinVoIPChat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.joinVoIPChat.html)
  13756. *
  13757. * 加入 (创建) 实时语音通话,更多信息可见 [实时语音指南](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/voip-chat.html)。调用前需要用户授权 `scope.record`,若房间类型为视频房间需要用户授权 `scope.camera`。
  13758. *
  13759. * 最低基础库: `2.7.0` */
  13760. joinVoIPChat<T extends JoinVoIPChatOption = JoinVoIPChatOption>(
  13761. option: T
  13762. ): PromisifySuccessResult<T, JoinVoIPChatOption>
  13763. /** [wx.loadFontFace(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/font/wx.loadFontFace.html)
  13764. *
  13765. * 动态加载网络字体,文件地址需为下载类型。[2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)起支持全局生效,需在 `app.js` 中调用。
  13766. *
  13767. * 注意:
  13768. * 1. 字体文件返回的 contet-type 参考 [font](https://www.iana.org/assignments/media-types/media-types.xhtml#font),格式不正确时会解析失败。
  13769. * 2. 字体链接必须是https(ios不支持http)
  13770. * 3. 字体链接必须是同源下的,或开启了cors支持,小程序的域名是`servicewechat.com`
  13771. * 4. canvas等原生组件不支持使用接口添加的字体
  13772. * 5. 工具里提示 Faild to load font可以忽略
  13773. * 6. [2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 以前仅在调用页面生效。
  13774. *
  13775. * **示例代码**
  13776. *
  13777. *
  13778. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/b6Zrajm67R2x)
  13779. * ```js
  13780. wx.loadFontFace({
  13781. family: 'Bitstream Vera Serif Bold',
  13782. source: 'url("https://sungd.github.io/Pacifico.ttf")',
  13783. success: console.log
  13784. })
  13785. ```
  13786. *
  13787. * 最低基础库: `2.1.0` */
  13788. loadFontFace<T extends LoadFontFaceOption = LoadFontFaceOption>(
  13789. option: T
  13790. ): PromisifySuccessResult<T, LoadFontFaceOption>
  13791. /** [wx.login(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html)
  13792. *
  13793. * 调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户的唯一标识(openid)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
  13794. *
  13795. * **示例代码**
  13796. *
  13797. *
  13798. * ```js
  13799. wx.login({
  13800. success (res) {
  13801. if (res.code) {
  13802. //发起网络请求
  13803. wx.request({
  13804. url: 'https://test.com/onLogin',
  13805. data: {
  13806. code: res.code
  13807. }
  13808. })
  13809. } else {
  13810. console.log('登录失败!' + res.errMsg)
  13811. }
  13812. }
  13813. })
  13814. ``` */
  13815. login<T extends LoginOption = LoginOption>(
  13816. option?: T
  13817. ): PromisifySuccessResult<T, LoginOption>
  13818. /** [wx.makeBluetoothPair(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.makeBluetoothPair.html)
  13819. *
  13820. * 蓝牙配对接口,仅安卓支持。通常情况下(需要指定 `pin` 码或者密码时)系统会接管配对流程,直接使用 直接 `createBLEConnection` 即可;该接口只应当在开发者不想让用户手动输入`pin` 码且真机验证确认可以正常生效情况下用。
  13821. *
  13822. * 最低基础库: `2.12.0` */
  13823. makeBluetoothPair<
  13824. T extends MakeBluetoothPairOption = MakeBluetoothPairOption
  13825. >(
  13826. option: T
  13827. ): PromisifySuccessResult<T, MakeBluetoothPairOption>
  13828. /** [wx.makePhoneCall(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/phone/wx.makePhoneCall.html)
  13829. *
  13830. * 拨打电话
  13831. *
  13832. * **示例代码**
  13833. *
  13834. *
  13835. * ```js
  13836. wx.makePhoneCall({
  13837. phoneNumber: '1340000' //仅为示例,并非真实的电话号码
  13838. })
  13839. ``` */
  13840. makePhoneCall<T extends MakePhoneCallOption = MakePhoneCallOption>(
  13841. option: T
  13842. ): PromisifySuccessResult<T, MakePhoneCallOption>
  13843. /** [wx.navigateBack(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html)
  13844. *
  13845. * 关闭当前页面,返回上一页面或多级页面。可通过 [getCurrentPages](https://developers.weixin.qq.com/miniprogram/dev/reference/api/getCurrentPages.html) 获取当前的页面栈,决定需要返回几层。 */
  13846. navigateBack<T extends NavigateBackOption = NavigateBackOption>(
  13847. option?: T
  13848. ): PromisifySuccessResult<T, NavigateBackOption>
  13849. /** [wx.navigateBackMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/miniprogram-navigate/wx.navigateBackMiniProgram.html)
  13850. *
  13851. * 返回到上一个小程序。只有在当前小程序是被其他小程序打开时可以调用成功
  13852. *
  13853. * 注意:**微信客户端 iOS 6.5.9,Android 6.5.10 及以上版本支持**
  13854. *
  13855. * **示例代码**
  13856. *
  13857. *
  13858. * ```js
  13859. wx.navigateBackMiniProgram({
  13860. extraData: {
  13861. foo: 'bar'
  13862. },
  13863. success(res) {
  13864. // 返回成功
  13865. }
  13866. })
  13867. ```
  13868. *
  13869. * 最低基础库: `1.3.0` */
  13870. navigateBackMiniProgram<
  13871. T extends NavigateBackMiniProgramOption = NavigateBackMiniProgramOption
  13872. >(
  13873. option: T
  13874. ): PromisifySuccessResult<T, NavigateBackMiniProgramOption>
  13875. /** [wx.navigateTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateTo.html)
  13876. *
  13877. * 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 [wx.navigateBack](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html) 可以返回到原页面。小程序中页面栈最多十层。
  13878. *
  13879. * **示例代码**
  13880. *
  13881. *
  13882. *
  13883. * ```js
  13884. wx.navigateTo({
  13885. url: 'test?id=1',
  13886. events: {
  13887. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  13888. acceptDataFromOpenedPage: function(data) {
  13889. console.log(data)
  13890. },
  13891. someEvent: function(data) {
  13892. console.log(data)
  13893. }
  13894. ...
  13895. },
  13896. success: function(res) {
  13897. // 通过eventChannel向被打开页面传送数据
  13898. res.eventChannel.emit('acceptDataFromOpenerPage', { data: 'test' })
  13899. }
  13900. })
  13901. ```
  13902. *
  13903. * ```javascript
  13904. //test.js
  13905. Page({
  13906. onLoad: function(option){
  13907. console.log(option.query)
  13908. const eventChannel = this.getOpenerEventChannel()
  13909. eventChannel.emit('acceptDataFromOpenedPage', {data: 'test'});
  13910. eventChannel.emit('someEvent', {data: 'test'});
  13911. // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
  13912. eventChannel.on('acceptDataFromOpenerPage', function(data) {
  13913. console.log(data)
  13914. })
  13915. }
  13916. })
  13917. ``` */
  13918. navigateTo<T extends NavigateToOption = NavigateToOption>(
  13919. option: T
  13920. ): PromisifySuccessResult<T, NavigateToOption>
  13921. /** [wx.navigateToMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/miniprogram-navigate/wx.navigateToMiniProgram.html)
  13922. *
  13923. * 打开另一个小程序
  13924. *
  13925. * **使用限制**
  13926. *
  13927. *
  13928. * ##### 需要用户触发跳转
  13929. * 从 2.3.0 版本开始,若用户未点击小程序页面任意位置,则开发者将无法调用此接口自动跳转至其他小程序。
  13930. * ##### 需要用户确认跳转
  13931. * 从 2.3.0 版本开始,在跳转至其他小程序前,将统一增加弹窗,询问是否跳转,用户确认后才可以跳转其他小程序。如果用户点击取消,则回调 `fail cancel`。
  13932. * ##### 无需声明跳转名单,不限跳转数量(众测中)
  13933. * 1. 从2020年4月24日起,使用跳转其他小程序功能将无需在全局配置中声明跳转名单,调用此接口时将不再校验所跳转的 AppID 是否在 navigateToMiniProgramAppIdList 中。
  13934. * 2. 从2020年4月24日起,跳转其他小程序将不再受数量限制,使用此功能时请注意遵守运营规范。
  13935. *
  13936. * **运营规范**
  13937. *
  13938. *
  13939. * 平台将坚决打击小程序盒子等互推行为,使用此功能时请严格遵守[《微信小程序平台运营规范》](https://developers.weixin.qq.com/miniprogram/product/#_5-10-%E4%BA%92%E6%8E%A8%E8%A1%8C%E4%B8%BA),若发现小程序违反运营规范将被下架处理。
  13940. *
  13941. * **关于调试**
  13942. *
  13943. *
  13944. * - 在开发者工具上调用此 API 并不会真实的跳转到另外的小程序,但是开发者工具会校验本次调用跳转是否成功。[详情](https://developers.weixin.qq.com/miniprogram/dev/devtools/different.html#跳转小程序调试支持)
  13945. * - 开发者工具上支持被跳转的小程序处理接收参数的调试。[详情](https://developers.weixin.qq.com/miniprogram/dev/devtools/different.html#跳转小程序调试支持)
  13946. *
  13947. * **示例代码**
  13948. *
  13949. *
  13950. * ```js
  13951. wx.navigateToMiniProgram({
  13952. appId: '',
  13953. path: 'page/index/index?id=123',
  13954. extraData: {
  13955. foo: 'bar'
  13956. },
  13957. envVersion: 'develop',
  13958. success(res) {
  13959. // 打开成功
  13960. }
  13961. })
  13962. ```
  13963. *
  13964. * 最低基础库: `1.3.0` */
  13965. navigateToMiniProgram<
  13966. T extends NavigateToMiniProgramOption = NavigateToMiniProgramOption
  13967. >(
  13968. option: T
  13969. ): PromisifySuccessResult<T, NavigateToMiniProgramOption>
  13970. /** [wx.nextTick(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/custom-component/wx.nextTick.html)
  13971. *
  13972. * 延迟一部分操作到下一个时间片再执行。(类似于 setTimeout)
  13973. *
  13974. * **说明**
  13975. *
  13976. *
  13977. *
  13978. * 因为自定义组件中的 setData 和 triggerEvent 等接口本身是同步的操作,当这几个接口被连续调用时,都是在一个同步流程中执行完的,因此若逻辑不当可能会导致出错。
  13979. *
  13980. * 一个极端的案例:当父组件的 setData 引发了子组件的 triggerEvent,进而使得父组件又进行了一次 setData,期间有通过 wx:if 语句对子组件进行卸载,就有可能引发奇怪的错误,所以对于不需要在一个同步流程内完成的逻辑,可以使用此接口延迟到下一个时间片再执行。
  13981. *
  13982. * **示例代码**
  13983. *
  13984. *
  13985. * ```js
  13986. Component({
  13987. doSth() {
  13988. this.setData({ number: 1 }) // 直接在当前同步流程中执行
  13989. wx.nextTick(() => {
  13990. this.setData({ number: 3 }) // 在当前同步流程结束后,下一个时间片执行
  13991. })
  13992. this.setData({ number: 2 }) // 直接在当前同步流程中执行
  13993. }
  13994. })
  13995. ```
  13996. *
  13997. * 最低基础库: `2.2.3` */
  13998. nextTick(callback: (...args: any[]) => any): void
  13999. /** [wx.notifyBLECharacteristicValueChange(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.notifyBLECharacteristicValueChange.html)
  14000. *
  14001. * 启用低功耗蓝牙设备特征值变化时的 notify 功能,订阅特征值。注意:必须设备的特征值支持 notify 或者 indicate 才可以成功调用。
  14002. *
  14003. * 另外,必须先启用 `notifyBLECharacteristicValueChange` 才能监听到设备 `characteristicValueChange` 事件
  14004. *
  14005. * **注意**
  14006. *
  14007. *
  14008. * - 订阅操作成功后需要设备主动更新特征值的 value,才会触发 [wx.onBLECharacteristicValueChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLECharacteristicValueChange.html) 回调。
  14009. * - 安卓平台上,在调用 `notifyBLECharacteristicValueChange` 成功后立即调用 `writeBLECharacteristicValue` 接口,在部分机型上会发生 10008 系统错误
  14010. *
  14011. * **示例代码**
  14012. *
  14013. *
  14014. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  14015. * ```js
  14016. wx.notifyBLECharacteristicValueChange({
  14017. state: true, // 启用 notify 功能
  14018. // 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
  14019. deviceId,
  14020. // 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
  14021. serviceId,
  14022. // 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
  14023. characteristicId,
  14024. success (res) {
  14025. console.log('notifyBLECharacteristicValueChange success', res.errMsg)
  14026. }
  14027. })
  14028. ```
  14029. *
  14030. * 最低基础库: `1.1.0` */
  14031. notifyBLECharacteristicValueChange<
  14032. T extends NotifyBLECharacteristicValueChangeOption = NotifyBLECharacteristicValueChangeOption
  14033. >(
  14034. option: T
  14035. ): PromisifySuccessResult<T, NotifyBLECharacteristicValueChangeOption>
  14036. /** [wx.offAccelerometerChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.offAccelerometerChange.html)
  14037. *
  14038. * 取消监听加速度数据事件,参数为空,则取消所有的事件监听。
  14039. *
  14040. * 最低基础库: `2.9.3` */
  14041. offAccelerometerChange(
  14042. /** 加速度数据事件的回调函数 */
  14043. callback: (...args: any[]) => any
  14044. ): void
  14045. /** [wx.offAppHide(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppHide.html)
  14046. *
  14047. * 取消监听小程序切后台事件
  14048. *
  14049. * 最低基础库: `2.1.2` */
  14050. offAppHide(
  14051. /** 小程序切后台事件的回调函数 */
  14052. callback?: OffAppHideCallback
  14053. ): void
  14054. /** [wx.offAppShow(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppShow.html)
  14055. *
  14056. * 取消监听小程序切前台事件
  14057. *
  14058. * 最低基础库: `2.1.2` */
  14059. offAppShow(
  14060. /** 小程序切前台事件的回调函数 */
  14061. callback?: OffAppShowCallback
  14062. ): void
  14063. /** [wx.offAudioInterruptionBegin(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAudioInterruptionBegin.html)
  14064. *
  14065. * 取消监听音频因为受到系统占用而被中断开始事件
  14066. *
  14067. * 最低基础库: `2.6.2` */
  14068. offAudioInterruptionBegin(
  14069. /** 音频因为受到系统占用而被中断开始事件的回调函数 */
  14070. callback?: OffAudioInterruptionBeginCallback
  14071. ): void
  14072. /** [wx.offAudioInterruptionEnd(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAudioInterruptionEnd.html)
  14073. *
  14074. * 取消监听音频中断结束事件
  14075. *
  14076. * 最低基础库: `2.6.2` */
  14077. offAudioInterruptionEnd(
  14078. /** 音频中断结束事件的回调函数 */
  14079. callback?: OffAudioInterruptionEndCallback
  14080. ): void
  14081. /** [wx.offBLECharacteristicValueChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.offBLECharacteristicValueChange.html)
  14082. *
  14083. * 取消监听低功耗蓝牙设备的特征值变化事件。
  14084. *
  14085. * 最低基础库: `2.9.0` */
  14086. offBLECharacteristicValueChange(
  14087. /** 低功耗蓝牙设备的特征值变化事件的回调函数 */
  14088. callback: (...args: any[]) => any
  14089. ): void
  14090. /** [wx.offBLEConnectionStateChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.offBLEConnectionStateChange.html)
  14091. *
  14092. * 取消监听低功耗蓝牙连接状态的改变事件
  14093. *
  14094. * 最低基础库: `2.9.0` */
  14095. offBLEConnectionStateChange(
  14096. /** 低功耗蓝牙连接状态的改变事件的回调函数 */
  14097. callback: (...args: any[]) => any
  14098. ): void
  14099. /** [wx.offBLEPeripheralConnectionStateChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.offBLEPeripheralConnectionStateChanged.html)
  14100. *
  14101. * 取消监听当前外围设备被连接或断开连接事件
  14102. *
  14103. * 最低基础库: `2.10.3` */
  14104. offBLEPeripheralConnectionStateChanged(
  14105. /** 当前外围设备被连接或断开连接事件的回调函数 */
  14106. callback?: OffBLEPeripheralConnectionStateChangedCallback
  14107. ): void
  14108. /** [wx.offBeaconServiceChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconServiceChange.html)
  14109. *
  14110. * 取消监听 iBeacon 服务状态变化事件
  14111. *
  14112. * 最低基础库: `2.8.1` */
  14113. offBeaconServiceChange(
  14114. /** iBeacon 服务状态变化事件的回调函数 */
  14115. callback?: OffBeaconServiceChangeCallback
  14116. ): void
  14117. /** [wx.offBeaconUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconUpdate.html)
  14118. *
  14119. * 取消监听 iBeacon 设备更新事件
  14120. *
  14121. * 最低基础库: `2.8.1` */
  14122. offBeaconUpdate(
  14123. /** iBeacon 设备更新事件的回调函数 */
  14124. callback?: OffBeaconUpdateCallback
  14125. ): void
  14126. /** [wx.offBluetoothAdapterStateChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothAdapterStateChange.html)
  14127. *
  14128. * 取消监听蓝牙适配器状态变化事件。
  14129. *
  14130. * 最低基础库: `2.9.0` */
  14131. offBluetoothAdapterStateChange(
  14132. /** 蓝牙适配器状态变化事件的回调函数 */
  14133. callback: (...args: any[]) => any
  14134. ): void
  14135. /** [wx.offBluetoothDeviceFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothDeviceFound.html)
  14136. *
  14137. * 取消监听寻找到新设备的事件。
  14138. *
  14139. * 最低基础库: `2.9.0` */
  14140. offBluetoothDeviceFound(
  14141. /** 寻找到新设备的事件的回调函数 */
  14142. callback: (...args: any[]) => any
  14143. ): void
  14144. /** [wx.offCompassChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.offCompassChange.html)
  14145. *
  14146. * 取消监听罗盘数据变化事件,参数为空,则取消所有的事件监听。
  14147. *
  14148. * 最低基础库: `2.9.3` */
  14149. offCompassChange(
  14150. /** 罗盘数据变化事件的回调函数 */
  14151. callback: (...args: any[]) => any
  14152. ): void
  14153. /** [wx.offCopyUrl(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.offCopyUrl.html)
  14154. *
  14155. * 取消监听用户点击右上角菜单的「复制链接」按钮时触发的事件
  14156. *
  14157. * 最低基础库: `2.14.3` */
  14158. offCopyUrl(
  14159. /** 用户点击右上角菜单的「复制链接」按钮时触发的事件的回调函数 */
  14160. callback?: OffCopyUrlCallback
  14161. ): void
  14162. /** [wx.offDeviceMotionChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.offDeviceMotionChange.html)
  14163. *
  14164. * 取消监听设备方向变化事件,参数为空,则取消所有的事件监听。
  14165. *
  14166. * 最低基础库: `2.9.3` */
  14167. offDeviceMotionChange(
  14168. /** 设备方向变化事件的回调函数 */
  14169. callback: (...args: any[]) => any
  14170. ): void
  14171. /** [wx.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offError.html)
  14172. *
  14173. * 取消监听小程序错误事件。
  14174. *
  14175. * 最低基础库: `2.1.2` */
  14176. offError(
  14177. /** 小程序错误事件的回调函数 */
  14178. callback: (...args: any[]) => any
  14179. ): void
  14180. /** [wx.offGetWifiList(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offGetWifiList.html)
  14181. *
  14182. * 取消监听获取到 Wi-Fi 列表数据事件。
  14183. *
  14184. * 最低基础库: `2.9.0` */
  14185. offGetWifiList(
  14186. /** 获取到 Wi-Fi 列表数据事件的回调函数 */
  14187. callback: (...args: any[]) => any
  14188. ): void
  14189. /** [wx.offGyroscopeChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.offGyroscopeChange.html)
  14190. *
  14191. * 取消监听陀螺仪数据变化事件。
  14192. *
  14193. * 最低基础库: `2.9.3` */
  14194. offGyroscopeChange(
  14195. /** 陀螺仪数据变化事件的回调函数 */
  14196. callback: (...args: any[]) => any
  14197. ): void
  14198. /** [wx.offHCEMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.offHCEMessage.html)
  14199. *
  14200. * 接收 NFC 设备消息事件,取消事件监听。
  14201. *
  14202. * 最低基础库: `2.8.1` */
  14203. offHCEMessage(
  14204. /** 接收 NFC 设备消息事件的回调函数 */
  14205. callback: (...args: any[]) => any
  14206. ): void
  14207. /** [wx.offKeyboardHeightChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/keyboard/wx.offKeyboardHeightChange.html)
  14208. *
  14209. * 取消监听键盘高度变化事件
  14210. *
  14211. * 最低基础库: `2.9.2` */
  14212. offKeyboardHeightChange(
  14213. /** 键盘高度变化事件的回调函数 */
  14214. callback: (...args: any[]) => any
  14215. ): void
  14216. /** [wx.offLocalServiceDiscoveryStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceDiscoveryStop.html)
  14217. *
  14218. * 取消监听 mDNS 服务停止搜索的事件
  14219. *
  14220. * 最低基础库: `2.4.0` */
  14221. offLocalServiceDiscoveryStop(
  14222. /** mDNS 服务停止搜索的事件的回调函数 */
  14223. callback?: OffLocalServiceDiscoveryStopCallback
  14224. ): void
  14225. /** [wx.offLocalServiceFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceFound.html)
  14226. *
  14227. * 取消监听 mDNS 服务发现的事件
  14228. *
  14229. * 最低基础库: `2.4.0` */
  14230. offLocalServiceFound(
  14231. /** mDNS 服务发现的事件的回调函数 */
  14232. callback?: OffLocalServiceFoundCallback
  14233. ): void
  14234. /** [wx.offLocalServiceLost(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceLost.html)
  14235. *
  14236. * 取消监听 mDNS 服务离开的事件
  14237. *
  14238. * 最低基础库: `2.4.0` */
  14239. offLocalServiceLost(
  14240. /** mDNS 服务离开的事件的回调函数 */
  14241. callback?: OffLocalServiceLostCallback
  14242. ): void
  14243. /** [wx.offLocalServiceResolveFail(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceResolveFail.html)
  14244. *
  14245. * 取消监听 mDNS 服务解析失败的事件
  14246. *
  14247. * 最低基础库: `2.4.0` */
  14248. offLocalServiceResolveFail(
  14249. /** mDNS 服务解析失败的事件的回调函数 */
  14250. callback?: OffLocalServiceResolveFailCallback
  14251. ): void
  14252. /** [wx.offLocationChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.offLocationChange.html)
  14253. *
  14254. * 取消监听实时地理位置变化事件
  14255. *
  14256. * 最低基础库: `2.8.1` */
  14257. offLocationChange(
  14258. /** 实时地理位置变化事件的回调函数 */
  14259. callback?: OffLocationChangeCallback
  14260. ): void
  14261. /** [wx.offMemoryWarning(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/performance/wx.offMemoryWarning.html)
  14262. *
  14263. * 取消监听内存不足告警事件。
  14264. *
  14265. * 最低基础库: `2.9.0` */
  14266. offMemoryWarning(
  14267. /** 内存不足告警事件的回调函数 */
  14268. callback: (...args: any[]) => any
  14269. ): void
  14270. /** [wx.offNetworkStatusChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkStatusChange.html)
  14271. *
  14272. * 取消监听网络状态变化事件,参数为空,则取消所有的事件监听。
  14273. *
  14274. * 最低基础库: `2.9.3` */
  14275. offNetworkStatusChange(
  14276. /** 网络状态变化事件的回调函数 */
  14277. callback: (...args: any[]) => any
  14278. ): void
  14279. /** [wx.offPageNotFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offPageNotFound.html)
  14280. *
  14281. * 取消监听小程序要打开的页面不存在事件
  14282. *
  14283. * 最低基础库: `2.1.2` */
  14284. offPageNotFound(
  14285. /** 小程序要打开的页面不存在事件的回调函数 */
  14286. callback?: OffPageNotFoundCallback
  14287. ): void
  14288. /** [wx.offThemeChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offThemeChange.html)
  14289. *
  14290. * 取消监听系统主题改变事件
  14291. *
  14292. * 最低基础库: `2.11.0` */
  14293. offThemeChange(
  14294. /** 系统主题改变事件的回调函数 */
  14295. callback?: OffThemeChangeCallback
  14296. ): void
  14297. /** [wx.offUnhandledRejection(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offUnhandledRejection.html)
  14298. *
  14299. * 取消监听未处理的 Promise 拒绝事件
  14300. *
  14301. * 最低基础库: `2.10.0` */
  14302. offUnhandledRejection(
  14303. /** 未处理的 Promise 拒绝事件的回调函数 */
  14304. callback?: OffUnhandledRejectionCallback
  14305. ): void
  14306. /** [wx.offUserCaptureScreen(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offUserCaptureScreen.html)
  14307. *
  14308. * 用户主动截屏事件。取消事件监听。
  14309. *
  14310. * 最低基础库: `2.9.3` */
  14311. offUserCaptureScreen(
  14312. /** 用户主动截屏事件的回调函数 */
  14313. callback?: (...args: any[]) => any
  14314. ): void
  14315. /** [wx.offVoIPChatInterrupted(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatInterrupted.html)
  14316. *
  14317. * 取消监听被动断开实时语音通话事件。
  14318. *
  14319. * 最低基础库: `2.9.0` */
  14320. offVoIPChatInterrupted(
  14321. /** 被动断开实时语音通话事件的回调函数 */
  14322. callback: (...args: any[]) => any
  14323. ): void
  14324. /** [wx.offVoIPChatMembersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatMembersChanged.html)
  14325. *
  14326. * 取消监听实时语音通话成员在线状态变化事件。
  14327. *
  14328. * 最低基础库: `2.9.0` */
  14329. offVoIPChatMembersChanged(
  14330. /** 实时语音通话成员在线状态变化事件的回调函数 */
  14331. callback: (...args: any[]) => any
  14332. ): void
  14333. /** [wx.offVoIPVideoMembersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPVideoMembersChanged.html)
  14334. *
  14335. * 取消监听实时语音通话成员视频状态变化事件
  14336. *
  14337. * 最低基础库: `2.11.0` */
  14338. offVoIPVideoMembersChanged(
  14339. /** 实时语音通话成员视频状态变化事件的回调函数 */
  14340. callback?: OffVoIPVideoMembersChangedCallback
  14341. ): void
  14342. /** [wx.offWifiConnected(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offWifiConnected.html)
  14343. *
  14344. * 取消监听连接上 Wi-Fi 的事件。
  14345. *
  14346. * 最低基础库: `2.9.0` */
  14347. offWifiConnected(
  14348. /** 连接上 Wi-Fi 的事件的回调函数 */
  14349. callback: (...args: any[]) => any
  14350. ): void
  14351. /** [wx.offWindowResize(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.offWindowResize.html)
  14352. *
  14353. * 取消监听窗口尺寸变化事件
  14354. *
  14355. * 最低基础库: `2.3.0` */
  14356. offWindowResize(
  14357. /** 窗口尺寸变化事件的回调函数 */
  14358. callback?: OffWindowResizeCallback
  14359. ): void
  14360. /** [wx.onAccelerometerChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.onAccelerometerChange.html)
  14361. *
  14362. * 监听加速度数据事件。频率根据 [wx.startAccelerometer()](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.startAccelerometer.html) 的 interval 参数, 接口调用后会自动开始监听。
  14363. *
  14364. * **示例代码**
  14365. *
  14366. *
  14367. * ```js
  14368. wx.onAccelerometerChange(callback)
  14369. ``` */
  14370. onAccelerometerChange(
  14371. /** 加速度数据事件的回调函数 */
  14372. callback: OnAccelerometerChangeCallback
  14373. ): void
  14374. /** [wx.onAppHide(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppHide.html)
  14375. *
  14376. * 监听小程序切后台事件。该事件与 [`App.onHide`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onhide) 的回调时机一致。
  14377. *
  14378. * 最低基础库: `2.1.2` */
  14379. onAppHide(
  14380. /** 小程序切后台事件的回调函数 */
  14381. callback: OnAppHideCallback
  14382. ): void
  14383. /** [wx.onAppShow(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppShow.html)
  14384. *
  14385. * 监听小程序切前台事件。该事件与 [`App.onShow`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onshowobject-object) 的回调参数一致。
  14386. *
  14387. * **返回有效 referrerInfo 的场景**
  14388. *
  14389. *
  14390. * | 场景值 | 场景 | appId含义 |
  14391. * | ------ | ------------------------------- | ---------- |
  14392. * | 1020 | 公众号 profile 页相关小程序列表 | 来源公众号 |
  14393. * | 1035 | 公众号自定义菜单 | 来源公众号 |
  14394. * | 1036 | App 分享消息卡片 | 来源App |
  14395. * | 1037 | 小程序打开小程序 | 来源小程序 |
  14396. * | 1038 | 从另一个小程序返回 | 来源小程序 |
  14397. * | 1043 | 公众号模板消息 | 来源公众号 |
  14398. *
  14399. * **注意**
  14400. *
  14401. *
  14402. * 部分版本在无`referrerInfo`的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。
  14403. *
  14404. * 最低基础库: `2.1.2` */
  14405. onAppShow(
  14406. /** 小程序切前台事件的回调函数 */
  14407. callback: OnAppShowCallback
  14408. ): void
  14409. /** [wx.onAudioInterruptionBegin(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAudioInterruptionBegin.html)
  14410. *
  14411. * 监听音频因为受到系统占用而被中断开始事件。以下场景会触发此事件:闹钟、电话、FaceTime 通话、微信语音聊天、微信视频聊天。此事件触发后,小程序内所有音频会暂停。
  14412. *
  14413. * 最低基础库: `2.6.2` */
  14414. onAudioInterruptionBegin(
  14415. /** 音频因为受到系统占用而被中断开始事件的回调函数 */
  14416. callback: OnAudioInterruptionBeginCallback
  14417. ): void
  14418. /** [wx.onAudioInterruptionEnd(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAudioInterruptionEnd.html)
  14419. *
  14420. * 监听音频中断结束事件。在收到 onAudioInterruptionBegin 事件之后,小程序内所有音频会暂停,收到此事件之后才可再次播放成功
  14421. *
  14422. * 最低基础库: `2.6.2` */
  14423. onAudioInterruptionEnd(
  14424. /** 音频中断结束事件的回调函数 */
  14425. callback: OnAudioInterruptionEndCallback
  14426. ): void
  14427. /** [wx.onBLECharacteristicValueChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLECharacteristicValueChange.html)
  14428. *
  14429. * 监听低功耗蓝牙设备的特征值变化事件。必须先启用 `notifyBLECharacteristicValueChange` 接口才能接收到设备推送的 notification。
  14430. *
  14431. * **示例代码**
  14432. *
  14433. *
  14434. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  14435. *
  14436. * ```js
  14437. // ArrayBuffer转16进制字符串示例
  14438. function ab2hex(buffer) {
  14439. let hexArr = Array.prototype.map.call(
  14440. new Uint8Array(buffer),
  14441. function(bit) {
  14442. return ('00' + bit.toString(16)).slice(-2)
  14443. }
  14444. )
  14445. return hexArr.join('');
  14446. }
  14447. wx.onBLECharacteristicValueChange(function(res) {
  14448. console.log(`characteristic ${res.characteristicId} has changed, now is ${res.value}`)
  14449. console.log(ab2hex(res.value))
  14450. })
  14451. ```
  14452. *
  14453. * 最低基础库: `1.1.0` */
  14454. onBLECharacteristicValueChange(
  14455. /** 低功耗蓝牙设备的特征值变化事件的回调函数 */
  14456. callback: OnBLECharacteristicValueChangeCallback
  14457. ): void
  14458. /** [wx.onBLEConnectionStateChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLEConnectionStateChange.html)
  14459. *
  14460. * 监听低功耗蓝牙连接状态的改变事件。包括开发者主动连接或断开连接,设备丢失,连接异常断开等等
  14461. *
  14462. * **示例代码**
  14463. *
  14464. *
  14465. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  14466. * ```js
  14467. wx.onBLEConnectionStateChange(function(res) {
  14468. // 该方法回调中可以用于处理连接意外断开等异常情况
  14469. console.log(`device ${res.deviceId} state has changed, connected: ${res.connected}`)
  14470. })
  14471. ```
  14472. *
  14473. * 最低基础库: `1.1.0` */
  14474. onBLEConnectionStateChange(
  14475. /** 低功耗蓝牙连接状态的改变事件的回调函数 */
  14476. callback: OnBLEConnectionStateChangeCallback
  14477. ): void
  14478. /** [wx.onBLEPeripheralConnectionStateChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.onBLEPeripheralConnectionStateChanged.html)
  14479. *
  14480. * 监听当前外围设备被连接或断开连接事件
  14481. *
  14482. * 最低基础库: `2.10.3` */
  14483. onBLEPeripheralConnectionStateChanged(
  14484. /** 当前外围设备被连接或断开连接事件的回调函数 */
  14485. callback: OnBLEPeripheralConnectionStateChangedCallback
  14486. ): void
  14487. /** [wx.onBackgroundAudioPause(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioPause.html)
  14488. *
  14489. * 监听音乐暂停事件。
  14490. * @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
  14491. * */
  14492. onBackgroundAudioPause(
  14493. /** 音乐暂停事件的回调函数 */
  14494. callback: OnBackgroundAudioPauseCallback
  14495. ): void
  14496. /** [wx.onBackgroundAudioPlay(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioPlay.html)
  14497. *
  14498. * 监听音乐播放事件。
  14499. * @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
  14500. * */
  14501. onBackgroundAudioPlay(
  14502. /** 音乐播放事件的回调函数 */
  14503. callback: OnBackgroundAudioPlayCallback
  14504. ): void
  14505. /** [wx.onBackgroundAudioStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioStop.html)
  14506. *
  14507. * 监听音乐停止事件。
  14508. * @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
  14509. * */
  14510. onBackgroundAudioStop(
  14511. /** 音乐停止事件的回调函数 */
  14512. callback: OnBackgroundAudioStopCallback
  14513. ): void
  14514. /** [wx.onBackgroundFetchData(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.onBackgroundFetchData.html)
  14515. *
  14516. * 监听收到 backgroundFetch 数据时的回调
  14517. *
  14518. * 最低基础库: `2.8.0` */
  14519. onBackgroundFetchData(
  14520. /** 的回调函数 */
  14521. callback: OnBackgroundFetchDataCallback
  14522. ): void
  14523. /** [wx.onBeaconServiceChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconServiceChange.html)
  14524. *
  14525. * 监听 iBeacon 服务状态变化事件,仅能注册一个监听
  14526. *
  14527. * 最低基础库: `1.2.0` */
  14528. onBeaconServiceChange(
  14529. /** iBeacon 服务状态变化事件的回调函数 */
  14530. callback: OnBeaconServiceChangeCallback
  14531. ): void
  14532. /** [wx.onBeaconUpdate(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconUpdate.html)
  14533. *
  14534. * 监听 iBeacon 设备更新事件,仅能注册一个监听
  14535. *
  14536. * 最低基础库: `1.2.0` */
  14537. onBeaconUpdate(
  14538. /** iBeacon 设备更新事件的回调函数 */
  14539. callback: OnBeaconUpdateCallback
  14540. ): void
  14541. /** [wx.onBluetoothAdapterStateChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothAdapterStateChange.html)
  14542. *
  14543. * 监听蓝牙适配器状态变化事件
  14544. *
  14545. * **示例代码**
  14546. *
  14547. *
  14548. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  14549. * ```js
  14550. wx.onBluetoothAdapterStateChange(function (res) {
  14551. console.log('adapterState changed, now is', res)
  14552. })
  14553. ```
  14554. *
  14555. * 最低基础库: `1.1.0` */
  14556. onBluetoothAdapterStateChange(
  14557. /** 蓝牙适配器状态变化事件的回调函数 */
  14558. callback: OnBluetoothAdapterStateChangeCallback
  14559. ): void
  14560. /** [wx.onBluetoothDeviceFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothDeviceFound.html)
  14561. *
  14562. * 监听寻找到新设备的事件
  14563. *
  14564. * **注意**
  14565. *
  14566. *
  14567. * - 若在 [wx.onBluetoothDeviceFound](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothDeviceFound.html) 回调了某个设备,则此设备会添加到 [wx.getBluetoothDevices](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getBluetoothDevices.html) 接口获取到的数组中。
  14568. *
  14569. * **示例代码**
  14570. *
  14571. *
  14572. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  14573. *
  14574. * ```js
  14575. // ArrayBuffer转16进度字符串示例
  14576. function ab2hex(buffer) {
  14577. var hexArr = Array.prototype.map.call(
  14578. new Uint8Array(buffer),
  14579. function(bit) {
  14580. return ('00' + bit.toString(16)).slice(-2)
  14581. }
  14582. )
  14583. return hexArr.join('');
  14584. }
  14585. wx.onBluetoothDeviceFound(function(res) {
  14586. var devices = res.devices;
  14587. console.log('new device list has founded')
  14588. console.dir(devices)
  14589. console.log(ab2hex(devices[0].advertisData))
  14590. })
  14591. ```
  14592. *
  14593. * **注意**
  14594. *
  14595. *
  14596. * - 安卓下部分机型需要有位置权限才能搜索到设备,需留意是否开启了位置权限
  14597. *
  14598. * 最低基础库: `1.1.0` */
  14599. onBluetoothDeviceFound(
  14600. /** 寻找到新设备的事件的回调函数 */
  14601. callback: OnBluetoothDeviceFoundCallback
  14602. ): void
  14603. /** [wx.onCompassChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.onCompassChange.html)
  14604. *
  14605. * 监听罗盘数据变化事件。频率:5 次/秒,接口调用后会自动开始监听,可使用 wx.stopCompass 停止监听。
  14606. *
  14607. * **accuracy 在 iOS/Android 的差异**
  14608. *
  14609. *
  14610. * 由于平台差异,accuracy 在 iOS/Android 的值不同。
  14611. *
  14612. * - iOS:accuracy 是一个 number 类型的值,表示相对于磁北极的偏差。0 表示设备指向磁北,90 表示指向东,180 表示指向南,依此类推。
  14613. * - Android:accuracy 是一个 string 类型的枚举值。
  14614. *
  14615. * | 值 | 说明 |
  14616. * | --------------- | -------------------------------------------------------------------------------------- |
  14617. * | high | 高精度 |
  14618. * | medium | 中等精度 |
  14619. * | low | 低精度 |
  14620. * | no-contact | 不可信,传感器失去连接 |
  14621. * | unreliable | 不可信,原因未知 |
  14622. * | unknow ${value} | 未知的精度枚举值,即该 Android 系统此时返回的表示精度的 value 不是一个标准的精度枚举值 | */
  14623. onCompassChange(
  14624. /** 罗盘数据变化事件的回调函数 */
  14625. callback: OnCompassChangeCallback
  14626. ): void
  14627. /** [wx.onCopyUrl(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.onCopyUrl.html)
  14628. *
  14629. * 监听用户点击右上角菜单的「复制链接」按钮时触发的事件。本接口为 Beta 版本,暂只在 Android 平台支持。
  14630. *
  14631. * 最低基础库: `2.14.3` */
  14632. onCopyUrl(
  14633. /** 用户点击右上角菜单的「复制链接」按钮时触发的事件的回调函数 */
  14634. callback: OnCopyUrlCallback
  14635. ): void
  14636. /** [wx.onDeviceMotionChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.onDeviceMotionChange.html)
  14637. *
  14638. * 监听设备方向变化事件。频率根据 [wx.startDeviceMotionListening()](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.startDeviceMotionListening.html) 的 interval 参数。可以使用 [wx.stopDeviceMotionListening()](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.stopDeviceMotionListening.html) 停止监听。
  14639. *
  14640. * 最低基础库: `2.3.0` */
  14641. onDeviceMotionChange(
  14642. /** 设备方向变化事件的回调函数 */
  14643. callback: OnDeviceMotionChangeCallback
  14644. ): void
  14645. /** [wx.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html)
  14646. *
  14647. * 监听小程序错误事件。如脚本错误或 API 调用报错等。该事件与 [`App.onError`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onerrorstring-error) 的回调时机与参数一致。
  14648. *
  14649. * 最低基础库: `2.1.2` */
  14650. onError(
  14651. /** 小程序错误事件的回调函数 */
  14652. callback: OnAppErrorCallback
  14653. ): void
  14654. /** [wx.onGetWifiList(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onGetWifiList.html)
  14655. *
  14656. * 监听获取到 Wi-Fi 列表数据事件
  14657. *
  14658. * 最低基础库: `1.6.0` */
  14659. onGetWifiList(
  14660. /** 获取到 Wi-Fi 列表数据事件的回调函数 */
  14661. callback: OnGetWifiListCallback
  14662. ): void
  14663. /** [wx.onGyroscopeChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.onGyroscopeChange.html)
  14664. *
  14665. * 监听陀螺仪数据变化事件。频率根据 [wx.startGyroscope()](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.startGyroscope.html) 的 interval 参数。可以使用 [wx.stopGyroscope()](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.stopGyroscope.html) 停止监听。
  14666. *
  14667. * 最低基础库: `2.3.0` */
  14668. onGyroscopeChange(
  14669. /** 陀螺仪数据变化事件的回调函数 */
  14670. callback: OnGyroscopeChangeCallback
  14671. ): void
  14672. /** [wx.onHCEMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.onHCEMessage.html)
  14673. *
  14674. * 监听接收 NFC 设备消息事件,仅能注册一个监听
  14675. *
  14676. * 最低基础库: `1.7.0` */
  14677. onHCEMessage(
  14678. /** 接收 NFC 设备消息事件的回调函数 */
  14679. callback: OnHCEMessageCallback
  14680. ): void
  14681. /** [wx.onKeyboardHeightChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/keyboard/wx.onKeyboardHeightChange.html)
  14682. *
  14683. * 监听键盘高度变化
  14684. *
  14685. * **示例代码**
  14686. *
  14687. *
  14688. * ```js
  14689. wx.onKeyboardHeightChange(res => {
  14690. console.log(res.height)
  14691. })
  14692. ```
  14693. *
  14694. * 最低基础库: `2.7.0` */
  14695. onKeyboardHeightChange(callback: OnKeyboardHeightChangeCallback): void
  14696. /** [wx.onLocalServiceDiscoveryStop(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceDiscoveryStop.html)
  14697. *
  14698. * 监听 mDNS 服务停止搜索的事件
  14699. *
  14700. * 最低基础库: `2.4.0` */
  14701. onLocalServiceDiscoveryStop(
  14702. /** mDNS 服务停止搜索的事件的回调函数 */
  14703. callback: OnLocalServiceDiscoveryStopCallback
  14704. ): void
  14705. /** [wx.onLocalServiceFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceFound.html)
  14706. *
  14707. * 监听 mDNS 服务发现的事件
  14708. *
  14709. * 最低基础库: `2.4.0` */
  14710. onLocalServiceFound(
  14711. /** mDNS 服务发现的事件的回调函数 */
  14712. callback: OnLocalServiceFoundCallback
  14713. ): void
  14714. /** [wx.onLocalServiceLost(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceLost.html)
  14715. *
  14716. * 监听 mDNS 服务离开的事件
  14717. *
  14718. * 最低基础库: `2.4.0` */
  14719. onLocalServiceLost(
  14720. /** mDNS 服务离开的事件的回调函数 */
  14721. callback: OnLocalServiceLostCallback
  14722. ): void
  14723. /** [wx.onLocalServiceResolveFail(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceResolveFail.html)
  14724. *
  14725. * 监听 mDNS 服务解析失败的事件
  14726. *
  14727. * 最低基础库: `2.4.0` */
  14728. onLocalServiceResolveFail(
  14729. /** mDNS 服务解析失败的事件的回调函数 */
  14730. callback: OnLocalServiceResolveFailCallback
  14731. ): void
  14732. /** [wx.onLocationChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.onLocationChange.html)
  14733. *
  14734. * 监听实时地理位置变化事件,需结合 [wx.startLocationUpdateBackground](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdateBackground.html)、[wx.startLocationUpdate](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdate.html)使用。
  14735. *
  14736. * **示例代码**
  14737. *
  14738. *
  14739. * ```js
  14740. const _locationChangeFn = function(res) {
  14741. console.log('location change', res)
  14742. }
  14743. wx.onLocationChange(_locationChangeFn)
  14744. wx.offLocationChange(_locationChangeFn)
  14745. ```
  14746. *
  14747. * 最低基础库: `2.8.1` */
  14748. onLocationChange(
  14749. /** 实时地理位置变化事件的回调函数 */
  14750. callback: OnLocationChangeCallback
  14751. ): void
  14752. /** [wx.onMemoryWarning(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/performance/wx.onMemoryWarning.html)
  14753. *
  14754. * 监听内存不足告警事件。
  14755. *
  14756. * 当 iOS/Android 向小程序进程发出内存警告时,触发该事件。触发该事件不意味小程序被杀,大部分情况下仅仅是告警,开发者可在收到通知后回收一些不必要资源避免进一步加剧内存紧张。
  14757. *
  14758. * **示例代码**
  14759. *
  14760. *
  14761. * ```js
  14762. * wx.onMemoryWarning(function () {
  14763. * console.log('onMemoryWarningReceive')
  14764. * })
  14765. * ``
  14766. *
  14767. * 最低基础库: `2.0.2` */
  14768. onMemoryWarning(
  14769. /** 内存不足告警事件的回调函数 */
  14770. callback: OnMemoryWarningCallback
  14771. ): void
  14772. /** [wx.onNetworkStatusChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.onNetworkStatusChange.html)
  14773. *
  14774. * 监听网络状态变化事件
  14775. *
  14776. * **示例代码**
  14777. *
  14778. *
  14779. * ```js
  14780. wx.onNetworkStatusChange(function (res) {
  14781. console.log(res.isConnected)
  14782. console.log(res.networkType)
  14783. })
  14784. ```
  14785. *
  14786. * 最低基础库: `1.1.0` */
  14787. onNetworkStatusChange(
  14788. /** 网络状态变化事件的回调函数 */
  14789. callback: OnNetworkStatusChangeCallback
  14790. ): void
  14791. /** [wx.onPageNotFound(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onPageNotFound.html)
  14792. *
  14793. * 监听小程序要打开的页面不存在事件。该事件与 [`App.onPageNotFound`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onpagenotfoundobject-object) 的回调时机一致。
  14794. *
  14795. * **注意**
  14796. *
  14797. *
  14798. * - 开发者可以在回调中进行页面重定向,但必须在回调中**同步**处理,异步处理(例如 `setTimeout` 异步执行)无效。
  14799. * - 若开发者没有调用 [wx.onPageNotFound](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onPageNotFound.html) 绑定监听,也没有声明 `App.onPageNotFound`,当跳转页面不存在时,将推入微信客户端原生的页面不存在提示页面。
  14800. * - 如果回调中又重定向到另一个不存在的页面,将推入微信客户端原生的页面不存在提示页面,并且不再第二次回调。
  14801. *
  14802. * 最低基础库: `2.1.2` */
  14803. onPageNotFound(
  14804. /** 小程序要打开的页面不存在事件的回调函数 */
  14805. callback: OnPageNotFoundCallback
  14806. ): void
  14807. /** [wx.onSocketClose(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketClose.html)
  14808. *
  14809. * 监听 WebSocket 连接关闭事件 */
  14810. onSocketClose(
  14811. /** WebSocket 连接关闭事件的回调函数 */
  14812. callback: OnSocketCloseCallback
  14813. ): void
  14814. /** [wx.onSocketError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketError.html)
  14815. *
  14816. * 监听 WebSocket 错误事件 */
  14817. onSocketError(
  14818. /** WebSocket 错误事件的回调函数 */
  14819. callback: OnSocketErrorCallback
  14820. ): void
  14821. /** [wx.onSocketMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketMessage.html)
  14822. *
  14823. * 监听 WebSocket 接受到服务器的消息事件 */
  14824. onSocketMessage(
  14825. /** WebSocket 接受到服务器的消息事件的回调函数 */
  14826. callback: OnSocketMessageCallback
  14827. ): void
  14828. /** [wx.onSocketOpen(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketOpen.html)
  14829. *
  14830. * 监听 WebSocket 连接打开事件 */
  14831. onSocketOpen(
  14832. /** WebSocket 连接打开事件的回调函数 */
  14833. callback: OnSocketOpenCallback
  14834. ): void
  14835. /** [wx.onThemeChange(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onThemeChange.html)
  14836. *
  14837. * 监听系统主题改变事件。该事件与 [`App.onThemeChange`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onThemeChange-Object-object) 的回调时机一致。
  14838. *
  14839. * **注意**
  14840. *
  14841. *
  14842. * - 只有在全局配置"darkmode": true时才会触发此事件。
  14843. *
  14844. * 最低基础库: `2.11.0` */
  14845. onThemeChange(
  14846. /** 系统主题改变事件的回调函数 */
  14847. callback: OnThemeChangeCallback
  14848. ): void
  14849. /** [wx.onUnhandledRejection(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html)
  14850. *
  14851. * 监听未处理的 Promise 拒绝事件。该事件与 `App.onUnhandledRejection` 的回调时机与参数一致。
  14852. *
  14853. * **注意**
  14854. *
  14855. *
  14856. * - 安卓平台暂时不支持该事件
  14857. * - 所有的 unhandledRejection 都可以被这一监听捕获,但只有 Error 类型的才会在小程序后台触发报警。
  14858. *
  14859. * 最低基础库: `2.10.0` */
  14860. onUnhandledRejection(
  14861. /** 未处理的 Promise 拒绝事件的回调函数 */
  14862. callback: OnUnhandledRejectionCallback
  14863. ): void
  14864. /** [wx.onUserCaptureScreen(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.onUserCaptureScreen.html)
  14865. *
  14866. * 监听用户主动截屏事件。用户使用系统截屏按键截屏时触发,只能注册一个监听
  14867. *
  14868. * **示例代码**
  14869. *
  14870. *
  14871. * ```js
  14872. wx.onUserCaptureScreen(function (res) {
  14873. console.log('用户截屏了')
  14874. })
  14875. ```
  14876. *
  14877. * 最低基础库: `1.4.0` */
  14878. onUserCaptureScreen(
  14879. /** 用户主动截屏事件的回调函数 */
  14880. callback: OnUserCaptureScreenCallback
  14881. ): void
  14882. /** [wx.onVoIPChatInterrupted(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatInterrupted.html)
  14883. *
  14884. * 监听被动断开实时语音通话事件。包括小游戏切入后端时断开
  14885. *
  14886. * 最低基础库: `2.7.0` */
  14887. onVoIPChatInterrupted(
  14888. /** 被动断开实时语音通话事件的回调函数 */
  14889. callback: OnVoIPChatInterruptedCallback
  14890. ): void
  14891. /** [wx.onVoIPChatMembersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatMembersChanged.html)
  14892. *
  14893. * 监听实时语音通话成员在线状态变化事件。有成员加入/退出通话时触发回调
  14894. *
  14895. * 最低基础库: `2.7.0` */
  14896. onVoIPChatMembersChanged(
  14897. /** 实时语音通话成员在线状态变化事件的回调函数 */
  14898. callback: OnVoIPChatMembersChangedCallback
  14899. ): void
  14900. /** [wx.onVoIPChatSpeakersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatSpeakersChanged.html)
  14901. *
  14902. * 监听实时语音通话成员通话状态变化事件。有成员开始/停止说话时触发回调
  14903. *
  14904. * 最低基础库: `2.7.0` */
  14905. onVoIPChatSpeakersChanged(
  14906. /** 实时语音通话成员通话状态变化事件的回调函数 */
  14907. callback: OnVoIPChatSpeakersChangedCallback
  14908. ): void
  14909. /** [wx.onVoIPVideoMembersChanged(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPVideoMembersChanged.html)
  14910. *
  14911. * 监听实时语音通话成员视频状态变化事件。
  14912. *
  14913. * 最低基础库: `2.11.0` */
  14914. onVoIPVideoMembersChanged(
  14915. /** 实时语音通话成员视频状态变化事件的回调函数 */
  14916. callback: OnVoIPVideoMembersChangedCallback
  14917. ): void
  14918. /** [wx.onWifiConnected(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onWifiConnected.html)
  14919. *
  14920. * 监听连接上 Wi-Fi 的事件
  14921. *
  14922. * 最低基础库: `1.6.0` */
  14923. onWifiConnected(
  14924. /** 连接上 Wi-Fi 的事件的回调函数 */
  14925. callback: OnWifiConnectedCallback
  14926. ): void
  14927. /** [wx.onWindowResize(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.onWindowResize.html)
  14928. *
  14929. * 监听窗口尺寸变化事件
  14930. *
  14931. * 最低基础库: `2.3.0` */
  14932. onWindowResize(
  14933. /** 窗口尺寸变化事件的回调函数 */
  14934. callback: OnWindowResizeCallback
  14935. ): void
  14936. /** [wx.openBluetoothAdapter(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html)
  14937. *
  14938. * 初始化蓝牙模块。iOS 上开启主机/从机模式时需分别调用一次,指定对应的 `mode`。
  14939. *
  14940. * **object.fail 回调函数返回的 state 参数(仅 iOS)**
  14941. *
  14942. *
  14943. * | 状态码 | 说明 |
  14944. * | ------ | ------ |
  14945. * | 0 | 未知 |
  14946. * | 1 | 重置中 |
  14947. * | 2 | 不支持 |
  14948. * | 3 | 未授权 |
  14949. * | 4 | 未开启 |
  14950. *
  14951. * **注意**
  14952. *
  14953. *
  14954. * - 其他蓝牙相关 API 必须在 [wx.openBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html) 调用之后使用。否则 API 会返回错误(errCode=10000)。
  14955. * - 在用户蓝牙开关未开启或者手机不支持蓝牙功能的情况下,调用 [wx.openBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html) 会返回错误(errCode=10001),表示手机蓝牙功能不可用。此时小程序蓝牙模块已经初始化完成,可通过 [wx.onBluetoothAdapterStateChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothAdapterStateChange.html) 监听手机蓝牙状态的改变,也可以调用蓝牙模块的所有API。
  14956. *
  14957. * **示例代码**
  14958. *
  14959. *
  14960. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  14961. * ```js
  14962. wx.openBluetoothAdapter({
  14963. success (res) {
  14964. console.log(res)
  14965. }
  14966. })
  14967. ```
  14968. *
  14969. * 最低基础库: `1.1.0` */
  14970. openBluetoothAdapter<
  14971. T extends OpenBluetoothAdapterOption = OpenBluetoothAdapterOption
  14972. >(
  14973. option?: T
  14974. ): PromisifySuccessResult<T, OpenBluetoothAdapterOption>
  14975. /** [wx.openCard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/card/wx.openCard.html)
  14976. *
  14977. * 查看微信卡包中的卡券。只有通过 [认证](https://developers.weixin.qq.com/miniprogram/product/renzheng.html) 的小程序或文化互动类目的小游戏才能使用。更多文档请参考 [微信卡券接口文档](https://mp.weixin.qq.com/cgi-bin/announce?action=getannouncement&key=1490190158&version=1&lang=zh_CN&platform=2)。
  14978. *
  14979. * **示例代码**
  14980. *
  14981. *
  14982. * ```js
  14983. wx.openCard({
  14984. cardList: [{
  14985. cardId: '',
  14986. code: ''
  14987. }, {
  14988. cardId: '',
  14989. code: ''
  14990. }],
  14991. success (res) { }
  14992. })
  14993. ```
  14994. *
  14995. * 最低基础库: `1.1.0` */
  14996. openCard<T extends OpenCardOption = OpenCardOption>(
  14997. option: T
  14998. ): PromisifySuccessResult<T, OpenCardOption>
  14999. /** [wx.openDocument(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.openDocument.html)
  15000. *
  15001. * 新开页面打开文档。微信客户端 `7.0.12` 版本前默认显示右上角菜单按钮,之后的版本默认不显示,需主动传入 `showMenu`。 */
  15002. openDocument<T extends OpenDocumentOption = OpenDocumentOption>(
  15003. option: T
  15004. ): PromisifySuccessResult<T, OpenDocumentOption>
  15005. /** [wx.openLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.openLocation.html)
  15006. *
  15007. * 使用微信内置地图查看位置
  15008. *
  15009. * **示例代码**
  15010. *
  15011. *
  15012. * ```js
  15013. wx.getLocation({
  15014. type: 'gcj02', //返回可以用于wx.openLocation的经纬度
  15015. success (res) {
  15016. const latitude = res.latitude
  15017. const longitude = res.longitude
  15018. wx.openLocation({
  15019. latitude,
  15020. longitude,
  15021. scale: 18
  15022. })
  15023. }
  15024. })
  15025. ``` */
  15026. openLocation<T extends OpenLocationOption = OpenLocationOption>(
  15027. option: T
  15028. ): PromisifySuccessResult<T, OpenLocationOption>
  15029. /** [wx.openSetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.openSetting.html)
  15030. *
  15031. * 调起客户端小程序设置界面,返回用户设置的操作结果。**设置界面只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
  15032. *
  15033. * ****
  15034. *
  15035. * - 注意:[2.3.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为后,才可以跳转打开设置页,管理授权信息。[详情](https://developers.weixin.qq.com/community/develop/doc/000cea2305cc5047af5733de751008)
  15036. *
  15037. * **示例代码**
  15038. *
  15039. *
  15040. * ```js
  15041. wx.openSetting({
  15042. success (res) {
  15043. console.log(res.authSetting)
  15044. // res.authSetting = {
  15045. // "scope.userInfo": true,
  15046. // "scope.userLocation": true
  15047. // }
  15048. }
  15049. })
  15050. ```
  15051. *
  15052. * 最低基础库: `1.1.0` */
  15053. openSetting<T extends OpenSettingOption = OpenSettingOption>(
  15054. option?: T
  15055. ): PromisifySuccessResult<T, OpenSettingOption>
  15056. /** [wx.openVideoEditor(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.openVideoEditor.html)
  15057. *
  15058. * 打开视频编辑器
  15059. *
  15060. * 最低基础库: `2.12.0` */
  15061. openVideoEditor(option: OpenVideoEditorOption): void
  15062. /** [wx.pageScrollTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/wx.pageScrollTo.html)
  15063. *
  15064. * 将页面滚动到目标位置,支持选择器和滚动距离两种方式定位
  15065. *
  15066. * **selector 语法**
  15067. *
  15068. *
  15069. * selector类似于 CSS 的选择器,但仅支持下列语法。
  15070. *
  15071. * + ID选择器:#the-id
  15072. * + class选择器(可以连续指定多个):.a-class.another-class
  15073. * + 子元素选择器:.the-parent > .the-child
  15074. * + 后代选择器:.the-ancestor .the-descendant
  15075. * + 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
  15076. * + 多选择器的并集:#a-node, .some-other-nodes
  15077. *
  15078. * **示例代码**
  15079. *
  15080. *
  15081. * ```js
  15082. wx.pageScrollTo({
  15083. scrollTop: 0,
  15084. duration: 300
  15085. })
  15086. ```
  15087. *
  15088. * 最低基础库: `1.4.0` */
  15089. pageScrollTo<T extends PageScrollToOption = PageScrollToOption>(
  15090. option: T
  15091. ): PromisifySuccessResult<T, PageScrollToOption>
  15092. /** [wx.pauseBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.pauseBackgroundAudio.html)
  15093. *
  15094. * 暂停播放音乐。
  15095. *
  15096. * **示例代码**
  15097. *
  15098. *
  15099. * ```js
  15100. wx.pauseBackgroundAudio()
  15101. ```
  15102. * @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
  15103. * */
  15104. pauseBackgroundAudio<
  15105. T extends PauseBackgroundAudioOption = PauseBackgroundAudioOption
  15106. >(
  15107. option?: T
  15108. ): PromisifySuccessResult<T, PauseBackgroundAudioOption>
  15109. /** [wx.pauseVoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.pauseVoice.html)
  15110. *
  15111. * 暂停正在播放的语音。再次调用 [wx.playVoice](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.playVoice.html) 播放同一个文件时,会从暂停处开始播放。如果想从头开始播放,需要先调用 [wx.stopVoice](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.stopVoice.html)。
  15112. *
  15113. * **示例代码**
  15114. *
  15115. *
  15116. * ```js
  15117. wx.startRecord({
  15118. success (res) {
  15119. const tempFilePath = res.tempFilePath
  15120. wx.playVoice({
  15121. filePath: tempFilePath
  15122. })
  15123. setTimeout(() => { wx.pauseVoice() }, 5000)
  15124. }
  15125. })
  15126. ```
  15127. * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 替换
  15128. * */
  15129. pauseVoice<T extends PauseVoiceOption = PauseVoiceOption>(
  15130. option?: T
  15131. ): PromisifySuccessResult<T, PauseVoiceOption>
  15132. /** [wx.playBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.playBackgroundAudio.html)
  15133. *
  15134. * 使用后台播放器播放音乐。对于微信客户端来说,只能同时有一个后台音乐在播放。当用户离开小程序后,音乐将暂停播放;当用户在其他小程序占用了音乐播放器,原有小程序内的音乐将停止播放。
  15135. *
  15136. * **示例代码**
  15137. *
  15138. *
  15139. * ```js
  15140. wx.playBackgroundAudio({
  15141. dataUrl: '',
  15142. title: '',
  15143. coverImgUrl: ''
  15144. })
  15145. ```
  15146. * @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
  15147. * */
  15148. playBackgroundAudio<
  15149. T extends PlayBackgroundAudioOption = PlayBackgroundAudioOption
  15150. >(
  15151. option: T
  15152. ): PromisifySuccessResult<T, PlayBackgroundAudioOption>
  15153. /** [wx.playVoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.playVoice.html)
  15154. *
  15155. * 开始播放语音。同时只允许一个语音文件正在播放,如果前一个语音文件还没播放完,将中断前一个语音播放。
  15156. *
  15157. * **示例代码**
  15158. *
  15159. *
  15160. * ```js
  15161. wx.startRecord({
  15162. success (res) {
  15163. const tempFilePath = res.tempFilePath
  15164. wx.playVoice({
  15165. filePath: tempFilePath,
  15166. complete () { }
  15167. })
  15168. }
  15169. })
  15170. ```
  15171. * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 替换
  15172. * */
  15173. playVoice<T extends PlayVoiceOption = PlayVoiceOption>(
  15174. option: T
  15175. ): PromisifySuccessResult<T, PlayVoiceOption>
  15176. /** [wx.previewImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewImage.html)
  15177. *
  15178. * 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
  15179. *
  15180. * **示例代码**
  15181. *
  15182. *
  15183. * ```js
  15184. wx.previewImage({
  15185. current: '', // 当前显示图片的http链接
  15186. urls: [] // 需要预览的图片http链接列表
  15187. })
  15188. ``` */
  15189. previewImage<T extends PreviewImageOption = PreviewImageOption>(
  15190. option: T
  15191. ): PromisifySuccessResult<T, PreviewImageOption>
  15192. /** [wx.previewMedia(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewMedia.html)
  15193. *
  15194. * 预览图片和视频。
  15195. *
  15196. * 最低基础库: `2.12.0` */
  15197. previewMedia<T extends PreviewMediaOption = PreviewMediaOption>(
  15198. option: T
  15199. ): PromisifySuccessResult<T, PreviewMediaOption>
  15200. /** [wx.reLaunch(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.reLaunch.html)
  15201. *
  15202. * 关闭所有页面,打开到应用内的某个页面
  15203. *
  15204. * **示例代码**
  15205. *
  15206. *
  15207. * ```js
  15208. wx.reLaunch({
  15209. url: 'test?id=1'
  15210. })
  15211. ```
  15212. *
  15213. * ```html
  15214. * // test
  15215. * Page({
  15216. * onLoad (option) {
  15217. * console.log(option.query)
  15218. * }
  15219. * })
  15220. * ```
  15221. *
  15222. * 最低基础库: `1.1.0` */
  15223. reLaunch<T extends ReLaunchOption = ReLaunchOption>(
  15224. option: T
  15225. ): PromisifySuccessResult<T, ReLaunchOption>
  15226. /** [wx.readBLECharacteristicValue(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.readBLECharacteristicValue.html)
  15227. *
  15228. * 读取低功耗蓝牙设备的特征值的二进制数据值。注意:必须设备的特征值支持 read 才可以成功调用。
  15229. *
  15230. * **注意**
  15231. *
  15232. *
  15233. * - 并行调用多次会存在读失败的可能性。
  15234. * - 接口读取到的信息需要在 `onBLECharacteristicValueChange` 方法注册的回调中获取。
  15235. *
  15236. * **示例代码**
  15237. *
  15238. *
  15239. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  15240. * ```js
  15241. // 必须在这里的回调才能获取
  15242. wx.onBLECharacteristicValueChange(function(characteristic) {
  15243. console.log('characteristic value comed:', characteristic)
  15244. })
  15245. wx.readBLECharacteristicValue({
  15246. // 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
  15247. deviceId,
  15248. // 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
  15249. serviceId,
  15250. // 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
  15251. characteristicId,
  15252. success (res) {
  15253. console.log('readBLECharacteristicValue:', res.errCode)
  15254. }
  15255. })
  15256. ```
  15257. *
  15258. * 最低基础库: `1.1.0` */
  15259. readBLECharacteristicValue<
  15260. T extends ReadBLECharacteristicValueOption = ReadBLECharacteristicValueOption
  15261. >(
  15262. option: T
  15263. ): PromisifySuccessResult<T, ReadBLECharacteristicValueOption>
  15264. /** [wx.redirectTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.redirectTo.html)
  15265. *
  15266. * 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。
  15267. *
  15268. * **示例代码**
  15269. *
  15270. *
  15271. * ```js
  15272. wx.redirectTo({
  15273. url: 'test?id=1'
  15274. })
  15275. ``` */
  15276. redirectTo<T extends RedirectToOption = RedirectToOption>(
  15277. option: T
  15278. ): PromisifySuccessResult<T, RedirectToOption>
  15279. /** [wx.removeSavedFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.removeSavedFile.html)
  15280. *
  15281. * 删除本地缓存文件
  15282. *
  15283. * **示例代码**
  15284. *
  15285. *
  15286. * ```js
  15287. wx.getSavedFileList({
  15288. success (res) {
  15289. if (res.fileList.length > 0){
  15290. wx.removeSavedFile({
  15291. filePath: res.fileList[0].filePath,
  15292. complete (res) {
  15293. console.log(res)
  15294. }
  15295. })
  15296. }
  15297. }
  15298. })
  15299. ``` */
  15300. removeSavedFile<
  15301. T extends WxRemoveSavedFileOption = WxRemoveSavedFileOption
  15302. >(
  15303. option: T
  15304. ): PromisifySuccessResult<T, WxRemoveSavedFileOption>
  15305. /** [wx.removeStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorage.html)
  15306. *
  15307. * 从本地缓存中移除指定 key。缓存相关策略请查看 [存储](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/storage.html)。
  15308. *
  15309. * **示例代码**
  15310. *
  15311. *
  15312. * ```js
  15313. wx.removeStorage({
  15314. key: 'key',
  15315. success (res) {
  15316. console.log(res)
  15317. }
  15318. })
  15319. ```
  15320. *
  15321. * ```js
  15322. try {
  15323. wx.removeStorageSync('key')
  15324. } catch (e) {
  15325. // Do something when catch error
  15326. }
  15327. ``` */
  15328. removeStorage<T extends RemoveStorageOption = RemoveStorageOption>(
  15329. option: T
  15330. ): PromisifySuccessResult<T, RemoveStorageOption>
  15331. /** [wx.removeStorageSync(string key)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorageSync.html)
  15332. *
  15333. * [wx.removeStorage](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorage.html) 的同步版本
  15334. *
  15335. * **示例代码**
  15336. *
  15337. *
  15338. * ```js
  15339. wx.removeStorage({
  15340. key: 'key',
  15341. success (res) {
  15342. console.log(res)
  15343. }
  15344. })
  15345. ```
  15346. *
  15347. * ```js
  15348. try {
  15349. wx.removeStorageSync('key')
  15350. } catch (e) {
  15351. // Do something when catch error
  15352. }
  15353. ``` */
  15354. removeStorageSync(
  15355. /** 本地缓存中指定的 key */
  15356. key: string
  15357. ): void
  15358. /** [wx.removeTabBarBadge(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.removeTabBarBadge.html)
  15359. *
  15360. * 移除 tabBar 某一项右上角的文本
  15361. *
  15362. * 最低基础库: `1.9.0` */
  15363. removeTabBarBadge<
  15364. T extends RemoveTabBarBadgeOption = RemoveTabBarBadgeOption
  15365. >(
  15366. option: T
  15367. ): PromisifySuccessResult<T, RemoveTabBarBadgeOption>
  15368. /** [wx.reportAnalytics(string eventName, Object data)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/data-analysis/wx.reportAnalytics.html)
  15369. *
  15370. * 自定义分析数据上报接口。使用前,需要在小程序管理后台自定义分析中新建事件,配置好事件名与字段。
  15371. *
  15372. * **示例代码**
  15373. *
  15374. *
  15375. * ```js
  15376. wx.reportAnalytics('purchase', {
  15377. price: 120,
  15378. color: 'red'
  15379. })
  15380. ``` */
  15381. reportAnalytics(
  15382. /** 事件名 */
  15383. eventName: string,
  15384. /** 上报的自定义数据,key 为配置中的字段名,value 为上报的数据。 */
  15385. data: IAnyObject
  15386. ): void
  15387. /** [wx.reportEvent(string eventId)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/report/wx.reportEvent.html)
  15388. *
  15389. * 事件上报
  15390. *
  15391. * 最低基础库: `2.14.4` */
  15392. reportEvent(
  15393. /** 在 mp 实验系统中设置的事件英文名 */
  15394. eventId: string
  15395. ): void
  15396. /** [wx.reportMonitor(string name, number value)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/report/wx.reportMonitor.html)
  15397. *
  15398. * 自定义业务数据监控上报接口。
  15399. *
  15400. * **使用说明**
  15401. *
  15402. *
  15403. * 使用前,需要在「小程序管理后台-运维中心-性能监控-业务数据监控」中新建监控事件,配置监控描述与告警类型。每一个监控事件对应唯一的监控ID,开发者最多可以创建128个监控事件。
  15404. *
  15405. * **示例代码**
  15406. *
  15407. *
  15408. * ```js
  15409. wx.reportMonitor('1', 1)
  15410. ```
  15411. *
  15412. * 最低基础库: `2.0.1` */
  15413. reportMonitor(
  15414. /** 监控ID,在「小程序管理后台」新建数据指标后获得 */
  15415. name: string,
  15416. /** 上报数值,经处理后会在「小程序管理后台」上展示每分钟的上报总量 */
  15417. value: number
  15418. ): void
  15419. /** [wx.reportPerformance(Number id, Number value, String|Array dimensions)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/performance/wx.reportPerformance.html)
  15420. *
  15421. * 小程序测速上报。使用前,需要在小程序管理后台配置。 详情参见[小程序测速](https://developers.weixin.qq.com/miniprogram/dev/framework/performanceReport/index.html)指南。
  15422. *
  15423. * **示例代码**
  15424. *
  15425. *
  15426. * ```js
  15427. wx.reportPerformance(1101, 680)
  15428. wx.reportPerformance(1101, 680, 'custom')
  15429. ```
  15430. *
  15431. * 最低基础库: `2.9.2` */
  15432. reportPerformance(
  15433. /** 指标 id */
  15434. id: number,
  15435. /** 需要上报的数值 */
  15436. value: number,
  15437. /** 自定义维度 (选填) */
  15438. dimensions?: string | any[]
  15439. ): void
  15440. /** [wx.requestPayment(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/payment/wx.requestPayment.html)
  15441. *
  15442. * 发起微信支付。调用前需在[小程序微信公众平台](https://mp.weixin.qq.com/) -功能-微信支付入口申请接入微信支付。了解更多信息,可以参考 [微信支付开发文档](https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/api.shtml):
  15443. * - [开发指引](https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transactions/chapter2_3.shtml)
  15444. * - [下单接口](https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transactions/chapter3_2.shtml)
  15445. * - [支付接口](https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transactions/chapter3_12.shtml)
  15446. * - 旧版本 (v2)
  15447. * - [开发指引](https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_3&index=1)
  15448. * - [支付接口](https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7&index=3)
  15449. *
  15450. * 如果使用[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html),则 `wx.requestPayment` 所需参数可以通过云开发微信支付统一下单接口免鉴权获取、并可免证书、免签名的安全调用微信支付服务端接口、及接收异步支付结果回调,详见[云开发微信支付](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/wechatpay.html)。
  15451. *
  15452. * **示例代码**
  15453. *
  15454. *
  15455. * ```js
  15456. wx.requestPayment({
  15457. timeStamp: '',
  15458. nonceStr: '',
  15459. package: '',
  15460. signType: 'MD5',
  15461. paySign: '',
  15462. success (res) { },
  15463. fail (res) { }
  15464. })
  15465. ```
  15466. *
  15467. * 注:如果服务端有使用云开发,可以通过云开发微信支付[统一下单](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/open/pay/CloudPay.unifiedOrder.html)接口免鉴权获取以上所需所有参数,示例:
  15468. *
  15469. *
  15470. * ```js
  15471. // 云函数代码
  15472. const cloud = require('wx-server-sdk')
  15473. cloud.init({
  15474. env: cloud.DYNAMIC_CURRENT_ENV
  15475. })
  15476. exports.main = async (event, context) => {
  15477. const res = await cloud.cloudPay.unifiedOrder({
  15478. "body" : "小秋TIT店-超市",
  15479. "outTradeNo" : "1217752501201407033233368018",
  15480. "spbillCreateIp" : "127.0.0.1",
  15481. "subMchId" : "1900009231",
  15482. "totalFee" : 1,
  15483. "envId": "test-f0b102",
  15484. "functionName": "pay_cb"
  15485. })
  15486. return res
  15487. }
  15488. // 小程序代码
  15489. wx.cloud.callFunction({
  15490. name: '函数名',
  15491. data: {
  15492. // ...
  15493. },
  15494. success: res => {
  15495. const payment = res.result.payment
  15496. wx.requestPayment({
  15497. ...payment,
  15498. success (res) {
  15499. console.log('pay success', res)
  15500. },
  15501. fail (err) {
  15502. console.error('pay fail', err)
  15503. }
  15504. })
  15505. },
  15506. fail: console.error,
  15507. })
  15508. ``` */
  15509. requestPayment<T extends RequestPaymentOption = RequestPaymentOption>(
  15510. option: T
  15511. ): PromisifySuccessResult<T, RequestPaymentOption>
  15512. /** [wx.requestSubscribeMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html)
  15513. *
  15514. * 调起客户端小程序订阅消息界面,返回用户订阅消息的操作结果。当用户勾选了订阅面板中的“总是保持以上选择,不再询问”时,模板消息会被添加到用户的小程序设置页,通过 [wx.getSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.getSetting.html) 接口可获取用户对相关模板消息的订阅状态。
  15515. *
  15516. * ## 注意事项
  15517. * - 一次性模板 id 和永久模板 id 不可同时使用。
  15518. * - 低版本基础库2.4.4~2.8.3 已支持订阅消息接口调用,仅支持传入一个一次性 tmplId / 永久 tmplId。
  15519. * - [2.8.2](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为或者发起支付回调后,才可以调起订阅消息界面。
  15520. * - [2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,开发版和体验版小程序将禁止使用模板消息 formId。
  15521. * - 一次授权调用里,每个tmplId对应的模板标题不能存在相同的,若出现相同的,只保留一个。
  15522. *
  15523. * **错误码**
  15524. *
  15525. *
  15526. *
  15527. * | errCode | errMsg | 说明 |
  15528. * | ------- | ------------------------------------------------------ | -------------------------------------------------------------- |
  15529. * | 10001 | TmplIds can't be empty | 参数传空了 |
  15530. * | 10002 | Request list fail | 网络问题,请求消息列表失败 |
  15531. * | 10003 | Request subscribe fail | 网络问题,订阅请求发送失败 |
  15532. * | 10004 | Invalid template id | 参数类型错误 |
  15533. * | 10005 | Cannot show subscribe message UI | 无法展示 UI,一般是小程序这个时候退后台了导致的 |
  15534. * | 20001 | No template data return, verify the template id exist | 没有模板数据,一般是模板 ID 不存在 或者和模板类型不对应 导致的 |
  15535. * | 20002 | Templates type must be same | 模板消息类型 既有一次性的又有永久的 |
  15536. * | 20003 | Templates count out of max bounds | 模板消息数量超过上限 |
  15537. * | 20004 | The main switch is switched off | 用户关闭了主开关,无法进行订阅 |
  15538. * | 20005 | This mini program was banned from subscribing messages | 小程序被禁封 |
  15539. *
  15540. * **示例代码**
  15541. *
  15542. *
  15543. * ```js
  15544. wx.requestSubscribeMessage({
  15545. tmplIds: [''],
  15546. success (res) { }
  15547. })
  15548. ```
  15549. *
  15550. * 最低基础库: `2.4.4` */
  15551. requestSubscribeMessage<
  15552. T extends RequestSubscribeMessageOption = RequestSubscribeMessageOption
  15553. >(
  15554. option: T
  15555. ): PromisifySuccessResult<T, RequestSubscribeMessageOption>
  15556. /** [wx.saveFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.saveFile.html)
  15557. *
  15558. * 保存文件到本地。注意:**saveFile 会把临时文件移动,因此调用成功后传入的 tempFilePath 将不可用**
  15559. *
  15560. * **示例代码**
  15561. *
  15562. *
  15563. * ```js
  15564. wx.chooseImage({
  15565. success: function(res) {
  15566. const tempFilePaths = res.tempFilePaths
  15567. wx.saveFile({
  15568. tempFilePath: tempFilePaths[0],
  15569. success (res) {
  15570. const savedFilePath = res.savedFilePath
  15571. }
  15572. })
  15573. }
  15574. })
  15575. ```
  15576. *
  15577. * **注意**
  15578. *
  15579. *
  15580. * 本地文件存储的大小限制为 10M */
  15581. saveFile<T extends WxSaveFileOption = WxSaveFileOption>(
  15582. option: T
  15583. ): PromisifySuccessResult<T, WxSaveFileOption>
  15584. /** [wx.saveFileToDisk(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.saveFileToDisk.html)
  15585. *
  15586. * 保存文件系统的文件到用户磁盘,仅在 PC 端支持
  15587. *
  15588. * 最低基础库: `2.11.0` */
  15589. saveFileToDisk(option: SaveFileToDiskOption): void
  15590. /** [wx.saveImageToPhotosAlbum(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html)
  15591. *
  15592. * 保存图片到系统相册。
  15593. *
  15594. * **示例代码**
  15595. *
  15596. *
  15597. * ```js
  15598. wx.saveImageToPhotosAlbum({
  15599. success(res) { }
  15600. })
  15601. ```
  15602. *
  15603. * 最低基础库: `1.2.0` */
  15604. saveImageToPhotosAlbum<
  15605. T extends SaveImageToPhotosAlbumOption = SaveImageToPhotosAlbumOption
  15606. >(
  15607. option: T
  15608. ): PromisifySuccessResult<T, SaveImageToPhotosAlbumOption>
  15609. /** [wx.saveVideoToPhotosAlbum(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.saveVideoToPhotosAlbum.html)
  15610. *
  15611. * 保存视频到系统相册。支持mp4视频格式。
  15612. *
  15613. * **示例代码**
  15614. *
  15615. *
  15616. * ```js
  15617. wx.saveVideoToPhotosAlbum({
  15618. filePath: 'wxfile://xxx',
  15619. success (res) {
  15620. console.log(res.errMsg)
  15621. }
  15622. })
  15623. ```
  15624. *
  15625. * 最低基础库: `1.2.0` */
  15626. saveVideoToPhotosAlbum<
  15627. T extends SaveVideoToPhotosAlbumOption = SaveVideoToPhotosAlbumOption
  15628. >(
  15629. option: T
  15630. ): PromisifySuccessResult<T, SaveVideoToPhotosAlbumOption>
  15631. /** [wx.scanCode(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/scan/wx.scanCode.html)
  15632. *
  15633. * 调起客户端扫码界面进行扫码
  15634. *
  15635. * **示例代码**
  15636. *
  15637. *
  15638. * ```js
  15639. // 允许从相机和相册扫码
  15640. wx.scanCode({
  15641. success (res) {
  15642. console.log(res)
  15643. }
  15644. })
  15645. // 只允许从相机扫码
  15646. wx.scanCode({
  15647. onlyFromCamera: true,
  15648. success (res) {
  15649. console.log(res)
  15650. }
  15651. })
  15652. ``` */
  15653. scanCode<T extends ScanCodeOption = ScanCodeOption>(
  15654. option: T
  15655. ): PromisifySuccessResult<T, ScanCodeOption>
  15656. /** [wx.seekBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.seekBackgroundAudio.html)
  15657. *
  15658. * 控制音乐播放进度。
  15659. *
  15660. * **示例代码**
  15661. *
  15662. *
  15663. * ```js
  15664. wx.seekBackgroundAudio({
  15665. position: 30
  15666. })
  15667. ```
  15668. * @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
  15669. * */
  15670. seekBackgroundAudio<
  15671. T extends SeekBackgroundAudioOption = SeekBackgroundAudioOption
  15672. >(
  15673. option: T
  15674. ): PromisifySuccessResult<T, SeekBackgroundAudioOption>
  15675. /** [wx.sendHCEMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.sendHCEMessage.html)
  15676. *
  15677. * 发送 NFC 消息。仅在安卓系统下有效。
  15678. *
  15679. * **示例代码**
  15680. *
  15681. *
  15682. * ```js
  15683. const buffer = new ArrayBuffer(1)
  15684. const dataView = new DataView(buffer)
  15685. dataView.setUint8(0, 0)
  15686. wx.startHCE({
  15687. success (res) {
  15688. wx.onHCEMessage(function(res) {
  15689. if (res.messageType === 1) {
  15690. wx.sendHCEMessage({data: buffer})
  15691. }
  15692. })
  15693. }
  15694. })
  15695. ```
  15696. *
  15697. * 最低基础库: `1.7.0` */
  15698. sendHCEMessage<T extends SendHCEMessageOption = SendHCEMessageOption>(
  15699. option: T
  15700. ): PromisifySuccessResult<T, SendHCEMessageOption>
  15701. /** [wx.sendSocketMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.sendSocketMessage.html)
  15702. *
  15703. * 通过 WebSocket 连接发送数据。需要先 wx.connectSocket,并在 wx.onSocketOpen 回调之后才能发送。
  15704. *
  15705. * **示例代码**
  15706. *
  15707. *
  15708. * ```js
  15709. let socketOpen = false
  15710. let socketMsgQueue = []
  15711. wx.connectSocket({
  15712. url: 'test.php'
  15713. })
  15714. wx.onSocketOpen(function(res) {
  15715. socketOpen = true
  15716. for (let i = 0; i < socketMsgQueue.length; i++){
  15717. sendSocketMessage(socketMsgQueue[i])
  15718. }
  15719. socketMsgQueue = []
  15720. })
  15721. function sendSocketMessage(msg) {
  15722. if (socketOpen) {
  15723. wx.sendSocketMessage({
  15724. data:msg
  15725. })
  15726. } else {
  15727. socketMsgQueue.push(msg)
  15728. }
  15729. }
  15730. ``` */
  15731. sendSocketMessage<
  15732. T extends SendSocketMessageOption = SendSocketMessageOption
  15733. >(
  15734. option: T
  15735. ): PromisifySuccessResult<T, SendSocketMessageOption>
  15736. /** [wx.setBLEMTU(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.setBLEMTU.html)
  15737. *
  15738. * 设置蓝牙最大传输单元。需在 wx.createBLEConnection调用成功后调用,mtu 设置范围 (22,512)。安卓5.1以上有效。
  15739. *
  15740. * 最低基础库: `2.11.0` */
  15741. setBLEMTU<T extends SetBLEMTUOption = SetBLEMTUOption>(
  15742. option: T
  15743. ): PromisifySuccessResult<T, SetBLEMTUOption>
  15744. /** [wx.setBackgroundColor(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/background/wx.setBackgroundColor.html)
  15745. *
  15746. * 动态设置窗口的背景色
  15747. *
  15748. * **示例代码**
  15749. *
  15750. *
  15751. * ```js
  15752. wx.setBackgroundColor({
  15753. backgroundColor: '#ffffff', // 窗口的背景色为白色
  15754. })
  15755. wx.setBackgroundColor({
  15756. backgroundColorTop: '#ffffff', // 顶部窗口的背景色为白色
  15757. backgroundColorBottom: '#ffffff', // 底部窗口的背景色为白色
  15758. })
  15759. ```
  15760. *
  15761. * 最低基础库: `2.1.0` */
  15762. setBackgroundColor<
  15763. T extends SetBackgroundColorOption = SetBackgroundColorOption
  15764. >(
  15765. option: T
  15766. ): PromisifySuccessResult<T, SetBackgroundColorOption>
  15767. /** [wx.setBackgroundFetchToken(object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.setBackgroundFetchToken.html)
  15768. *
  15769. * 设置自定义登录态,在周期性拉取数据时带上,便于第三方服务器验证请求合法性
  15770. *
  15771. * 最低基础库: `2.8.0` */
  15772. setBackgroundFetchToken<
  15773. T extends SetBackgroundFetchTokenOption = SetBackgroundFetchTokenOption
  15774. >(
  15775. option: T
  15776. ): PromisifySuccessResult<T, SetBackgroundFetchTokenOption>
  15777. /** [wx.setBackgroundTextStyle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/background/wx.setBackgroundTextStyle.html)
  15778. *
  15779. * 动态设置下拉背景字体、loading 图的样式
  15780. *
  15781. * **示例代码**
  15782. *
  15783. *
  15784. * ```js
  15785. wx.setBackgroundTextStyle({
  15786. textStyle: 'dark' // 下拉背景字体、loading 图的样式为dark
  15787. })
  15788. ```
  15789. *
  15790. * 最低基础库: `2.1.0` */
  15791. setBackgroundTextStyle<
  15792. T extends SetBackgroundTextStyleOption = SetBackgroundTextStyleOption
  15793. >(
  15794. option: T
  15795. ): PromisifySuccessResult<T, SetBackgroundTextStyleOption>
  15796. /** [wx.setClipboardData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.setClipboardData.html)
  15797. *
  15798. * 设置系统剪贴板的内容。调用成功后,会弹出 toast 提示"内容已复制",持续 1.5s
  15799. *
  15800. * **示例代码**
  15801. *
  15802. *
  15803. * ```js
  15804. wx.setClipboardData({
  15805. data: 'data',
  15806. success (res) {
  15807. wx.getClipboardData({
  15808. success (res) {
  15809. console.log(res.data) // data
  15810. }
  15811. })
  15812. }
  15813. })
  15814. ```
  15815. *
  15816. * 最低基础库: `1.1.0` */
  15817. setClipboardData<
  15818. T extends SetClipboardDataOption = SetClipboardDataOption
  15819. >(
  15820. option: T
  15821. ): PromisifySuccessResult<T, SetClipboardDataOption>
  15822. /** [wx.setEnableDebug(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html)
  15823. *
  15824. * 设置是否打开调试开关。此开关对正式版也能生效。
  15825. *
  15826. * **示例代码**
  15827. *
  15828. *
  15829. * ```javascript
  15830. // 打开调试
  15831. wx.setEnableDebug({
  15832. enableDebug: true
  15833. })
  15834. // 关闭调试
  15835. wx.setEnableDebug({
  15836. enableDebug: false
  15837. })
  15838. ```
  15839. *
  15840. * **Tips**
  15841. *
  15842. *
  15843. * - 在正式版打开调试还有一种方法,就是先在开发版或体验版打开调试,再切到正式版就能看到vConsole。
  15844. *
  15845. * 最低基础库: `1.4.0` */
  15846. setEnableDebug<T extends SetEnableDebugOption = SetEnableDebugOption>(
  15847. option: T
  15848. ): PromisifySuccessResult<T, SetEnableDebugOption>
  15849. /** [wx.setInnerAudioOption(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.setInnerAudioOption.html)
  15850. *
  15851. * 设置 [InnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.html) 的播放选项。设置之后对当前小程序全局生效。
  15852. *
  15853. * **注意**
  15854. *
  15855. *
  15856. * 为保证微信整体体验,speakerOn 为 true 时,客户端会忽略 mixWithOthers 参数的内容,强制与其它音频互斥
  15857. * 不支持在播放音频的过程中切换为扬声器播放,开发者如需切换可以先暂停当前播放的音频并记录下当前暂停的时间点,然后切换后重新从原来暂停的时间点开始播放音频
  15858. *
  15859. * 最低基础库: `2.3.0` */
  15860. setInnerAudioOption<
  15861. T extends SetInnerAudioOption = SetInnerAudioOption
  15862. >(
  15863. option: T
  15864. ): PromisifySuccessResult<T, SetInnerAudioOption>
  15865. /** [wx.setKeepScreenOn(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.setKeepScreenOn.html)
  15866. *
  15867. * 设置是否保持常亮状态。仅在当前小程序生效,离开小程序后设置失效。
  15868. *
  15869. * **示例代码**
  15870. *
  15871. *
  15872. * ```js
  15873. wx.setKeepScreenOn({
  15874. keepScreenOn: true
  15875. })
  15876. ```
  15877. *
  15878. * 最低基础库: `1.4.0` */
  15879. setKeepScreenOn<
  15880. T extends SetKeepScreenOnOption = SetKeepScreenOnOption
  15881. >(
  15882. option: T
  15883. ): PromisifySuccessResult<T, SetKeepScreenOnOption>
  15884. /** [wx.setNavigationBarColor(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.setNavigationBarColor.html)
  15885. *
  15886. * 设置页面导航条颜色
  15887. *
  15888. * 最低基础库: `1.4.0` */
  15889. setNavigationBarColor<
  15890. T extends SetNavigationBarColorOption = SetNavigationBarColorOption
  15891. >(
  15892. option: T
  15893. ): PromisifySuccessResult<T, SetNavigationBarColorOption>
  15894. /** [wx.setNavigationBarTitle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.setNavigationBarTitle.html)
  15895. *
  15896. * 动态设置当前页面的标题
  15897. *
  15898. * **示例代码**
  15899. *
  15900. *
  15901. * ```js
  15902. wx.setNavigationBarTitle({
  15903. title: '当前页面'
  15904. })
  15905. ``` */
  15906. setNavigationBarTitle<
  15907. T extends SetNavigationBarTitleOption = SetNavigationBarTitleOption
  15908. >(
  15909. option: T
  15910. ): PromisifySuccessResult<T, SetNavigationBarTitleOption>
  15911. /** [wx.setScreenBrightness(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.setScreenBrightness.html)
  15912. *
  15913. * 设置屏幕亮度
  15914. *
  15915. * 最低基础库: `1.2.0` */
  15916. setScreenBrightness<
  15917. T extends SetScreenBrightnessOption = SetScreenBrightnessOption
  15918. >(
  15919. option: T
  15920. ): PromisifySuccessResult<T, SetScreenBrightnessOption>
  15921. /** [wx.setStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorage.html)
  15922. *
  15923. * 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
  15924. *
  15925. * **示例代码**
  15926. *
  15927. *
  15928. * ```js
  15929. wx.setStorage({
  15930. key:"key",
  15931. data:"value"
  15932. })
  15933. ```
  15934. * ```js
  15935. try {
  15936. wx.setStorageSync('key', 'value')
  15937. } catch (e) { }
  15938. ``` */
  15939. setStorage<
  15940. T = any,
  15941. U extends SetStorageOption<T> = SetStorageOption<T>
  15942. >(
  15943. option: U
  15944. ): PromisifySuccessResult<U, SetStorageOption<T>>
  15945. /** [wx.setStorageSync(string key, any data)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorageSync.html)
  15946. *
  15947. * [wx.setStorage](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorage.html) 的同步版本
  15948. *
  15949. * **示例代码**
  15950. *
  15951. *
  15952. * ```js
  15953. wx.setStorage({
  15954. key:"key",
  15955. data:"value"
  15956. })
  15957. ```
  15958. * ```js
  15959. try {
  15960. wx.setStorageSync('key', 'value')
  15961. } catch (e) { }
  15962. ``` */
  15963. setStorageSync<T = any>(
  15964. /** 本地缓存中指定的 key */
  15965. key: string,
  15966. /** 需要存储的内容。只支持原生类型、Date、及能够通过`JSON.stringify`序列化的对象。 */
  15967. data: T
  15968. ): void
  15969. /** [wx.setTabBarBadge(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.setTabBarBadge.html)
  15970. *
  15971. * 为 tabBar 某一项的右上角添加文本
  15972. *
  15973. * **示例代码**
  15974. *
  15975. *
  15976. * ```js
  15977. wx.setTabBarBadge({
  15978. index: 0,
  15979. text: '1'
  15980. })
  15981. ```
  15982. *
  15983. * 最低基础库: `1.9.0` */
  15984. setTabBarBadge<T extends SetTabBarBadgeOption = SetTabBarBadgeOption>(
  15985. option: T
  15986. ): PromisifySuccessResult<T, SetTabBarBadgeOption>
  15987. /** [wx.setTabBarItem(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.setTabBarItem.html)
  15988. *
  15989. * 动态设置 tabBar 某一项的内容,`2.7.0` 起图片支持临时文件和网络文件。
  15990. *
  15991. * **示例代码**
  15992. *
  15993. *
  15994. * ```js
  15995. wx.setTabBarItem({
  15996. index: 0,
  15997. text: 'text',
  15998. iconPath: '/path/to/iconPath',
  15999. selectedIconPath: '/path/to/selectedIconPath'
  16000. })
  16001. ```
  16002. *
  16003. * 最低基础库: `1.9.0` */
  16004. setTabBarItem<T extends SetTabBarItemOption = SetTabBarItemOption>(
  16005. option: T
  16006. ): PromisifySuccessResult<T, SetTabBarItemOption>
  16007. /** [wx.setTabBarStyle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.setTabBarStyle.html)
  16008. *
  16009. * 动态设置 tabBar 的整体样式
  16010. *
  16011. * **示例代码**
  16012. *
  16013. *
  16014. * ```js
  16015. wx.setTabBarStyle({
  16016. color: '#FF0000',
  16017. selectedColor: '#00FF00',
  16018. backgroundColor: '#0000FF',
  16019. borderStyle: 'white'
  16020. })
  16021. ```
  16022. *
  16023. * 最低基础库: `1.9.0` */
  16024. setTabBarStyle<T extends SetTabBarStyleOption = SetTabBarStyleOption>(
  16025. option?: T
  16026. ): PromisifySuccessResult<T, SetTabBarStyleOption>
  16027. /** [wx.setTopBarText(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/sticky/wx.setTopBarText.html)
  16028. *
  16029. * 动态设置置顶栏文字内容。只有当前小程序被置顶时能生效,如果当前小程序没有被置顶,也能调用成功,但是不会立即生效,只有在用户将这个小程序置顶后才换上设置的文字内容.
  16030. *
  16031. * **示例代码**
  16032. *
  16033. *
  16034. * ```js
  16035. wx.setTopBarText({
  16036. text: 'hello, world!'
  16037. })
  16038. ```
  16039. *
  16040. * **注意**
  16041. *
  16042. *
  16043. * - 调用成功后,需间隔 5s 才能再次调用此接口,如果在 5s 内再次调用此接口,会回调 fail,errMsg:"setTopBarText: fail invoke too frequently"
  16044. *
  16045. * 最低基础库: `1.4.3`
  16046. * @deprecated 基础库版本 [1.9.9](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃
  16047. * */
  16048. setTopBarText<T extends SetTopBarTextOption = SetTopBarTextOption>(
  16049. option: T
  16050. ): PromisifySuccessResult<T, SetTopBarTextOption>
  16051. /** [wx.setWifiList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.setWifiList.html)
  16052. *
  16053. * 设置 `wifiList` 中 AP 的相关信息。在 `onGetWifiList` 回调后调用,**iOS特有接口**。
  16054. *
  16055. * **注意**
  16056. *
  16057. *
  16058. * - 该接口只能在 `onGetWifiList` 回调之后才能调用。
  16059. * - 此时客户端会挂起,等待小程序设置 Wi-Fi 信息,请务必尽快调用该接口,若无数据请传入一个空数组。
  16060. * - 有可能随着周边 Wi-Fi 列表的刷新,单个流程内收到多次带有存在重复的 Wi-Fi 列表的回调。
  16061. *
  16062. * **示例代码**
  16063. *
  16064. *
  16065. * ```js
  16066. wx.onGetWifiList(function(res) {
  16067. if (res.wifiList.length) {
  16068. wx.setWifiList({
  16069. wifiList: [{
  16070. SSID: res.wifiList[0].SSID,
  16071. BSSID: res.wifiList[0].BSSID,
  16072. password: '123456'
  16073. }]
  16074. })
  16075. } else {
  16076. wx.setWifiList({
  16077. wifiList: []
  16078. })
  16079. }
  16080. })
  16081. wx.getWifiList()
  16082. ```
  16083. *
  16084. * 最低基础库: `1.6.0` */
  16085. setWifiList<T extends SetWifiListOption = SetWifiListOption>(
  16086. option: T
  16087. ): PromisifySuccessResult<T, SetWifiListOption>
  16088. /** [wx.setWindowSize(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.setWindowSize.html)
  16089. *
  16090. * 设置窗口大小,该接口仅适用于 PC 平台,使用细则请参见指南
  16091. *
  16092. * 最低基础库: `2.10.1`
  16093. * @deprecated 基础库版本 [2.11.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃
  16094. * */
  16095. setWindowSize(option: SetWindowSizeOption): void
  16096. /** [wx.showActionSheet(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showActionSheet.html)
  16097. *
  16098. * 显示操作菜单
  16099. *
  16100. * **示例代码**
  16101. *
  16102. *
  16103. * ```js
  16104. wx.showActionSheet({
  16105. itemList: ['A', 'B', 'C'],
  16106. success (res) {
  16107. console.log(res.tapIndex)
  16108. },
  16109. fail (res) {
  16110. console.log(res.errMsg)
  16111. }
  16112. })
  16113. ```
  16114. *
  16115. * **注意**
  16116. *
  16117. *
  16118. * - Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel";
  16119. * - Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑 */
  16120. showActionSheet<
  16121. T extends ShowActionSheetOption = ShowActionSheetOption
  16122. >(
  16123. option: T
  16124. ): PromisifySuccessResult<T, ShowActionSheetOption>
  16125. /** [wx.showLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showLoading.html)
  16126. *
  16127. * 显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
  16128. *
  16129. * **示例代码**
  16130. *
  16131. *
  16132. * ```js
  16133. wx.showLoading({
  16134. title: '加载中',
  16135. })
  16136. setTimeout(function () {
  16137. wx.hideLoading()
  16138. }, 2000)
  16139. ```
  16140. *
  16141. * **注意**
  16142. *
  16143. *
  16144. * - [wx.showLoading](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showLoading.html) 和 [wx.showToast](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html) 同时只能显示一个
  16145. * - [wx.showLoading](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showLoading.html) 应与 [wx.hideLoading](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideLoading.html) 配对使用
  16146. *
  16147. * 最低基础库: `1.1.0` */
  16148. showLoading<T extends ShowLoadingOption = ShowLoadingOption>(
  16149. option: T
  16150. ): PromisifySuccessResult<T, ShowLoadingOption>
  16151. /** [wx.showModal(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showModal.html)
  16152. *
  16153. * 显示模态对话框
  16154. *
  16155. * **示例代码**
  16156. *
  16157. *
  16158. * ```js
  16159. wx.showModal({
  16160. title: '提示',
  16161. content: '这是一个模态弹窗',
  16162. success (res) {
  16163. if (res.confirm) {
  16164. console.log('用户点击确定')
  16165. } else if (res.cancel) {
  16166. console.log('用户点击取消')
  16167. }
  16168. }
  16169. })
  16170. ```
  16171. *
  16172. * **注意**
  16173. *
  16174. *
  16175. * - Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel";
  16176. * - Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑 */
  16177. showModal<T extends ShowModalOption = ShowModalOption>(
  16178. option: T
  16179. ): PromisifySuccessResult<T, ShowModalOption>
  16180. /** [wx.showNavigationBarLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.showNavigationBarLoading.html)
  16181. *
  16182. * 在当前页面显示导航条加载动画 */
  16183. showNavigationBarLoading<
  16184. T extends ShowNavigationBarLoadingOption = ShowNavigationBarLoadingOption
  16185. >(
  16186. option?: T
  16187. ): PromisifySuccessResult<T, ShowNavigationBarLoadingOption>
  16188. /** [wx.showRedPackage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/redpackage/wx.showRedPackage.html)
  16189. *
  16190. * 拉取h5领取红包封面页。获取参考红包封面地址参考 [微信红包封面开发平台](https://cover.weixin.qq.com/cgi-bin/mmcover-bin/readtemplate?t=page%2Fdoc%2Fguide%2Fintroduce.html)。
  16191. *
  16192. * 最低基础库: `2.10.0` */
  16193. showRedPackage<T extends ShowRedPackageOption = ShowRedPackageOption>(
  16194. option: T
  16195. ): PromisifySuccessResult<T, ShowRedPackageOption>
  16196. /** [wx.showShareImageMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.showShareImageMenu.html)
  16197. *
  16198. * 打开分享图片弹窗
  16199. *
  16200. * 最低基础库: `2.14.3` */
  16201. showShareImageMenu<
  16202. T extends ShowShareImageMenuOption = ShowShareImageMenuOption
  16203. >(
  16204. option: T
  16205. ): PromisifySuccessResult<T, ShowShareImageMenuOption>
  16206. /** [wx.showShareMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.showShareMenu.html)
  16207. *
  16208. * 显示当前页面的转发按钮
  16209. *
  16210. * ****
  16211. *
  16212. * ## 注意事项
  16213. * - "shareAppMessage"表示“发送给朋友”按钮,"shareTimeline"表示“分享到朋友圈”按钮
  16214. * - 显示“分享到朋友圈”按钮时必须同时显示“发送给朋友”按钮,显示“发送给朋友”按钮时则允许不显示“分享到朋友圈”按钮
  16215. *
  16216. * **示例代码**
  16217. *
  16218. *
  16219. * ```js
  16220. wx.showShareMenu({
  16221. withShareTicket: true,
  16222. menus: ['shareAppMessage', 'shareTimeline']
  16223. })
  16224. ```
  16225. *
  16226. * 最低基础库: `1.1.0` */
  16227. showShareMenu<T extends ShowShareMenuOption = ShowShareMenuOption>(
  16228. option: T
  16229. ): PromisifySuccessResult<T, ShowShareMenuOption>
  16230. /** [wx.showTabBar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBar.html)
  16231. *
  16232. * 显示 tabBar
  16233. *
  16234. * 最低基础库: `1.9.0` */
  16235. showTabBar<T extends ShowTabBarOption = ShowTabBarOption>(
  16236. option: T
  16237. ): PromisifySuccessResult<T, ShowTabBarOption>
  16238. /** [wx.showTabBarRedDot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBarRedDot.html)
  16239. *
  16240. * 显示 tabBar 某一项的右上角的红点
  16241. *
  16242. * 最低基础库: `1.9.0` */
  16243. showTabBarRedDot<
  16244. T extends ShowTabBarRedDotOption = ShowTabBarRedDotOption
  16245. >(
  16246. option: T
  16247. ): PromisifySuccessResult<T, ShowTabBarRedDotOption>
  16248. /** [wx.showToast(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html)
  16249. *
  16250. * 显示消息提示框
  16251. *
  16252. * **示例代码**
  16253. *
  16254. *
  16255. * ```js
  16256. wx.showToast({
  16257. title: '成功',
  16258. icon: 'success',
  16259. duration: 2000
  16260. })
  16261. ```
  16262. *
  16263. * **注意**
  16264. *
  16265. *
  16266. * - [wx.showLoading](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showLoading.html) 和 [wx.showToast](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html) 同时只能显示一个
  16267. * - [wx.showToast](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html) 应与 [wx.hideToast](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideToast.html) 配对使用 */
  16268. showToast<T extends ShowToastOption = ShowToastOption>(
  16269. option: T
  16270. ): PromisifySuccessResult<T, ShowToastOption>
  16271. /** [wx.startAccelerometer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.startAccelerometer.html)
  16272. *
  16273. * 开始监听加速度数据。
  16274. *
  16275. * **示例代码**
  16276. *
  16277. *
  16278. * ```js
  16279. wx.startAccelerometer({
  16280. interval: 'game'
  16281. })
  16282. ```
  16283. *
  16284. * **注意**
  16285. *
  16286. *
  16287. * - 根据机型性能、当前 CPU 与内存的占用情况,`interval` 的设置与实际 `wx.onAccelerometerChange()` 回调函数的执行频率会有一些出入。
  16288. *
  16289. * 最低基础库: `1.1.0` */
  16290. startAccelerometer<
  16291. T extends StartAccelerometerOption = StartAccelerometerOption
  16292. >(
  16293. option?: T
  16294. ): PromisifySuccessResult<T, StartAccelerometerOption>
  16295. /** [wx.startBeaconDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.startBeaconDiscovery.html)
  16296. *
  16297. * 开始搜索附近的 iBeacon 设备
  16298. *
  16299. * **示例代码**
  16300. *
  16301. *
  16302. * ```js
  16303. wx.startBeaconDiscovery({
  16304. success(res) { }
  16305. })
  16306. ```
  16307. *
  16308. * 最低基础库: `1.2.0` */
  16309. startBeaconDiscovery<
  16310. T extends StartBeaconDiscoveryOption = StartBeaconDiscoveryOption
  16311. >(
  16312. option: T
  16313. ): PromisifySuccessResult<T, StartBeaconDiscoveryOption>
  16314. /** [wx.startBluetoothDevicesDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.startBluetoothDevicesDiscovery.html)
  16315. *
  16316. * 开始搜寻附近的蓝牙外围设备。**此操作比较耗费系统资源,请在搜索并连接到设备后调用 [wx.stopBluetoothDevicesDiscovery](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.stopBluetoothDevicesDiscovery.html) 方法停止搜索。**
  16317. *
  16318. * **示例代码**
  16319. *
  16320. *
  16321. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/m7klFDmZ72i1)
  16322. *
  16323. * ```js
  16324. // 以微信硬件平台的蓝牙智能灯为例,主服务的 UUID 是 FEE7。传入这个参数,只搜索主服务 UUID 为 FEE7 的设备
  16325. wx.startBluetoothDevicesDiscovery({
  16326. services: ['FEE7'],
  16327. success (res) {
  16328. console.log(res)
  16329. }
  16330. })
  16331. ```
  16332. *
  16333. * 最低基础库: `1.1.0` */
  16334. startBluetoothDevicesDiscovery<
  16335. T extends StartBluetoothDevicesDiscoveryOption = StartBluetoothDevicesDiscoveryOption
  16336. >(
  16337. option: T
  16338. ): PromisifySuccessResult<T, StartBluetoothDevicesDiscoveryOption>
  16339. /** [wx.startCompass(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.startCompass.html)
  16340. *
  16341. * 开始监听罗盘数据
  16342. *
  16343. * **示例代码**
  16344. *
  16345. *
  16346. * ```js
  16347. wx.startCompass()
  16348. ```
  16349. *
  16350. * 最低基础库: `1.1.0` */
  16351. startCompass<T extends StartCompassOption = StartCompassOption>(
  16352. option?: T
  16353. ): PromisifySuccessResult<T, StartCompassOption>
  16354. /** [wx.startDeviceMotionListening(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.startDeviceMotionListening.html)
  16355. *
  16356. * 开始监听设备方向的变化。
  16357. *
  16358. * 最低基础库: `2.3.0` */
  16359. startDeviceMotionListening<
  16360. T extends StartDeviceMotionListeningOption = StartDeviceMotionListeningOption
  16361. >(
  16362. option?: T
  16363. ): PromisifySuccessResult<T, StartDeviceMotionListeningOption>
  16364. /** [wx.startGyroscope(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.startGyroscope.html)
  16365. *
  16366. * 开始监听陀螺仪数据。
  16367. *
  16368. * 最低基础库: `2.3.0` */
  16369. startGyroscope<T extends StartGyroscopeOption = StartGyroscopeOption>(
  16370. option?: T
  16371. ): PromisifySuccessResult<T, StartGyroscopeOption>
  16372. /** [wx.startHCE(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.startHCE.html)
  16373. *
  16374. * 初始化 NFC 模块。
  16375. *
  16376. * **示例代码**
  16377. *
  16378. *
  16379. * ```js
  16380. wx.startHCE({
  16381. aid_list: ['F222222222'],
  16382. success (res) {
  16383. console.log(res.errMsg)
  16384. }
  16385. })
  16386. ```
  16387. *
  16388. * 最低基础库: `1.7.0` */
  16389. startHCE<T extends StartHCEOption = StartHCEOption>(
  16390. option: T
  16391. ): PromisifySuccessResult<T, StartHCEOption>
  16392. /** [wx.startLocalServiceDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.startLocalServiceDiscovery.html)
  16393. *
  16394. * 开始搜索局域网下的 mDNS 服务。搜索的结果会通过 wx.onLocalService* 事件返回。
  16395. *
  16396. * **注意**
  16397. *
  16398. *
  16399. * 1. wx.startLocalServiceDiscovery 是一个消耗性能的行为,开始 30 秒后会自动 stop 并执行 wx.onLocalServiceDiscoveryStop 注册的回调函数。
  16400. * 2. 在调用 wx.startLocalServiceDiscovery 后,在这次搜索行为停止后才能发起下次 wx.startLocalServiceDiscovery。停止本次搜索行为的操作包括调用 wx.stopLocalServiceDiscovery 和 30 秒后系统自动 stop 本次搜索。
  16401. *
  16402. * 最低基础库: `2.4.0` */
  16403. startLocalServiceDiscovery<
  16404. T extends StartLocalServiceDiscoveryOption = StartLocalServiceDiscoveryOption
  16405. >(
  16406. option: T
  16407. ): PromisifySuccessResult<T, StartLocalServiceDiscoveryOption>
  16408. /** [wx.startLocationUpdate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdate.html)
  16409. *
  16410. * 开启小程序进入前台时接收位置消息
  16411. *
  16412. * **注意**
  16413. *
  16414. *
  16415. * - 获取位置信息需配置[地理位置用途说明](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#permission)。
  16416. *
  16417. * 最低基础库: `2.8.0` */
  16418. startLocationUpdate<
  16419. T extends StartLocationUpdateOption = StartLocationUpdateOption
  16420. >(
  16421. option?: T
  16422. ): PromisifySuccessResult<T, StartLocationUpdateOption>
  16423. /** [wx.startLocationUpdateBackground(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdateBackground.html)
  16424. *
  16425. * 开启小程序进入前后台时均接收位置消息,需引导用户开启[授权]((open-ability/authorize#后台定位))。授权以后,小程序在运行中或进入后台均可接受位置消息变化。
  16426. *
  16427. * **注意**
  16428. *
  16429. *
  16430. * - 安卓微信7.0.6版本,iOS 7.0.5版本起支持该接口
  16431. * - 需在app.json中配置requiredBackgroundModes: ['location']后使用
  16432. * - 获取位置信息需配置[地理位置用途说明](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#permission)。
  16433. *
  16434. * 最低基础库: `2.8.0` */
  16435. startLocationUpdateBackground<
  16436. T extends StartLocationUpdateBackgroundOption = StartLocationUpdateBackgroundOption
  16437. >(
  16438. option?: T
  16439. ): PromisifySuccessResult<T, StartLocationUpdateBackgroundOption>
  16440. /** [wx.startPullDownRefresh(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/pull-down-refresh/wx.startPullDownRefresh.html)
  16441. *
  16442. * 开始下拉刷新。调用后触发下拉刷新动画,效果与用户手动下拉刷新一致。
  16443. *
  16444. * **示例代码**
  16445. *
  16446. *
  16447. * ```js
  16448. wx.startPullDownRefresh()
  16449. ```
  16450. *
  16451. * 最低基础库: `1.5.0` */
  16452. startPullDownRefresh<
  16453. T extends StartPullDownRefreshOption = StartPullDownRefreshOption
  16454. >(
  16455. option?: T
  16456. ): PromisifySuccessResult<T, StartPullDownRefreshOption>
  16457. /** [wx.startRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.startRecord.html)
  16458. *
  16459. * 开始录音。当主动调用 [wx.stopRecord](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.stopRecord.html),或者录音超过1分钟时自动结束录音。当用户离开小程序时,此接口无法调用。
  16460. *
  16461. * **示例代码**
  16462. *
  16463. *
  16464. * ```js
  16465. wx.startRecord({
  16466. success (res) {
  16467. const tempFilePath = res.tempFilePath
  16468. }
  16469. })
  16470. setTimeout(function () {
  16471. wx.stopRecord() // 结束录音
  16472. }, 10000)
  16473. ```
  16474. * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getRecorderManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.getRecorderManager.html) 替换
  16475. * */
  16476. startRecord<T extends WxStartRecordOption = WxStartRecordOption>(
  16477. option?: T
  16478. ): PromisifySuccessResult<T, WxStartRecordOption>
  16479. /** [wx.startSoterAuthentication(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.startSoterAuthentication.html)
  16480. *
  16481. * 开始 SOTER 生物认证。验证流程请参考[说明](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/bio-auth.html)。
  16482. *
  16483. * **resultJSON 说明**
  16484. *
  16485. *
  16486. * 此数据为设备TEE中,将传入的challenge和TEE内其他安全信息组成的数据进行组装而来的JSON,对下述字段的解释如下表。例子如下:
  16487. * | 字段名 | 说明 |
  16488. * |---------|-------------------------------------------------------------------------------------------|
  16489. * | raw | 调用者传入的challenge |
  16490. * | fid | (仅Android支持)本次生物识别认证的生物信息编号(如指纹识别则是指纹信息在本设备内部编号) |
  16491. * | counter | 防重放特征参数 |
  16492. * | tee_n | TEE名称(如高通或者trustonic等) |
  16493. * | tee_v | TEE版本号 |
  16494. * | fp_n | 指纹以及相关逻辑模块提供商(如FPC等) |
  16495. * | fp_v | 指纹以及相关模块版本号 |
  16496. * | cpu_id | 机器唯一识别ID |
  16497. * | uid | 概念同Android系统定义uid,即应用程序编号 |
  16498. *
  16499. * ```json
  16500. {
  16501. "raw":"msg",
  16502. "fid":"2",
  16503. "counter":123,
  16504. "tee_n":"TEE Name",
  16505. "tee_v":"TEE Version",
  16506. "fp_n":"Fingerprint Sensor Name",
  16507. "fp_v":"Fingerprint Sensor Version",
  16508. "cpu_id":"CPU Id",
  16509. "uid":"21"
  16510. }
  16511. ```
  16512. *
  16513. * **示例代码**
  16514. *
  16515. *
  16516. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/q3tCKkmJ7g2e)
  16517. * ```js
  16518. wx.startSoterAuthentication({
  16519. requestAuthModes: ['fingerPrint'],
  16520. challenge: '123456',
  16521. authContent: '请用指纹解锁',
  16522. success(res) {
  16523. }
  16524. })
  16525. ```
  16526. *
  16527. * 最低基础库: `1.5.0` */
  16528. startSoterAuthentication<
  16529. T extends StartSoterAuthenticationOption = StartSoterAuthenticationOption
  16530. >(
  16531. option: T
  16532. ): PromisifySuccessResult<T, StartSoterAuthenticationOption>
  16533. /** [wx.startWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.startWifi.html)
  16534. *
  16535. * 初始化 Wi-Fi 模块。
  16536. *
  16537. * **示例代码**
  16538. *
  16539. *
  16540. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/8P7zrkmd7r2n)
  16541. * ```js
  16542. wx.startWifi({
  16543. success (res) {
  16544. console.log(res.errMsg)
  16545. }
  16546. })
  16547. ```
  16548. *
  16549. * 最低基础库: `1.6.0` */
  16550. startWifi<T extends StartWifiOption = StartWifiOption>(
  16551. option?: T
  16552. ): PromisifySuccessResult<T, StartWifiOption>
  16553. /** [wx.stopAccelerometer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.stopAccelerometer.html)
  16554. *
  16555. * 停止监听加速度数据。
  16556. *
  16557. * **示例代码**
  16558. *
  16559. *
  16560. * ```js
  16561. wx.stopAccelerometer()
  16562. ```
  16563. *
  16564. * 最低基础库: `1.1.0` */
  16565. stopAccelerometer<
  16566. T extends StopAccelerometerOption = StopAccelerometerOption
  16567. >(
  16568. option?: T
  16569. ): PromisifySuccessResult<T, StopAccelerometerOption>
  16570. /** [wx.stopBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.stopBackgroundAudio.html)
  16571. *
  16572. * 停止播放音乐。
  16573. *
  16574. * **示例代码**
  16575. *
  16576. *
  16577. * ```js
  16578. wx.stopBackgroundAudio()
  16579. ```
  16580. * @deprecated 基础库版本 [1.2.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 替换
  16581. * */
  16582. stopBackgroundAudio<
  16583. T extends StopBackgroundAudioOption = StopBackgroundAudioOption
  16584. >(
  16585. option?: T
  16586. ): PromisifySuccessResult<T, StopBackgroundAudioOption>
  16587. /** [wx.stopBeaconDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.stopBeaconDiscovery.html)
  16588. *
  16589. * 停止搜索附近的 iBeacon 设备
  16590. *
  16591. * 最低基础库: `1.2.0` */
  16592. stopBeaconDiscovery<
  16593. T extends StopBeaconDiscoveryOption = StopBeaconDiscoveryOption
  16594. >(
  16595. option?: T
  16596. ): PromisifySuccessResult<T, StopBeaconDiscoveryOption>
  16597. /** [wx.stopBluetoothDevicesDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.stopBluetoothDevicesDiscovery.html)
  16598. *
  16599. * 停止搜寻附近的蓝牙外围设备。若已经找到需要的蓝牙设备并不需要继续搜索时,建议调用该接口停止蓝牙搜索。
  16600. *
  16601. * **示例代码**
  16602. *
  16603. *
  16604. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  16605. * ```js
  16606. wx.stopBluetoothDevicesDiscovery({
  16607. success (res) {
  16608. console.log(res)
  16609. }
  16610. })
  16611. ```
  16612. *
  16613. * 最低基础库: `1.1.0` */
  16614. stopBluetoothDevicesDiscovery<
  16615. T extends StopBluetoothDevicesDiscoveryOption = StopBluetoothDevicesDiscoveryOption
  16616. >(
  16617. option?: T
  16618. ): PromisifySuccessResult<T, StopBluetoothDevicesDiscoveryOption>
  16619. /** [wx.stopCompass(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.stopCompass.html)
  16620. *
  16621. * 停止监听罗盘数据
  16622. *
  16623. * **示例代码**
  16624. *
  16625. *
  16626. * ```js
  16627. wx.stopCompass()
  16628. ```
  16629. *
  16630. * 最低基础库: `1.1.0` */
  16631. stopCompass<T extends StopCompassOption = StopCompassOption>(
  16632. option?: T
  16633. ): PromisifySuccessResult<T, StopCompassOption>
  16634. /** [wx.stopDeviceMotionListening(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.stopDeviceMotionListening.html)
  16635. *
  16636. * 停止监听设备方向的变化。
  16637. *
  16638. * 最低基础库: `2.3.0` */
  16639. stopDeviceMotionListening<
  16640. T extends StopDeviceMotionListeningOption = StopDeviceMotionListeningOption
  16641. >(
  16642. option?: T
  16643. ): PromisifySuccessResult<T, StopDeviceMotionListeningOption>
  16644. /** [wx.stopGyroscope(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.stopGyroscope.html)
  16645. *
  16646. * 停止监听陀螺仪数据。
  16647. *
  16648. * 最低基础库: `2.3.0` */
  16649. stopGyroscope<T extends StopGyroscopeOption = StopGyroscopeOption>(
  16650. option?: T
  16651. ): PromisifySuccessResult<T, StopGyroscopeOption>
  16652. /** [wx.stopHCE(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/wx.stopHCE.html)
  16653. *
  16654. * 关闭 NFC 模块。仅在安卓系统下有效。
  16655. *
  16656. * **示例代码**
  16657. *
  16658. *
  16659. * ```js
  16660. wx.stopHCE({
  16661. success (res) {
  16662. console.log(res.errMsg)
  16663. }
  16664. })
  16665. ```
  16666. *
  16667. * 最低基础库: `1.7.0` */
  16668. stopHCE<T extends StopHCEOption = StopHCEOption>(
  16669. option?: T
  16670. ): PromisifySuccessResult<T, StopHCEOption>
  16671. /** [wx.stopLocalServiceDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.stopLocalServiceDiscovery.html)
  16672. *
  16673. * 停止搜索 mDNS 服务
  16674. *
  16675. * 最低基础库: `2.4.0` */
  16676. stopLocalServiceDiscovery<
  16677. T extends StopLocalServiceDiscoveryOption = StopLocalServiceDiscoveryOption
  16678. >(
  16679. option?: T
  16680. ): PromisifySuccessResult<T, StopLocalServiceDiscoveryOption>
  16681. /** [wx.stopLocationUpdate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.stopLocationUpdate.html)
  16682. *
  16683. * 关闭监听实时位置变化,前后台都停止消息接收
  16684. *
  16685. * 最低基础库: `2.8.0` */
  16686. stopLocationUpdate<
  16687. T extends StopLocationUpdateOption = StopLocationUpdateOption
  16688. >(
  16689. option?: T
  16690. ): PromisifySuccessResult<T, StopLocationUpdateOption>
  16691. /** [wx.stopPullDownRefresh(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/pull-down-refresh/wx.stopPullDownRefresh.html)
  16692. *
  16693. * 停止当前页面下拉刷新。
  16694. *
  16695. * **示例代码**
  16696. *
  16697. *
  16698. * ```js
  16699. Page({
  16700. onPullDownRefresh () {
  16701. wx.stopPullDownRefresh()
  16702. }
  16703. })
  16704. ```
  16705. *
  16706. * 最低基础库: `1.5.0` */
  16707. stopPullDownRefresh<
  16708. T extends StopPullDownRefreshOption = StopPullDownRefreshOption
  16709. >(
  16710. option?: T
  16711. ): PromisifySuccessResult<T, StopPullDownRefreshOption>
  16712. /** [wx.stopRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.stopRecord.html)
  16713. *
  16714. * 停止录音。
  16715. *
  16716. * **示例代码**
  16717. *
  16718. *
  16719. * ```js
  16720. wx.startRecord({
  16721. success (res) {
  16722. const tempFilePath = res.tempFilePath
  16723. }
  16724. })
  16725. setTimeout(function () {
  16726. wx.stopRecord() // 结束录音
  16727. }, 10000)
  16728. ```
  16729. * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.getRecorderManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.getRecorderManager.html) 替换
  16730. * */
  16731. stopRecord<T extends WxStopRecordOption = WxStopRecordOption>(
  16732. option?: T
  16733. ): PromisifySuccessResult<T, WxStopRecordOption>
  16734. /** [wx.stopVoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.stopVoice.html)
  16735. *
  16736. * 结束播放语音。
  16737. *
  16738. * **示例代码**
  16739. *
  16740. *
  16741. * ```js
  16742. wx.startRecord({
  16743. success (res) {
  16744. const tempFilePath = res.tempFilePath
  16745. wx.playVoice({
  16746. filePath: tempFilePath,
  16747. })
  16748. setTimeout(() => { wx.stopVoice() }, 5000)
  16749. }
  16750. })
  16751. ```
  16752. * @deprecated 基础库版本 [1.6.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.createInnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html) 替换
  16753. * */
  16754. stopVoice<T extends StopVoiceOption = StopVoiceOption>(
  16755. option?: T
  16756. ): PromisifySuccessResult<T, StopVoiceOption>
  16757. /** [wx.stopWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.stopWifi.html)
  16758. *
  16759. * 关闭 Wi-Fi 模块。
  16760. *
  16761. * **示例代码**
  16762. *
  16763. *
  16764. * ```js
  16765. wx.stopWifi({
  16766. success (res) {
  16767. console.log(res.errMsg)
  16768. }
  16769. })
  16770. ```
  16771. *
  16772. * 最低基础库: `1.6.0` */
  16773. stopWifi<T extends StopWifiOption = StopWifiOption>(
  16774. option?: T
  16775. ): PromisifySuccessResult<T, StopWifiOption>
  16776. /** [wx.subscribeVoIPVideoMembers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.subscribeVoIPVideoMembers.html)
  16777. *
  16778. * 订阅视频画面成员。对于视频房间,当成员超过两人时需进行订阅,否则只能看到最先加入房间的两人画面。
  16779. *
  16780. * 最低基础库: `2.11.0` */
  16781. subscribeVoIPVideoMembers<
  16782. T extends SubscribeVoIPVideoMembersOption = SubscribeVoIPVideoMembersOption
  16783. >(
  16784. option: T
  16785. ): PromisifySuccessResult<T, SubscribeVoIPVideoMembersOption>
  16786. /** [wx.switchTab(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.switchTab.html)
  16787. *
  16788. * 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
  16789. *
  16790. * **示例代码**
  16791. *
  16792. *
  16793. * ```json
  16794. {
  16795. "tabBar": {
  16796. "list": [{
  16797. "pagePath": "index",
  16798. "text": "首页"
  16799. },{
  16800. "pagePath": "other",
  16801. "text": "其他"
  16802. }]
  16803. }
  16804. }
  16805. ```
  16806. *
  16807. * ```js
  16808. wx.switchTab({
  16809. url: '/index'
  16810. })
  16811. ``` */
  16812. switchTab<T extends SwitchTabOption = SwitchTabOption>(
  16813. option: T
  16814. ): PromisifySuccessResult<T, SwitchTabOption>
  16815. /** [wx.updateShareMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.updateShareMenu.html)
  16816. *
  16817. * 更新转发属性
  16818. *
  16819. * **示例代码**
  16820. *
  16821. *
  16822. * ```js
  16823. wx.updateShareMenu({
  16824. withShareTicket: true,
  16825. success () { }
  16826. })
  16827. ```
  16828. * ```js
  16829. // 转发私密消息
  16830. wx.updateShareMenu({
  16831. isPrivateMessage: true,
  16832. activityId: 'xxx',
  16833. templateInfo: {},
  16834. success () { },
  16835. fail () {}
  16836. })
  16837. ```
  16838. *
  16839. * 最低基础库: `1.2.0` */
  16840. updateShareMenu<
  16841. T extends UpdateShareMenuOption = UpdateShareMenuOption
  16842. >(
  16843. option: T
  16844. ): PromisifySuccessResult<T, UpdateShareMenuOption>
  16845. /** [wx.updateVoIPChatMuteConfig(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.updateVoIPChatMuteConfig.html)
  16846. *
  16847. * 更新实时语音静音设置
  16848. *
  16849. * 最低基础库: `2.7.0` */
  16850. updateVoIPChatMuteConfig<
  16851. T extends UpdateVoIPChatMuteConfigOption = UpdateVoIPChatMuteConfigOption
  16852. >(
  16853. option: T
  16854. ): PromisifySuccessResult<T, UpdateVoIPChatMuteConfigOption>
  16855. /** [wx.updateWeChatApp(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/wx.updateWeChatApp.html)
  16856. *
  16857. * 更新客户端版本。当判断用户小程序所在客户端版本过低时,可使用该接口跳转到更新微信页面。
  16858. *
  16859. * 最低基础库: `2.12.0` */
  16860. updateWeChatApp<
  16861. T extends UpdateWeChatAppOption = UpdateWeChatAppOption
  16862. >(
  16863. option?: T
  16864. ): PromisifySuccessResult<T, UpdateWeChatAppOption>
  16865. /** [wx.vibrateLong(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/vibrate/wx.vibrateLong.html)
  16866. *
  16867. * 使手机发生较长时间的振动(400 ms)
  16868. *
  16869. * 最低基础库: `1.2.0` */
  16870. vibrateLong<T extends VibrateLongOption = VibrateLongOption>(
  16871. option?: T
  16872. ): PromisifySuccessResult<T, VibrateLongOption>
  16873. /** [wx.vibrateShort(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/vibrate/wx.vibrateShort.html)
  16874. *
  16875. * 使手机发生较短时间的振动(15 ms)。仅在 iPhone `7 / 7 Plus` 以上及 Android 机型生效
  16876. *
  16877. * 最低基础库: `1.2.0` */
  16878. vibrateShort<T extends VibrateShortOption = VibrateShortOption>(
  16879. option: T
  16880. ): PromisifySuccessResult<T, VibrateShortOption>
  16881. /** [wx.writeBLECharacteristicValue(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.writeBLECharacteristicValue.html)
  16882. *
  16883. * 向低功耗蓝牙设备特征值中写入二进制数据。注意:必须设备的特征值支持 write 才可以成功调用。
  16884. *
  16885. * **注意**
  16886. *
  16887. *
  16888. * - 并行调用多次会存在写失败的可能性。
  16889. * - 小程序不会对写入数据包大小做限制,但系统与蓝牙设备会限制蓝牙4.0单次传输的数据大小,超过最大字节数后会发生写入错误,建议每次写入不超过20字节。
  16890. * - 若单次写入数据过长,iOS 上存在系统不会有任何回调的情况(包括错误回调)。
  16891. * - 安卓平台上,在调用 `notifyBLECharacteristicValueChange` 成功后立即调用 `writeBLECharacteristicValue` 接口,在部分机型上会发生 10008 系统错误
  16892. *
  16893. * **示例代码**
  16894. *
  16895. *
  16896. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  16897. * ```js
  16898. // 向蓝牙设备发送一个0x00的16进制数据
  16899. let buffer = new ArrayBuffer(1)
  16900. let dataView = new DataView(buffer)
  16901. dataView.setUint8(0, 0)
  16902. wx.writeBLECharacteristicValue({
  16903. // 这里的 deviceId 需要在 getBluetoothDevices 或 onBluetoothDeviceFound 接口中获取
  16904. deviceId,
  16905. // 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
  16906. serviceId,
  16907. // 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
  16908. characteristicId,
  16909. // 这里的value是ArrayBuffer类型
  16910. value: buffer,
  16911. success (res) {
  16912. console.log('writeBLECharacteristicValue success', res.errMsg)
  16913. }
  16914. })
  16915. ```
  16916. *
  16917. * 最低基础库: `1.1.0` */
  16918. writeBLECharacteristicValue<
  16919. T extends WriteBLECharacteristicValueOption = WriteBLECharacteristicValueOption
  16920. >(
  16921. option: T
  16922. ): PromisifySuccessResult<T, WriteBLECharacteristicValueOption>
  16923. }
  16924. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  16925. type AccessCompleteCallback = (res: GeneralCallbackResult) => void
  16926. /** 接口调用失败的回调函数 */
  16927. type AccessFailCallback = (result: AccessFailCallbackResult) => void
  16928. /** 接口调用成功的回调函数 */
  16929. type AccessSuccessCallback = (res: GeneralCallbackResult) => void
  16930. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  16931. type AddCardCompleteCallback = (res: GeneralCallbackResult) => void
  16932. /** 接口调用失败的回调函数 */
  16933. type AddCardFailCallback = (res: GeneralCallbackResult) => void
  16934. /** 接口调用成功的回调函数 */
  16935. type AddCardSuccessCallback = (result: AddCardSuccessCallbackResult) => void
  16936. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  16937. type AddCustomLayerCompleteCallback = (res: GeneralCallbackResult) => void
  16938. /** 接口调用失败的回调函数 */
  16939. type AddCustomLayerFailCallback = (res: GeneralCallbackResult) => void
  16940. /** 接口调用成功的回调函数 */
  16941. type AddCustomLayerSuccessCallback = (res: GeneralCallbackResult) => void
  16942. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  16943. type AddGroundOverlayCompleteCallback = (res: GeneralCallbackResult) => void
  16944. /** 接口调用失败的回调函数 */
  16945. type AddGroundOverlayFailCallback = (res: GeneralCallbackResult) => void
  16946. /** 接口调用成功的回调函数 */
  16947. type AddGroundOverlaySuccessCallback = (res: GeneralCallbackResult) => void
  16948. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  16949. type AddMarkersCompleteCallback = (res: GeneralCallbackResult) => void
  16950. /** 接口调用失败的回调函数 */
  16951. type AddMarkersFailCallback = (res: GeneralCallbackResult) => void
  16952. /** 接口调用成功的回调函数 */
  16953. type AddMarkersSuccessCallback = (res: GeneralCallbackResult) => void
  16954. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  16955. type AddPhoneCalendarCompleteCallback = (res: GeneralCallbackResult) => void
  16956. /** 接口调用失败的回调函数 */
  16957. type AddPhoneCalendarFailCallback = (res: GeneralCallbackResult) => void
  16958. /** 接口调用成功的回调函数 */
  16959. type AddPhoneCalendarSuccessCallback = (res: GeneralCallbackResult) => void
  16960. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  16961. type AddPhoneContactCompleteCallback = (res: GeneralCallbackResult) => void
  16962. /** 接口调用失败的回调函数 */
  16963. type AddPhoneContactFailCallback = (res: GeneralCallbackResult) => void
  16964. /** 接口调用成功的回调函数 */
  16965. type AddPhoneContactSuccessCallback = (res: GeneralCallbackResult) => void
  16966. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  16967. type AddPhoneRepeatCalendarCompleteCallback = (
  16968. res: GeneralCallbackResult
  16969. ) => void
  16970. /** 接口调用失败的回调函数 */
  16971. type AddPhoneRepeatCalendarFailCallback = (
  16972. res: GeneralCallbackResult
  16973. ) => void
  16974. /** 接口调用成功的回调函数 */
  16975. type AddPhoneRepeatCalendarSuccessCallback = (
  16976. res: GeneralCallbackResult
  16977. ) => void
  16978. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  16979. type AddServiceCompleteCallback = (res: GeneralCallbackResult) => void
  16980. /** 接口调用失败的回调函数 */
  16981. type AddServiceFailCallback = (res: GeneralCallbackResult) => void
  16982. /** 接口调用成功的回调函数 */
  16983. type AddServiceSuccessCallback = (res: GeneralCallbackResult) => void
  16984. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  16985. type AppendFileCompleteCallback = (res: GeneralCallbackResult) => void
  16986. /** 接口调用失败的回调函数 */
  16987. type AppendFileFailCallback = (result: AppendFileFailCallbackResult) => void
  16988. /** 接口调用成功的回调函数 */
  16989. type AppendFileSuccessCallback = (res: GeneralCallbackResult) => void
  16990. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  16991. type AuthPrivateMessageCompleteCallback = (
  16992. res: GeneralCallbackResult
  16993. ) => void
  16994. /** 接口调用失败的回调函数 */
  16995. type AuthPrivateMessageFailCallback = (res: GeneralCallbackResult) => void
  16996. /** 接口调用成功的回调函数 */
  16997. type AuthPrivateMessageSuccessCallback = (
  16998. result: AuthPrivateMessageSuccessCallbackResult
  16999. ) => void
  17000. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17001. type AuthorizeCompleteCallback = (res: GeneralCallbackResult) => void
  17002. /** 接口调用失败的回调函数 */
  17003. type AuthorizeFailCallback = (res: GeneralCallbackResult) => void
  17004. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17005. type AuthorizeForMiniProgramCompleteCallback = (
  17006. res: GeneralCallbackResult
  17007. ) => void
  17008. /** 接口调用失败的回调函数 */
  17009. type AuthorizeForMiniProgramFailCallback = (
  17010. res: GeneralCallbackResult
  17011. ) => void
  17012. /** 接口调用成功的回调函数 */
  17013. type AuthorizeForMiniProgramSuccessCallback = (
  17014. res: GeneralCallbackResult
  17015. ) => void
  17016. /** 接口调用成功的回调函数 */
  17017. type AuthorizeSuccessCallback = (res: GeneralCallbackResult) => void
  17018. /** 背景音频播放错误事件的回调函数 */
  17019. type BackgroundAudioManagerOnErrorCallback = (
  17020. res: GeneralCallbackResult
  17021. ) => void
  17022. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17023. type BlurCompleteCallback = (res: GeneralCallbackResult) => void
  17024. /** 接口调用失败的回调函数 */
  17025. type BlurFailCallback = (res: GeneralCallbackResult) => void
  17026. /** 接口调用成功的回调函数 */
  17027. type BlurSuccessCallback = (res: GeneralCallbackResult) => void
  17028. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */
  17029. type BoundingClientRectCallback = (
  17030. result: BoundingClientRectCallbackResult
  17031. ) => void
  17032. /** 接口调用成功的回调函数 */
  17033. type CameraContextStartRecordSuccessCallback = (
  17034. res: GeneralCallbackResult
  17035. ) => void
  17036. /** 接口调用成功的回调函数 */
  17037. type CameraContextStopRecordSuccessCallback = (
  17038. result: StopRecordSuccessCallbackResult
  17039. ) => void
  17040. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17041. type CanvasGetImageDataCompleteCallback = (
  17042. res: GeneralCallbackResult
  17043. ) => void
  17044. /** 接口调用失败的回调函数 */
  17045. type CanvasGetImageDataFailCallback = (res: GeneralCallbackResult) => void
  17046. /** 接口调用成功的回调函数 */
  17047. type CanvasGetImageDataSuccessCallback = (
  17048. result: CanvasGetImageDataSuccessCallbackResult
  17049. ) => void
  17050. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17051. type CanvasPutImageDataCompleteCallback = (
  17052. res: GeneralCallbackResult
  17053. ) => void
  17054. /** 接口调用失败的回调函数 */
  17055. type CanvasPutImageDataFailCallback = (res: GeneralCallbackResult) => void
  17056. /** 接口调用成功的回调函数 */
  17057. type CanvasPutImageDataSuccessCallback = (
  17058. res: GeneralCallbackResult
  17059. ) => void
  17060. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17061. type CanvasToTempFilePathCompleteCallback = (
  17062. res: GeneralCallbackResult
  17063. ) => void
  17064. /** 接口调用失败的回调函数 */
  17065. type CanvasToTempFilePathFailCallback = (res: GeneralCallbackResult) => void
  17066. /** 接口调用成功的回调函数 */
  17067. type CanvasToTempFilePathSuccessCallback = (
  17068. result: CanvasToTempFilePathSuccessCallbackResult
  17069. ) => void
  17070. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17071. type CheckIsOpenAccessibilityCompleteCallback = (
  17072. res: GeneralCallbackResult
  17073. ) => void
  17074. /** 接口调用失败的回调函数 */
  17075. type CheckIsOpenAccessibilityFailCallback = (
  17076. res: GeneralCallbackResult
  17077. ) => void
  17078. /** 接口调用成功的回调函数 */
  17079. type CheckIsOpenAccessibilitySuccessCallback = (
  17080. option: CheckIsOpenAccessibilitySuccessCallbackOption
  17081. ) => void
  17082. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17083. type CheckIsSoterEnrolledInDeviceCompleteCallback = (
  17084. res: GeneralCallbackResult
  17085. ) => void
  17086. /** 接口调用失败的回调函数 */
  17087. type CheckIsSoterEnrolledInDeviceFailCallback = (
  17088. res: GeneralCallbackResult
  17089. ) => void
  17090. /** 接口调用成功的回调函数 */
  17091. type CheckIsSoterEnrolledInDeviceSuccessCallback = (
  17092. result: CheckIsSoterEnrolledInDeviceSuccessCallbackResult
  17093. ) => void
  17094. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17095. type CheckIsSupportSoterAuthenticationCompleteCallback = (
  17096. res: GeneralCallbackResult
  17097. ) => void
  17098. /** 接口调用失败的回调函数 */
  17099. type CheckIsSupportSoterAuthenticationFailCallback = (
  17100. res: GeneralCallbackResult
  17101. ) => void
  17102. /** 接口调用成功的回调函数 */
  17103. type CheckIsSupportSoterAuthenticationSuccessCallback = (
  17104. result: CheckIsSupportSoterAuthenticationSuccessCallbackResult
  17105. ) => void
  17106. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17107. type CheckSessionCompleteCallback = (res: GeneralCallbackResult) => void
  17108. /** 接口调用失败的回调函数 */
  17109. type CheckSessionFailCallback = (res: GeneralCallbackResult) => void
  17110. /** 接口调用成功的回调函数 */
  17111. type CheckSessionSuccessCallback = (res: GeneralCallbackResult) => void
  17112. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17113. type ChooseAddressCompleteCallback = (res: GeneralCallbackResult) => void
  17114. /** 接口调用失败的回调函数 */
  17115. type ChooseAddressFailCallback = (res: GeneralCallbackResult) => void
  17116. /** 接口调用成功的回调函数 */
  17117. type ChooseAddressSuccessCallback = (
  17118. result: ChooseAddressSuccessCallbackResult
  17119. ) => void
  17120. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17121. type ChooseImageCompleteCallback = (res: GeneralCallbackResult) => void
  17122. /** 接口调用失败的回调函数 */
  17123. type ChooseImageFailCallback = (res: GeneralCallbackResult) => void
  17124. /** 接口调用成功的回调函数 */
  17125. type ChooseImageSuccessCallback = (
  17126. result: ChooseImageSuccessCallbackResult
  17127. ) => void
  17128. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17129. type ChooseInvoiceCompleteCallback = (res: GeneralCallbackResult) => void
  17130. /** 接口调用失败的回调函数 */
  17131. type ChooseInvoiceFailCallback = (res: GeneralCallbackResult) => void
  17132. /** 接口调用成功的回调函数 */
  17133. type ChooseInvoiceSuccessCallback = (
  17134. result: ChooseInvoiceSuccessCallbackResult
  17135. ) => void
  17136. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17137. type ChooseInvoiceTitleCompleteCallback = (
  17138. res: GeneralCallbackResult
  17139. ) => void
  17140. /** 接口调用失败的回调函数 */
  17141. type ChooseInvoiceTitleFailCallback = (res: GeneralCallbackResult) => void
  17142. /** 接口调用成功的回调函数 */
  17143. type ChooseInvoiceTitleSuccessCallback = (
  17144. result: ChooseInvoiceTitleSuccessCallbackResult
  17145. ) => void
  17146. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17147. type ChooseLocationCompleteCallback = (res: GeneralCallbackResult) => void
  17148. /** 接口调用失败的回调函数 */
  17149. type ChooseLocationFailCallback = (res: GeneralCallbackResult) => void
  17150. /** 接口调用成功的回调函数 */
  17151. type ChooseLocationSuccessCallback = (
  17152. result: ChooseLocationSuccessCallbackResult
  17153. ) => void
  17154. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17155. type ChooseMediaCompleteCallback = (res: GeneralCallbackResult) => void
  17156. /** 接口调用失败的回调函数 */
  17157. type ChooseMediaFailCallback = (res: GeneralCallbackResult) => void
  17158. /** 接口调用成功的回调函数 */
  17159. type ChooseMediaSuccessCallback = (
  17160. result: ChooseMediaSuccessCallbackResult
  17161. ) => void
  17162. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17163. type ChooseMessageFileCompleteCallback = (
  17164. res: GeneralCallbackResult
  17165. ) => void
  17166. /** 接口调用失败的回调函数 */
  17167. type ChooseMessageFileFailCallback = (res: GeneralCallbackResult) => void
  17168. /** 接口调用成功的回调函数 */
  17169. type ChooseMessageFileSuccessCallback = (
  17170. result: ChooseMessageFileSuccessCallbackResult
  17171. ) => void
  17172. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17173. type ChooseVideoCompleteCallback = (res: GeneralCallbackResult) => void
  17174. /** 接口调用失败的回调函数 */
  17175. type ChooseVideoFailCallback = (res: GeneralCallbackResult) => void
  17176. /** 接口调用成功的回调函数 */
  17177. type ChooseVideoSuccessCallback = (
  17178. result: ChooseVideoSuccessCallbackResult
  17179. ) => void
  17180. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17181. type ClearCompleteCallback = (res: GeneralCallbackResult) => void
  17182. /** 接口调用失败的回调函数 */
  17183. type ClearFailCallback = (res: GeneralCallbackResult) => void
  17184. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17185. type ClearStorageCompleteCallback = (res: GeneralCallbackResult) => void
  17186. /** 接口调用失败的回调函数 */
  17187. type ClearStorageFailCallback = (res: GeneralCallbackResult) => void
  17188. /** 接口调用成功的回调函数 */
  17189. type ClearStorageSuccessCallback = (res: GeneralCallbackResult) => void
  17190. /** 接口调用成功的回调函数 */
  17191. type ClearSuccessCallback = (res: GeneralCallbackResult) => void
  17192. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17193. type CloseBLEConnectionCompleteCallback = (res: BluetoothError) => void
  17194. /** 接口调用失败的回调函数 */
  17195. type CloseBLEConnectionFailCallback = (res: BluetoothError) => void
  17196. /** 接口调用成功的回调函数 */
  17197. type CloseBLEConnectionSuccessCallback = (res: BluetoothError) => void
  17198. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17199. type CloseBluetoothAdapterCompleteCallback = (res: BluetoothError) => void
  17200. /** 接口调用失败的回调函数 */
  17201. type CloseBluetoothAdapterFailCallback = (res: BluetoothError) => void
  17202. /** 接口调用成功的回调函数 */
  17203. type CloseBluetoothAdapterSuccessCallback = (res: BluetoothError) => void
  17204. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17205. type CloseSocketCompleteCallback = (res: GeneralCallbackResult) => void
  17206. /** 接口调用失败的回调函数 */
  17207. type CloseSocketFailCallback = (res: GeneralCallbackResult) => void
  17208. /** 接口调用成功的回调函数 */
  17209. type CloseSocketSuccessCallback = (res: GeneralCallbackResult) => void
  17210. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17211. type CompressImageCompleteCallback = (res: GeneralCallbackResult) => void
  17212. /** 接口调用失败的回调函数 */
  17213. type CompressImageFailCallback = (res: GeneralCallbackResult) => void
  17214. /** 接口调用成功的回调函数 */
  17215. type CompressImageSuccessCallback = (
  17216. result: CompressImageSuccessCallbackResult
  17217. ) => void
  17218. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17219. type CompressVideoCompleteCallback = (res: GeneralCallbackResult) => void
  17220. /** 接口调用失败的回调函数 */
  17221. type CompressVideoFailCallback = (res: GeneralCallbackResult) => void
  17222. /** 接口调用成功的回调函数 */
  17223. type CompressVideoSuccessCallback = (
  17224. result: CompressVideoSuccessCallbackResult
  17225. ) => void
  17226. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17227. type ConnectCompleteCallback = (res: Nfcrwerror) => void
  17228. /** 接口调用失败的回调函数 */
  17229. type ConnectFailCallback = (res: Nfcrwerror) => void
  17230. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17231. type ConnectSocketCompleteCallback = (res: GeneralCallbackResult) => void
  17232. /** 接口调用失败的回调函数 */
  17233. type ConnectSocketFailCallback = (res: GeneralCallbackResult) => void
  17234. /** 接口调用成功的回调函数 */
  17235. type ConnectSocketSuccessCallback = (res: GeneralCallbackResult) => void
  17236. /** 接口调用成功的回调函数 */
  17237. type ConnectSuccessCallback = (res: Nfcrwerror) => void
  17238. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17239. type ConnectWifiCompleteCallback = (res: WifiError) => void
  17240. /** 接口调用失败的回调函数 */
  17241. type ConnectWifiFailCallback = (res: WifiError) => void
  17242. /** 接口调用成功的回调函数 */
  17243. type ConnectWifiSuccessCallback = (res: WifiError) => void
  17244. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,返回节点信息。 */
  17245. type ContextCallback = (result: ContextCallbackResult) => void
  17246. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17247. type CopyFileCompleteCallback = (res: GeneralCallbackResult) => void
  17248. /** 接口调用失败的回调函数 */
  17249. type CopyFileFailCallback = (result: CopyFileFailCallbackResult) => void
  17250. /** 接口调用成功的回调函数 */
  17251. type CopyFileSuccessCallback = (res: GeneralCallbackResult) => void
  17252. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17253. type CreateBLEConnectionCompleteCallback = (res: BluetoothError) => void
  17254. /** 接口调用失败的回调函数 */
  17255. type CreateBLEConnectionFailCallback = (res: BluetoothError) => void
  17256. /** 接口调用成功的回调函数 */
  17257. type CreateBLEConnectionSuccessCallback = (res: BluetoothError) => void
  17258. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17259. type CreateBLEPeripheralServerCompleteCallback = (
  17260. res: GeneralCallbackResult
  17261. ) => void
  17262. /** 接口调用失败的回调函数 */
  17263. type CreateBLEPeripheralServerFailCallback = (
  17264. res: GeneralCallbackResult
  17265. ) => void
  17266. /** 接口调用成功的回调函数 */
  17267. type CreateBLEPeripheralServerSuccessCallback = (
  17268. result: CreateBLEPeripheralServerSuccessCallbackResult
  17269. ) => void
  17270. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17271. type DisableAlertBeforeUnloadCompleteCallback = (
  17272. res: GeneralCallbackResult
  17273. ) => void
  17274. /** 接口调用失败的回调函数 */
  17275. type DisableAlertBeforeUnloadFailCallback = (
  17276. res: GeneralCallbackResult
  17277. ) => void
  17278. /** 接口调用成功的回调函数 */
  17279. type DisableAlertBeforeUnloadSuccessCallback = (
  17280. res: GeneralCallbackResult
  17281. ) => void
  17282. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17283. type DownloadFileCompleteCallback = (res: GeneralCallbackResult) => void
  17284. /** 接口调用失败的回调函数 */
  17285. type DownloadFileFailCallback = (res: GeneralCallbackResult) => void
  17286. /** 接口调用成功的回调函数 */
  17287. type DownloadFileSuccessCallback = (
  17288. result: DownloadFileSuccessCallbackResult
  17289. ) => void
  17290. /** 下载进度变化事件的回调函数 */
  17291. type DownloadTaskOffProgressUpdateCallback = (
  17292. result: DownloadTaskOnProgressUpdateCallbackResult
  17293. ) => void
  17294. /** 下载进度变化事件的回调函数 */
  17295. type DownloadTaskOnProgressUpdateCallback = (
  17296. result: DownloadTaskOnProgressUpdateCallbackResult
  17297. ) => void
  17298. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17299. type EnableAlertBeforeUnloadCompleteCallback = (
  17300. res: GeneralCallbackResult
  17301. ) => void
  17302. /** 接口调用失败的回调函数 */
  17303. type EnableAlertBeforeUnloadFailCallback = (
  17304. res: GeneralCallbackResult
  17305. ) => void
  17306. /** 接口调用成功的回调函数 */
  17307. type EnableAlertBeforeUnloadSuccessCallback = (
  17308. res: GeneralCallbackResult
  17309. ) => void
  17310. /** 事件监听函数 */
  17311. type EventCallback = (
  17312. /** 触发事件参数 */
  17313. ...args: any
  17314. ) => void
  17315. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17316. type ExitFullScreenCompleteCallback = (res: GeneralCallbackResult) => void
  17317. /** 接口调用失败的回调函数 */
  17318. type ExitFullScreenFailCallback = (res: GeneralCallbackResult) => void
  17319. /** 接口调用成功的回调函数 */
  17320. type ExitFullScreenSuccessCallback = (res: GeneralCallbackResult) => void
  17321. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17322. type ExitPictureInPictureCompleteCallback = (
  17323. res: GeneralCallbackResult
  17324. ) => void
  17325. /** 接口调用失败的回调函数 */
  17326. type ExitPictureInPictureFailCallback = (res: GeneralCallbackResult) => void
  17327. /** 接口调用成功的回调函数 */
  17328. type ExitPictureInPictureSuccessCallback = (
  17329. res: GeneralCallbackResult
  17330. ) => void
  17331. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17332. type ExitVoIPChatCompleteCallback = (res: GeneralCallbackResult) => void
  17333. /** 接口调用失败的回调函数 */
  17334. type ExitVoIPChatFailCallback = (res: GeneralCallbackResult) => void
  17335. /** 接口调用成功的回调函数 */
  17336. type ExitVoIPChatSuccessCallback = (res: GeneralCallbackResult) => void
  17337. /** 回调函数 */
  17338. type FieldsCallback = (
  17339. /** 节点的相关信息 */
  17340. res: IAnyObject
  17341. ) => void
  17342. /** 接口调用失败的回调函数 */
  17343. type FileSystemManagerGetFileInfoFailCallback = (
  17344. result: GetFileInfoFailCallbackResult
  17345. ) => void
  17346. /** 接口调用成功的回调函数 */
  17347. type FileSystemManagerGetFileInfoSuccessCallback = (
  17348. result: FileSystemManagerGetFileInfoSuccessCallbackResult
  17349. ) => void
  17350. /** 接口调用成功的回调函数 */
  17351. type FileSystemManagerGetSavedFileListSuccessCallback = (
  17352. result: FileSystemManagerGetSavedFileListSuccessCallbackResult
  17353. ) => void
  17354. /** 接口调用失败的回调函数 */
  17355. type FileSystemManagerRemoveSavedFileFailCallback = (
  17356. result: RemoveSavedFileFailCallbackResult
  17357. ) => void
  17358. /** 接口调用失败的回调函数 */
  17359. type FileSystemManagerSaveFileFailCallback = (
  17360. result: SaveFileFailCallbackResult
  17361. ) => void
  17362. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17363. type FromScreenLocationCompleteCallback = (
  17364. res: GeneralCallbackResult
  17365. ) => void
  17366. /** 接口调用失败的回调函数 */
  17367. type FromScreenLocationFailCallback = (res: GeneralCallbackResult) => void
  17368. /** 接口调用成功的回调函数 */
  17369. type FromScreenLocationSuccessCallback = (
  17370. result: GetCenterLocationSuccessCallbackResult
  17371. ) => void
  17372. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17373. type GetAtqaCompleteCallback = (res: Nfcrwerror) => void
  17374. /** 接口调用失败的回调函数 */
  17375. type GetAtqaFailCallback = (res: Nfcrwerror) => void
  17376. /** 接口调用成功的回调函数 */
  17377. type GetAtqaSuccessCallback = (result: GetAtqaSuccessCallbackResult) => void
  17378. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17379. type GetAvailableAudioSourcesCompleteCallback = (
  17380. res: GeneralCallbackResult
  17381. ) => void
  17382. /** 接口调用失败的回调函数 */
  17383. type GetAvailableAudioSourcesFailCallback = (
  17384. res: GeneralCallbackResult
  17385. ) => void
  17386. /** 接口调用成功的回调函数 */
  17387. type GetAvailableAudioSourcesSuccessCallback = (
  17388. result: GetAvailableAudioSourcesSuccessCallbackResult
  17389. ) => void
  17390. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17391. type GetBLEDeviceCharacteristicsCompleteCallback = (
  17392. res: BluetoothError
  17393. ) => void
  17394. /** 接口调用失败的回调函数 */
  17395. type GetBLEDeviceCharacteristicsFailCallback = (res: BluetoothError) => void
  17396. /** 接口调用成功的回调函数 */
  17397. type GetBLEDeviceCharacteristicsSuccessCallback = (
  17398. result: GetBLEDeviceCharacteristicsSuccessCallbackResult
  17399. ) => void
  17400. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17401. type GetBLEDeviceRSSICompleteCallback = (res: GeneralCallbackResult) => void
  17402. /** 接口调用失败的回调函数 */
  17403. type GetBLEDeviceRSSIFailCallback = (res: GeneralCallbackResult) => void
  17404. /** 接口调用成功的回调函数 */
  17405. type GetBLEDeviceRSSISuccessCallback = (
  17406. result: GetBLEDeviceRSSISuccessCallbackResult
  17407. ) => void
  17408. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17409. type GetBLEDeviceServicesCompleteCallback = (res: BluetoothError) => void
  17410. /** 接口调用失败的回调函数 */
  17411. type GetBLEDeviceServicesFailCallback = (res: BluetoothError) => void
  17412. /** 接口调用成功的回调函数 */
  17413. type GetBLEDeviceServicesSuccessCallback = (
  17414. result: GetBLEDeviceServicesSuccessCallbackResult
  17415. ) => void
  17416. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17417. type GetBackgroundAudioPlayerStateCompleteCallback = (
  17418. res: GeneralCallbackResult
  17419. ) => void
  17420. /** 接口调用失败的回调函数 */
  17421. type GetBackgroundAudioPlayerStateFailCallback = (
  17422. res: GeneralCallbackResult
  17423. ) => void
  17424. /** 接口调用成功的回调函数 */
  17425. type GetBackgroundAudioPlayerStateSuccessCallback = (
  17426. result: GetBackgroundAudioPlayerStateSuccessCallbackResult
  17427. ) => void
  17428. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17429. type GetBackgroundFetchDataCompleteCallback = (
  17430. res: GeneralCallbackResult
  17431. ) => void
  17432. /** 接口调用失败的回调函数 */
  17433. type GetBackgroundFetchDataFailCallback = (
  17434. res: GeneralCallbackResult
  17435. ) => void
  17436. /** 接口调用成功的回调函数 */
  17437. type GetBackgroundFetchDataSuccessCallback = (
  17438. res: GeneralCallbackResult
  17439. ) => void
  17440. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17441. type GetBackgroundFetchTokenCompleteCallback = (
  17442. res: GeneralCallbackResult
  17443. ) => void
  17444. /** 接口调用失败的回调函数 */
  17445. type GetBackgroundFetchTokenFailCallback = (
  17446. res: GeneralCallbackResult
  17447. ) => void
  17448. /** 接口调用成功的回调函数 */
  17449. type GetBackgroundFetchTokenSuccessCallback = (
  17450. res: GeneralCallbackResult
  17451. ) => void
  17452. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17453. type GetBatteryInfoCompleteCallback = (res: GeneralCallbackResult) => void
  17454. /** 接口调用失败的回调函数 */
  17455. type GetBatteryInfoFailCallback = (res: GeneralCallbackResult) => void
  17456. /** 接口调用成功的回调函数 */
  17457. type GetBatteryInfoSuccessCallback = (
  17458. result: GetBatteryInfoSuccessCallbackResult
  17459. ) => void
  17460. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17461. type GetBeaconsCompleteCallback = (res: IBeaconError) => void
  17462. /** 接口调用失败的回调函数 */
  17463. type GetBeaconsFailCallback = (res: IBeaconError) => void
  17464. /** 接口调用成功的回调函数 */
  17465. type GetBeaconsSuccessCallback = (
  17466. result: GetBeaconsSuccessCallbackResult
  17467. ) => void
  17468. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17469. type GetBluetoothAdapterStateCompleteCallback = (
  17470. res: BluetoothError
  17471. ) => void
  17472. /** 接口调用失败的回调函数 */
  17473. type GetBluetoothAdapterStateFailCallback = (res: BluetoothError) => void
  17474. /** 接口调用成功的回调函数 */
  17475. type GetBluetoothAdapterStateSuccessCallback = (
  17476. result: GetBluetoothAdapterStateSuccessCallbackResult
  17477. ) => void
  17478. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17479. type GetBluetoothDevicesCompleteCallback = (res: BluetoothError) => void
  17480. /** 接口调用失败的回调函数 */
  17481. type GetBluetoothDevicesFailCallback = (res: BluetoothError) => void
  17482. /** 接口调用成功的回调函数 */
  17483. type GetBluetoothDevicesSuccessCallback = (
  17484. result: GetBluetoothDevicesSuccessCallbackResult
  17485. ) => void
  17486. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17487. type GetCenterLocationCompleteCallback = (
  17488. res: GeneralCallbackResult
  17489. ) => void
  17490. /** 接口调用失败的回调函数 */
  17491. type GetCenterLocationFailCallback = (res: GeneralCallbackResult) => void
  17492. /** 接口调用成功的回调函数 */
  17493. type GetCenterLocationSuccessCallback = (
  17494. result: GetCenterLocationSuccessCallbackResult
  17495. ) => void
  17496. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17497. type GetClipboardDataCompleteCallback = (res: GeneralCallbackResult) => void
  17498. /** 接口调用失败的回调函数 */
  17499. type GetClipboardDataFailCallback = (res: GeneralCallbackResult) => void
  17500. /** 接口调用成功的回调函数 */
  17501. type GetClipboardDataSuccessCallback = (
  17502. option: GetClipboardDataSuccessCallbackOption
  17503. ) => void
  17504. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17505. type GetConnectedBluetoothDevicesCompleteCallback = (
  17506. res: BluetoothError
  17507. ) => void
  17508. /** 接口调用失败的回调函数 */
  17509. type GetConnectedBluetoothDevicesFailCallback = (
  17510. res: BluetoothError
  17511. ) => void
  17512. /** 接口调用成功的回调函数 */
  17513. type GetConnectedBluetoothDevicesSuccessCallback = (
  17514. result: GetConnectedBluetoothDevicesSuccessCallbackResult
  17515. ) => void
  17516. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17517. type GetConnectedWifiCompleteCallback = (res: WifiError) => void
  17518. /** 接口调用失败的回调函数 */
  17519. type GetConnectedWifiFailCallback = (res: WifiError) => void
  17520. /** 接口调用成功的回调函数 */
  17521. type GetConnectedWifiSuccessCallback = (
  17522. result: GetConnectedWifiSuccessCallbackResult
  17523. ) => void
  17524. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17525. type GetContentsCompleteCallback = (res: GeneralCallbackResult) => void
  17526. /** 接口调用失败的回调函数 */
  17527. type GetContentsFailCallback = (res: GeneralCallbackResult) => void
  17528. /** 接口调用成功的回调函数 */
  17529. type GetContentsSuccessCallback = (
  17530. result: GetContentsSuccessCallbackResult
  17531. ) => void
  17532. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17533. type GetExtConfigCompleteCallback = (res: GeneralCallbackResult) => void
  17534. /** 接口调用失败的回调函数 */
  17535. type GetExtConfigFailCallback = (res: GeneralCallbackResult) => void
  17536. /** 接口调用成功的回调函数 */
  17537. type GetExtConfigSuccessCallback = (
  17538. result: GetExtConfigSuccessCallbackResult
  17539. ) => void
  17540. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17541. type GetFileInfoCompleteCallback = (res: GeneralCallbackResult) => void
  17542. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17543. type GetGroupEnterInfoCompleteCallback = (
  17544. res: GeneralCallbackResult
  17545. ) => void
  17546. /** 接口调用失败的回调函数 */
  17547. type GetGroupEnterInfoFailCallback = (res: GeneralCallbackResult) => void
  17548. /** 接口调用成功的回调函数 */
  17549. type GetGroupEnterInfoSuccessCallback = (
  17550. result: GetGroupEnterInfoSuccessCallbackResult
  17551. ) => void
  17552. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17553. type GetHCEStateCompleteCallback = (res: NFCError) => void
  17554. /** 接口调用失败的回调函数 */
  17555. type GetHCEStateFailCallback = (res: NFCError) => void
  17556. /** 接口调用成功的回调函数 */
  17557. type GetHCEStateSuccessCallback = (res: NFCError) => void
  17558. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17559. type GetHistoricalBytesCompleteCallback = (res: Nfcrwerror) => void
  17560. /** 接口调用失败的回调函数 */
  17561. type GetHistoricalBytesFailCallback = (res: Nfcrwerror) => void
  17562. /** 接口调用成功的回调函数 */
  17563. type GetHistoricalBytesSuccessCallback = (
  17564. result: GetHistoricalBytesSuccessCallbackResult
  17565. ) => void
  17566. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17567. type GetImageInfoCompleteCallback = (res: GeneralCallbackResult) => void
  17568. /** 接口调用失败的回调函数 */
  17569. type GetImageInfoFailCallback = (res: GeneralCallbackResult) => void
  17570. /** 接口调用成功的回调函数 */
  17571. type GetImageInfoSuccessCallback = (
  17572. result: GetImageInfoSuccessCallbackResult
  17573. ) => void
  17574. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17575. type GetLocationCompleteCallback = (res: GeneralCallbackResult) => void
  17576. /** 接口调用失败的回调函数 */
  17577. type GetLocationFailCallback = (res: GeneralCallbackResult) => void
  17578. /** 接口调用成功的回调函数 */
  17579. type GetLocationSuccessCallback = (
  17580. result: GetLocationSuccessCallbackResult
  17581. ) => void
  17582. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17583. type GetMaxTransceiveLengthCompleteCallback = (res: Nfcrwerror) => void
  17584. /** 接口调用失败的回调函数 */
  17585. type GetMaxTransceiveLengthFailCallback = (res: Nfcrwerror) => void
  17586. /** 接口调用成功的回调函数 */
  17587. type GetMaxTransceiveLengthSuccessCallback = (
  17588. result: GetMaxTransceiveLengthSuccessCallbackResult
  17589. ) => void
  17590. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17591. type GetNetworkTypeCompleteCallback = (res: GeneralCallbackResult) => void
  17592. /** 接口调用失败的回调函数 */
  17593. type GetNetworkTypeFailCallback = (res: GeneralCallbackResult) => void
  17594. /** 接口调用成功的回调函数 */
  17595. type GetNetworkTypeSuccessCallback = (
  17596. result: GetNetworkTypeSuccessCallbackResult
  17597. ) => void
  17598. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17599. type GetRandomValuesCompleteCallback = (res: GeneralCallbackResult) => void
  17600. /** 接口调用失败的回调函数 */
  17601. type GetRandomValuesFailCallback = (res: GeneralCallbackResult) => void
  17602. /** 接口调用成功的回调函数 */
  17603. type GetRandomValuesSuccessCallback = (
  17604. result: GetRandomValuesSuccessCallbackResult
  17605. ) => void
  17606. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17607. type GetRegionCompleteCallback = (res: GeneralCallbackResult) => void
  17608. /** 接口调用失败的回调函数 */
  17609. type GetRegionFailCallback = (res: GeneralCallbackResult) => void
  17610. /** 接口调用成功的回调函数 */
  17611. type GetRegionSuccessCallback = (
  17612. result: GetRegionSuccessCallbackResult
  17613. ) => void
  17614. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17615. type GetRotateCompleteCallback = (res: GeneralCallbackResult) => void
  17616. /** 接口调用失败的回调函数 */
  17617. type GetRotateFailCallback = (res: GeneralCallbackResult) => void
  17618. /** 接口调用成功的回调函数 */
  17619. type GetRotateSuccessCallback = (
  17620. result: GetRotateSuccessCallbackResult
  17621. ) => void
  17622. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17623. type GetSakCompleteCallback = (res: Nfcrwerror) => void
  17624. /** 接口调用失败的回调函数 */
  17625. type GetSakFailCallback = (res: Nfcrwerror) => void
  17626. /** 接口调用成功的回调函数 */
  17627. type GetSakSuccessCallback = (result: GetSakSuccessCallbackResult) => void
  17628. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17629. type GetSavedFileInfoCompleteCallback = (res: GeneralCallbackResult) => void
  17630. /** 接口调用失败的回调函数 */
  17631. type GetSavedFileInfoFailCallback = (res: GeneralCallbackResult) => void
  17632. /** 接口调用成功的回调函数 */
  17633. type GetSavedFileInfoSuccessCallback = (
  17634. result: GetSavedFileInfoSuccessCallbackResult
  17635. ) => void
  17636. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17637. type GetSavedFileListCompleteCallback = (res: GeneralCallbackResult) => void
  17638. /** 接口调用失败的回调函数 */
  17639. type GetSavedFileListFailCallback = (res: GeneralCallbackResult) => void
  17640. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17641. type GetScaleCompleteCallback = (res: GeneralCallbackResult) => void
  17642. /** 接口调用失败的回调函数 */
  17643. type GetScaleFailCallback = (res: GeneralCallbackResult) => void
  17644. /** 接口调用成功的回调函数 */
  17645. type GetScaleSuccessCallback = (
  17646. result: GetScaleSuccessCallbackResult
  17647. ) => void
  17648. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17649. type GetScreenBrightnessCompleteCallback = (
  17650. res: GeneralCallbackResult
  17651. ) => void
  17652. /** 接口调用失败的回调函数 */
  17653. type GetScreenBrightnessFailCallback = (res: GeneralCallbackResult) => void
  17654. /** 接口调用成功的回调函数 */
  17655. type GetScreenBrightnessSuccessCallback = (
  17656. option: GetScreenBrightnessSuccessCallbackOption
  17657. ) => void
  17658. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17659. type GetSelectedTextRangeCompleteCallback = (
  17660. res: GeneralCallbackResult
  17661. ) => void
  17662. /** 接口调用失败的回调函数 */
  17663. type GetSelectedTextRangeFailCallback = (res: GeneralCallbackResult) => void
  17664. /** 接口调用成功的回调函数 */
  17665. type GetSelectedTextRangeSuccessCallback = (
  17666. result: GetSelectedTextRangeSuccessCallbackResult
  17667. ) => void
  17668. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17669. type GetSelectionTextCompleteCallback = (res: GeneralCallbackResult) => void
  17670. /** 接口调用失败的回调函数 */
  17671. type GetSelectionTextFailCallback = (res: GeneralCallbackResult) => void
  17672. /** 接口调用成功的回调函数 */
  17673. type GetSelectionTextSuccessCallback = (
  17674. result: GetSelectionTextSuccessCallbackResult
  17675. ) => void
  17676. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17677. type GetSettingCompleteCallback = (res: GeneralCallbackResult) => void
  17678. /** 接口调用失败的回调函数 */
  17679. type GetSettingFailCallback = (res: GeneralCallbackResult) => void
  17680. /** 接口调用成功的回调函数 */
  17681. type GetSettingSuccessCallback = (
  17682. result: GetSettingSuccessCallbackResult
  17683. ) => void
  17684. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17685. type GetShareInfoCompleteCallback = (res: GeneralCallbackResult) => void
  17686. /** 接口调用失败的回调函数 */
  17687. type GetShareInfoFailCallback = (res: GeneralCallbackResult) => void
  17688. /** 接口调用成功的回调函数 */
  17689. type GetShareInfoSuccessCallback = (
  17690. result: GetGroupEnterInfoSuccessCallbackResult
  17691. ) => void
  17692. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17693. type GetSkewCompleteCallback = (res: GeneralCallbackResult) => void
  17694. /** 接口调用失败的回调函数 */
  17695. type GetSkewFailCallback = (res: GeneralCallbackResult) => void
  17696. /** 接口调用成功的回调函数 */
  17697. type GetSkewSuccessCallback = (result: GetSkewSuccessCallbackResult) => void
  17698. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17699. type GetStorageCompleteCallback = (res: GeneralCallbackResult) => void
  17700. /** 接口调用失败的回调函数 */
  17701. type GetStorageFailCallback = (res: GeneralCallbackResult) => void
  17702. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17703. type GetStorageInfoCompleteCallback = (res: GeneralCallbackResult) => void
  17704. /** 接口调用失败的回调函数 */
  17705. type GetStorageInfoFailCallback = (res: GeneralCallbackResult) => void
  17706. /** 接口调用成功的回调函数 */
  17707. type GetStorageInfoSuccessCallback = (
  17708. option: GetStorageInfoSuccessCallbackOption
  17709. ) => void
  17710. /** 接口调用成功的回调函数 */
  17711. type GetStorageSuccessCallback<T = any> = (
  17712. result: GetStorageSuccessCallbackResult<T>
  17713. ) => void
  17714. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17715. type GetSystemInfoAsyncCompleteCallback = (
  17716. res: GeneralCallbackResult
  17717. ) => void
  17718. /** 接口调用失败的回调函数 */
  17719. type GetSystemInfoAsyncFailCallback = (res: GeneralCallbackResult) => void
  17720. /** 接口调用成功的回调函数 */
  17721. type GetSystemInfoAsyncSuccessCallback = (result: SystemInfo) => void
  17722. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17723. type GetSystemInfoCompleteCallback = (res: GeneralCallbackResult) => void
  17724. /** 接口调用失败的回调函数 */
  17725. type GetSystemInfoFailCallback = (res: GeneralCallbackResult) => void
  17726. /** 接口调用成功的回调函数 */
  17727. type GetSystemInfoSuccessCallback = (result: SystemInfo) => void
  17728. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17729. type GetUserInfoCompleteCallback = (res: GeneralCallbackResult) => void
  17730. /** 接口调用失败的回调函数 */
  17731. type GetUserInfoFailCallback = (res: GeneralCallbackResult) => void
  17732. /** 接口调用成功的回调函数 */
  17733. type GetUserInfoSuccessCallback = (
  17734. result: GetUserInfoSuccessCallbackResult
  17735. ) => void
  17736. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17737. type GetUserProfileCompleteCallback = (res: GeneralCallbackResult) => void
  17738. /** 接口调用失败的回调函数 */
  17739. type GetUserProfileFailCallback = (res: GeneralCallbackResult) => void
  17740. /** 接口调用成功的回调函数 */
  17741. type GetUserProfileSuccessCallback = (
  17742. result: GetUserProfileSuccessCallbackResult
  17743. ) => void
  17744. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17745. type GetVideoInfoCompleteCallback = (res: GeneralCallbackResult) => void
  17746. /** 接口调用失败的回调函数 */
  17747. type GetVideoInfoFailCallback = (res: GeneralCallbackResult) => void
  17748. /** 接口调用成功的回调函数 */
  17749. type GetVideoInfoSuccessCallback = (
  17750. result: GetVideoInfoSuccessCallbackResult
  17751. ) => void
  17752. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17753. type GetWeRunDataCompleteCallback = (res: GeneralCallbackResult) => void
  17754. /** 接口调用失败的回调函数 */
  17755. type GetWeRunDataFailCallback = (res: GeneralCallbackResult) => void
  17756. /** 接口调用成功的回调函数 */
  17757. type GetWeRunDataSuccessCallback = (
  17758. result: GetWeRunDataSuccessCallbackResult
  17759. ) => void
  17760. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17761. type GetWifiListCompleteCallback = (res: WifiError) => void
  17762. /** 接口调用失败的回调函数 */
  17763. type GetWifiListFailCallback = (res: WifiError) => void
  17764. /** 接口调用成功的回调函数 */
  17765. type GetWifiListSuccessCallback = (res: WifiError) => void
  17766. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17767. type HideHomeButtonCompleteCallback = (res: GeneralCallbackResult) => void
  17768. /** 接口调用失败的回调函数 */
  17769. type HideHomeButtonFailCallback = (res: GeneralCallbackResult) => void
  17770. /** 接口调用成功的回调函数 */
  17771. type HideHomeButtonSuccessCallback = (res: GeneralCallbackResult) => void
  17772. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17773. type HideKeyboardCompleteCallback = (res: GeneralCallbackResult) => void
  17774. /** 接口调用失败的回调函数 */
  17775. type HideKeyboardFailCallback = (res: GeneralCallbackResult) => void
  17776. /** 接口调用成功的回调函数 */
  17777. type HideKeyboardSuccessCallback = (res: GeneralCallbackResult) => void
  17778. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17779. type HideLoadingCompleteCallback = (res: GeneralCallbackResult) => void
  17780. /** 接口调用失败的回调函数 */
  17781. type HideLoadingFailCallback = (res: GeneralCallbackResult) => void
  17782. /** 接口调用成功的回调函数 */
  17783. type HideLoadingSuccessCallback = (res: GeneralCallbackResult) => void
  17784. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17785. type HideNavigationBarLoadingCompleteCallback = (
  17786. res: GeneralCallbackResult
  17787. ) => void
  17788. /** 接口调用失败的回调函数 */
  17789. type HideNavigationBarLoadingFailCallback = (
  17790. res: GeneralCallbackResult
  17791. ) => void
  17792. /** 接口调用成功的回调函数 */
  17793. type HideNavigationBarLoadingSuccessCallback = (
  17794. res: GeneralCallbackResult
  17795. ) => void
  17796. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17797. type HideShareMenuCompleteCallback = (res: GeneralCallbackResult) => void
  17798. /** 接口调用失败的回调函数 */
  17799. type HideShareMenuFailCallback = (res: GeneralCallbackResult) => void
  17800. /** 接口调用成功的回调函数 */
  17801. type HideShareMenuSuccessCallback = (res: GeneralCallbackResult) => void
  17802. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17803. type HideTabBarCompleteCallback = (res: GeneralCallbackResult) => void
  17804. /** 接口调用失败的回调函数 */
  17805. type HideTabBarFailCallback = (res: GeneralCallbackResult) => void
  17806. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17807. type HideTabBarRedDotCompleteCallback = (res: GeneralCallbackResult) => void
  17808. /** 接口调用失败的回调函数 */
  17809. type HideTabBarRedDotFailCallback = (res: GeneralCallbackResult) => void
  17810. /** 接口调用成功的回调函数 */
  17811. type HideTabBarRedDotSuccessCallback = (res: GeneralCallbackResult) => void
  17812. /** 接口调用成功的回调函数 */
  17813. type HideTabBarSuccessCallback = (res: GeneralCallbackResult) => void
  17814. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17815. type HideToastCompleteCallback = (res: GeneralCallbackResult) => void
  17816. /** 接口调用失败的回调函数 */
  17817. type HideToastFailCallback = (res: GeneralCallbackResult) => void
  17818. /** 接口调用成功的回调函数 */
  17819. type HideToastSuccessCallback = (res: GeneralCallbackResult) => void
  17820. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17821. type IncludePointsCompleteCallback = (res: GeneralCallbackResult) => void
  17822. /** 接口调用失败的回调函数 */
  17823. type IncludePointsFailCallback = (res: GeneralCallbackResult) => void
  17824. /** 接口调用成功的回调函数 */
  17825. type IncludePointsSuccessCallback = (res: GeneralCallbackResult) => void
  17826. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17827. type InitMarkerClusterCompleteCallback = (
  17828. res: GeneralCallbackResult
  17829. ) => void
  17830. /** 接口调用失败的回调函数 */
  17831. type InitMarkerClusterFailCallback = (res: GeneralCallbackResult) => void
  17832. /** 接口调用成功的回调函数 */
  17833. type InitMarkerClusterSuccessCallback = (res: GeneralCallbackResult) => void
  17834. /** 音频播放错误事件的回调函数 */
  17835. type InnerAudioContextOffErrorCallback = (
  17836. result: InnerAudioContextOnErrorCallbackResult
  17837. ) => void
  17838. /** 音频播放错误事件的回调函数 */
  17839. type InnerAudioContextOnErrorCallback = (
  17840. result: InnerAudioContextOnErrorCallbackResult
  17841. ) => void
  17842. type InnerAudioContextOnStopCallback = (res: GeneralCallbackResult) => void
  17843. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17844. type InsertDividerCompleteCallback = (res: GeneralCallbackResult) => void
  17845. /** 接口调用失败的回调函数 */
  17846. type InsertDividerFailCallback = (res: GeneralCallbackResult) => void
  17847. /** 接口调用成功的回调函数 */
  17848. type InsertDividerSuccessCallback = (res: GeneralCallbackResult) => void
  17849. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17850. type InsertImageCompleteCallback = (res: GeneralCallbackResult) => void
  17851. /** 接口调用失败的回调函数 */
  17852. type InsertImageFailCallback = (res: GeneralCallbackResult) => void
  17853. /** 接口调用成功的回调函数 */
  17854. type InsertImageSuccessCallback = (res: GeneralCallbackResult) => void
  17855. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17856. type InsertTextCompleteCallback = (res: GeneralCallbackResult) => void
  17857. /** 接口调用失败的回调函数 */
  17858. type InsertTextFailCallback = (res: GeneralCallbackResult) => void
  17859. /** 接口调用成功的回调函数 */
  17860. type InsertTextSuccessCallback = (res: GeneralCallbackResult) => void
  17861. /** 监听相交状态变化的回调函数 */
  17862. type IntersectionObserverObserveCallback = (
  17863. result: IntersectionObserverObserveCallbackResult
  17864. ) => void
  17865. /** 插屏错误事件的回调函数 */
  17866. type InterstitialAdOffErrorCallback = (
  17867. result: InterstitialAdOnErrorCallbackResult
  17868. ) => void
  17869. /** 插屏错误事件的回调函数 */
  17870. type InterstitialAdOnErrorCallback = (
  17871. result: InterstitialAdOnErrorCallbackResult
  17872. ) => void
  17873. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17874. type IsConnectedCompleteCallback = (res: Nfcrwerror) => void
  17875. /** 接口调用失败的回调函数 */
  17876. type IsConnectedFailCallback = (res: Nfcrwerror) => void
  17877. /** 接口调用成功的回调函数 */
  17878. type IsConnectedSuccessCallback = (res: Nfcrwerror) => void
  17879. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17880. type JoinVoIPChatCompleteCallback = (res: JoinVoIPChatError) => void
  17881. /** 接口调用失败的回调函数 */
  17882. type JoinVoIPChatFailCallback = (res: JoinVoIPChatError) => void
  17883. /** 接口调用成功的回调函数 */
  17884. type JoinVoIPChatSuccessCallback = (
  17885. result: JoinVoIPChatSuccessCallbackResult
  17886. ) => void
  17887. /** 接口调用成功的回调函数 */
  17888. type LivePlayerContextSnapshotSuccessCallback = (
  17889. result: LivePlayerContextSnapshotSuccessCallbackResult
  17890. ) => void
  17891. /** 接口调用成功的回调函数 */
  17892. type LivePusherContextSnapshotSuccessCallback = (
  17893. result: LivePusherContextSnapshotSuccessCallbackResult
  17894. ) => void
  17895. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17896. type LoadFontFaceCompleteCallback = (
  17897. result: LoadFontFaceCompleteCallbackResult
  17898. ) => void
  17899. /** 接口调用失败的回调函数 */
  17900. type LoadFontFaceFailCallback = (
  17901. result: LoadFontFaceCompleteCallbackResult
  17902. ) => void
  17903. /** 接口调用成功的回调函数 */
  17904. type LoadFontFaceSuccessCallback = (
  17905. result: LoadFontFaceCompleteCallbackResult
  17906. ) => void
  17907. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17908. type LoginCompleteCallback = (res: GeneralCallbackResult) => void
  17909. /** 接口调用失败的回调函数 */
  17910. type LoginFailCallback = (res: GeneralCallbackResult) => void
  17911. /** 接口调用成功的回调函数 */
  17912. type LoginSuccessCallback = (result: LoginSuccessCallbackResult) => void
  17913. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17914. type MakeBluetoothPairCompleteCallback = (
  17915. res: GeneralCallbackResult
  17916. ) => void
  17917. /** 接口调用失败的回调函数 */
  17918. type MakeBluetoothPairFailCallback = (res: GeneralCallbackResult) => void
  17919. /** 接口调用成功的回调函数 */
  17920. type MakeBluetoothPairSuccessCallback = (res: GeneralCallbackResult) => void
  17921. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17922. type MakePhoneCallCompleteCallback = (res: GeneralCallbackResult) => void
  17923. /** 接口调用失败的回调函数 */
  17924. type MakePhoneCallFailCallback = (res: GeneralCallbackResult) => void
  17925. /** 接口调用成功的回调函数 */
  17926. type MakePhoneCallSuccessCallback = (res: GeneralCallbackResult) => void
  17927. /** 监听 media query 状态变化的回调函数 */
  17928. type MediaQueryObserverObserveCallback = (
  17929. result: MediaQueryObserverObserveCallbackResult
  17930. ) => void
  17931. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17932. type MkdirCompleteCallback = (res: GeneralCallbackResult) => void
  17933. /** 接口调用失败的回调函数 */
  17934. type MkdirFailCallback = (result: MkdirFailCallbackResult) => void
  17935. /** 接口调用成功的回调函数 */
  17936. type MkdirSuccessCallback = (res: GeneralCallbackResult) => void
  17937. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17938. type MoveAlongCompleteCallback = (res: GeneralCallbackResult) => void
  17939. /** 接口调用失败的回调函数 */
  17940. type MoveAlongFailCallback = (res: GeneralCallbackResult) => void
  17941. /** 接口调用成功的回调函数 */
  17942. type MoveAlongSuccessCallback = (res: GeneralCallbackResult) => void
  17943. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17944. type MoveToLocationCompleteCallback = (res: GeneralCallbackResult) => void
  17945. /** 接口调用失败的回调函数 */
  17946. type MoveToLocationFailCallback = (res: GeneralCallbackResult) => void
  17947. /** 接口调用成功的回调函数 */
  17948. type MoveToLocationSuccessCallback = (res: GeneralCallbackResult) => void
  17949. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17950. type MuteCompleteCallback = (res: GeneralCallbackResult) => void
  17951. /** 接口调用失败的回调函数 */
  17952. type MuteFailCallback = (res: GeneralCallbackResult) => void
  17953. /** 接口调用成功的回调函数 */
  17954. type MuteSuccessCallback = (res: GeneralCallbackResult) => void
  17955. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17956. type NavigateBackCompleteCallback = (res: GeneralCallbackResult) => void
  17957. /** 接口调用失败的回调函数 */
  17958. type NavigateBackFailCallback = (res: GeneralCallbackResult) => void
  17959. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17960. type NavigateBackMiniProgramCompleteCallback = (
  17961. res: GeneralCallbackResult
  17962. ) => void
  17963. /** 接口调用失败的回调函数 */
  17964. type NavigateBackMiniProgramFailCallback = (
  17965. res: GeneralCallbackResult
  17966. ) => void
  17967. /** 接口调用成功的回调函数 */
  17968. type NavigateBackMiniProgramSuccessCallback = (
  17969. res: GeneralCallbackResult
  17970. ) => void
  17971. /** 接口调用成功的回调函数 */
  17972. type NavigateBackSuccessCallback = (res: GeneralCallbackResult) => void
  17973. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17974. type NavigateToCompleteCallback = (res: GeneralCallbackResult) => void
  17975. /** 接口调用失败的回调函数 */
  17976. type NavigateToFailCallback = (res: GeneralCallbackResult) => void
  17977. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17978. type NavigateToMiniProgramCompleteCallback = (
  17979. res: GeneralCallbackResult
  17980. ) => void
  17981. /** 接口调用失败的回调函数 */
  17982. type NavigateToMiniProgramFailCallback = (
  17983. res: GeneralCallbackResult
  17984. ) => void
  17985. /** 接口调用成功的回调函数 */
  17986. type NavigateToMiniProgramSuccessCallback = (
  17987. res: GeneralCallbackResult
  17988. ) => void
  17989. /** 接口调用成功的回调函数 */
  17990. type NavigateToSuccessCallback = (
  17991. result: NavigateToSuccessCallbackResult
  17992. ) => void
  17993. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  17994. type NdefCloseCompleteCallback = (res: Nfcrwerror) => void
  17995. /** 接口调用失败的回调函数 */
  17996. type NdefCloseFailCallback = (res: Nfcrwerror) => void
  17997. /** 接口调用成功的回调函数 */
  17998. type NdefCloseSuccessCallback = (res: Nfcrwerror) => void
  17999. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,返回节点信息。 */
  18000. type NodeCallback = (result: NodeCallbackResult) => void
  18001. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18002. type NotifyBLECharacteristicValueChangeCompleteCallback = (
  18003. res: BluetoothError
  18004. ) => void
  18005. /** 接口调用失败的回调函数 */
  18006. type NotifyBLECharacteristicValueChangeFailCallback = (
  18007. res: BluetoothError
  18008. ) => void
  18009. /** 接口调用成功的回调函数 */
  18010. type NotifyBLECharacteristicValueChangeSuccessCallback = (
  18011. res: BluetoothError
  18012. ) => void
  18013. /** 小程序切后台事件的回调函数 */
  18014. type OffAppHideCallback = (res: GeneralCallbackResult) => void
  18015. /** 小程序切前台事件的回调函数 */
  18016. type OffAppShowCallback = (result: OnAppShowCallbackResult) => void
  18017. /** 音频因为受到系统占用而被中断开始事件的回调函数 */
  18018. type OffAudioInterruptionBeginCallback = (
  18019. res: GeneralCallbackResult
  18020. ) => void
  18021. /** 音频中断结束事件的回调函数 */
  18022. type OffAudioInterruptionEndCallback = (res: GeneralCallbackResult) => void
  18023. /** 当前外围设备被连接或断开连接事件的回调函数 */
  18024. type OffBLEPeripheralConnectionStateChangedCallback = (
  18025. result: OnBLEPeripheralConnectionStateChangedCallbackResult
  18026. ) => void
  18027. /** iBeacon 服务状态变化事件的回调函数 */
  18028. type OffBeaconServiceChangeCallback = (res: GeneralCallbackResult) => void
  18029. /** iBeacon 设备更新事件的回调函数 */
  18030. type OffBeaconUpdateCallback = (res: GeneralCallbackResult) => void
  18031. /** 音频进入可以播放状态的事件的回调函数 */
  18032. type OffCanplayCallback = (res: GeneralCallbackResult) => void
  18033. /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */
  18034. type OffCharacteristicReadRequestCallback = (
  18035. result: OnCharacteristicReadRequestCallbackResult
  18036. ) => void
  18037. /** 特征值订阅事件的回调函数 */
  18038. type OffCharacteristicSubscribedCallback = (
  18039. result: OnCharacteristicSubscribedCallbackResult
  18040. ) => void
  18041. /** 取消特征值订阅事件的回调函数 */
  18042. type OffCharacteristicUnsubscribedCallback = (
  18043. result: OnCharacteristicSubscribedCallbackResult
  18044. ) => void
  18045. /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */
  18046. type OffCharacteristicWriteRequestCallback = (
  18047. result: OnCharacteristicWriteRequestCallbackResult
  18048. ) => void
  18049. /** 用户点击右上角菜单的「复制链接」按钮时触发的事件的回调函数 */
  18050. type OffCopyUrlCallback = (result: OnCopyUrlCallbackResult) => void
  18051. /** 的回调函数 */
  18052. type OffDiscoveredCallback = (result: OnDiscoveredCallbackResult) => void
  18053. /** 音频自然播放至结束的事件的回调函数 */
  18054. type OffEndedCallback = (res: GeneralCallbackResult) => void
  18055. /** HTTP Response Header 事件的回调函数 */
  18056. type OffHeadersReceivedCallback = (
  18057. result: OnHeadersReceivedCallbackResult
  18058. ) => void
  18059. /** 开始监听数据包消息的事件的回调函数 */
  18060. type OffListeningCallback = (res: GeneralCallbackResult) => void
  18061. type OffLoadCallback = (res: GeneralCallbackResult) => void
  18062. /** mDNS 服务停止搜索的事件的回调函数 */
  18063. type OffLocalServiceDiscoveryStopCallback = (
  18064. res: GeneralCallbackResult
  18065. ) => void
  18066. /** mDNS 服务发现的事件的回调函数 */
  18067. type OffLocalServiceFoundCallback = (
  18068. result: OnLocalServiceFoundCallbackResult
  18069. ) => void
  18070. /** mDNS 服务离开的事件的回调函数 */
  18071. type OffLocalServiceLostCallback = (
  18072. result: OnLocalServiceLostCallbackResult
  18073. ) => void
  18074. /** mDNS 服务解析失败的事件的回调函数 */
  18075. type OffLocalServiceResolveFailCallback = (
  18076. result: OnLocalServiceLostCallbackResult
  18077. ) => void
  18078. /** 实时地理位置变化事件的回调函数 */
  18079. type OffLocationChangeCallback = (
  18080. result: OnLocationChangeCallbackResult
  18081. ) => void
  18082. /** 收到消息的事件的回调函数 */
  18083. type OffMessageCallback = (result: UDPSocketOnMessageCallbackResult) => void
  18084. /** 小程序要打开的页面不存在事件的回调函数 */
  18085. type OffPageNotFoundCallback = (
  18086. result: OnPageNotFoundCallbackResult
  18087. ) => void
  18088. /** 音频暂停事件的回调函数 */
  18089. type OffPauseCallback = (res: GeneralCallbackResult) => void
  18090. /** 音频播放事件的回调函数 */
  18091. type OffPlayCallback = (res: GeneralCallbackResult) => void
  18092. /** 音频完成跳转操作的事件的回调函数 */
  18093. type OffSeekedCallback = (res: GeneralCallbackResult) => void
  18094. /** 音频进行跳转操作的事件的回调函数 */
  18095. type OffSeekingCallback = (res: GeneralCallbackResult) => void
  18096. /** 音频停止事件的回调函数 */
  18097. type OffStopCallback = (res: GeneralCallbackResult) => void
  18098. /** 系统主题改变事件的回调函数 */
  18099. type OffThemeChangeCallback = (result: OnThemeChangeCallbackResult) => void
  18100. /** 音频播放进度更新事件的回调函数 */
  18101. type OffTimeUpdateCallback = (res: GeneralCallbackResult) => void
  18102. /** 未处理的 Promise 拒绝事件的回调函数 */
  18103. type OffUnhandledRejectionCallback = (
  18104. result: OnUnhandledRejectionCallbackResult
  18105. ) => void
  18106. /** 实时语音通话成员视频状态变化事件的回调函数 */
  18107. type OffVoIPVideoMembersChangedCallback = (
  18108. result: OnVoIPVideoMembersChangedCallbackResult
  18109. ) => void
  18110. /** 音频加载中事件的回调函数 */
  18111. type OffWaitingCallback = (res: GeneralCallbackResult) => void
  18112. /** 窗口尺寸变化事件的回调函数 */
  18113. type OffWindowResizeCallback = (
  18114. result: OnWindowResizeCallbackResult
  18115. ) => void
  18116. /** 加速度数据事件的回调函数 */
  18117. type OnAccelerometerChangeCallback = (
  18118. result: OnAccelerometerChangeCallbackResult
  18119. ) => void
  18120. /** 小程序错误事件的回调函数 */
  18121. type OnAppErrorCallback = (
  18122. /** 错误信息,包含堆栈 */
  18123. error: string
  18124. ) => void
  18125. /** 小程序切后台事件的回调函数 */
  18126. type OnAppHideCallback = (res: GeneralCallbackResult) => void
  18127. /** 小程序切前台事件的回调函数 */
  18128. type OnAppShowCallback = (result: OnAppShowCallbackResult) => void
  18129. /** 音频因为受到系统占用而被中断开始事件的回调函数 */
  18130. type OnAudioInterruptionBeginCallback = (res: GeneralCallbackResult) => void
  18131. /** 音频中断结束事件的回调函数 */
  18132. type OnAudioInterruptionEndCallback = (res: GeneralCallbackResult) => void
  18133. /** 低功耗蓝牙设备的特征值变化事件的回调函数 */
  18134. type OnBLECharacteristicValueChangeCallback = (
  18135. result: OnBLECharacteristicValueChangeCallbackResult
  18136. ) => void
  18137. /** 低功耗蓝牙连接状态的改变事件的回调函数 */
  18138. type OnBLEConnectionStateChangeCallback = (
  18139. result: OnBLEConnectionStateChangeCallbackResult
  18140. ) => void
  18141. /** 当前外围设备被连接或断开连接事件的回调函数 */
  18142. type OnBLEPeripheralConnectionStateChangedCallback = (
  18143. result: OnBLEPeripheralConnectionStateChangedCallbackResult
  18144. ) => void
  18145. /** 音乐暂停事件的回调函数 */
  18146. type OnBackgroundAudioPauseCallback = (res: GeneralCallbackResult) => void
  18147. /** 音乐播放事件的回调函数 */
  18148. type OnBackgroundAudioPlayCallback = (res: GeneralCallbackResult) => void
  18149. /** 音乐停止事件的回调函数 */
  18150. type OnBackgroundAudioStopCallback = (res: GeneralCallbackResult) => void
  18151. /** 的回调函数 */
  18152. type OnBackgroundFetchDataCallback = (
  18153. result: OnBackgroundFetchDataCallbackResult
  18154. ) => void
  18155. /** iBeacon 服务状态变化事件的回调函数 */
  18156. type OnBeaconServiceChangeCallback = (
  18157. result: OnBeaconServiceChangeCallbackResult
  18158. ) => void
  18159. /** iBeacon 设备更新事件的回调函数 */
  18160. type OnBeaconUpdateCallback = (result: OnBeaconUpdateCallbackResult) => void
  18161. /** 蓝牙适配器状态变化事件的回调函数 */
  18162. type OnBluetoothAdapterStateChangeCallback = (
  18163. result: OnBluetoothAdapterStateChangeCallbackResult
  18164. ) => void
  18165. /** 寻找到新设备的事件的回调函数 */
  18166. type OnBluetoothDeviceFoundCallback = (
  18167. result: OnBluetoothDeviceFoundCallbackResult
  18168. ) => void
  18169. /** 回调函数 */
  18170. type OnCameraFrameCallback = (result: OnCameraFrameCallbackResult) => void
  18171. type OnCanplayCallback = (res: GeneralCallbackResult) => void
  18172. /** 已连接的设备请求读当前外围设备的特征值事件的回调函数 */
  18173. type OnCharacteristicReadRequestCallback = (
  18174. result: OnCharacteristicReadRequestCallbackResult
  18175. ) => void
  18176. /** 特征值订阅事件的回调函数 */
  18177. type OnCharacteristicSubscribedCallback = (
  18178. result: OnCharacteristicSubscribedCallbackResult
  18179. ) => void
  18180. /** 取消特征值订阅事件的回调函数 */
  18181. type OnCharacteristicUnsubscribedCallback = (
  18182. result: OnCharacteristicSubscribedCallbackResult
  18183. ) => void
  18184. /** 已连接的设备请求写当前外围设备的特征值事件的回调函数 */
  18185. type OnCharacteristicWriteRequestCallback = (
  18186. result: OnCharacteristicWriteRequestCallbackResult
  18187. ) => void
  18188. /** 向微信后台请求检查更新结果事件的回调函数 */
  18189. type OnCheckForUpdateCallback = (
  18190. result: OnCheckForUpdateCallbackResult
  18191. ) => void
  18192. /** 罗盘数据变化事件的回调函数 */
  18193. type OnCompassChangeCallback = (
  18194. result: OnCompassChangeCallbackResult
  18195. ) => void
  18196. /** 用户点击右上角菜单的「复制链接」按钮时触发的事件的回调函数 */
  18197. type OnCopyUrlCallback = (result: OnCopyUrlCallbackResult) => void
  18198. /** 设备方向变化事件的回调函数 */
  18199. type OnDeviceMotionChangeCallback = (
  18200. result: OnDeviceMotionChangeCallbackResult
  18201. ) => void
  18202. /** 的回调函数 */
  18203. type OnDiscoveredCallback = (result: OnDiscoveredCallbackResult) => void
  18204. type OnEndedCallback = (res: GeneralCallbackResult) => void
  18205. /** 已录制完指定帧大小的文件事件的回调函数 */
  18206. type OnFrameRecordedCallback = (
  18207. result: OnFrameRecordedCallbackResult
  18208. ) => void
  18209. /** 获取到 Wi-Fi 列表数据事件的回调函数 */
  18210. type OnGetWifiListCallback = (result: OnGetWifiListCallbackResult) => void
  18211. /** 陀螺仪数据变化事件的回调函数 */
  18212. type OnGyroscopeChangeCallback = (
  18213. result: OnGyroscopeChangeCallbackResult
  18214. ) => void
  18215. /** 接收 NFC 设备消息事件的回调函数 */
  18216. type OnHCEMessageCallback = (result: OnHCEMessageCallbackResult) => void
  18217. /** HTTP Response Header 事件的回调函数 */
  18218. type OnHeadersReceivedCallback = (
  18219. result: OnHeadersReceivedCallbackResult
  18220. ) => void
  18221. /** 录音因为受到系统占用而被中断开始事件的回调函数 */
  18222. type OnInterruptionBeginCallback = (res: GeneralCallbackResult) => void
  18223. /** 录音中断结束事件的回调函数 */
  18224. type OnInterruptionEndCallback = (res: GeneralCallbackResult) => void
  18225. type OnKeyboardHeightChangeCallback = (
  18226. result: OnKeyboardHeightChangeCallbackResult
  18227. ) => void
  18228. /** 开始监听数据包消息的事件的回调函数 */
  18229. type OnListeningCallback = (res: GeneralCallbackResult) => void
  18230. type OnLoadCallback = (res: GeneralCallbackResult) => void
  18231. /** mDNS 服务停止搜索的事件的回调函数 */
  18232. type OnLocalServiceDiscoveryStopCallback = (
  18233. res: GeneralCallbackResult
  18234. ) => void
  18235. /** mDNS 服务发现的事件的回调函数 */
  18236. type OnLocalServiceFoundCallback = (
  18237. result: OnLocalServiceFoundCallbackResult
  18238. ) => void
  18239. /** mDNS 服务离开的事件的回调函数 */
  18240. type OnLocalServiceLostCallback = (
  18241. result: OnLocalServiceLostCallbackResult
  18242. ) => void
  18243. /** mDNS 服务解析失败的事件的回调函数 */
  18244. type OnLocalServiceResolveFailCallback = (
  18245. result: OnLocalServiceLostCallbackResult
  18246. ) => void
  18247. /** 实时地理位置变化事件的回调函数 */
  18248. type OnLocationChangeCallback = (
  18249. result: OnLocationChangeCallbackResult
  18250. ) => void
  18251. /** 内存不足告警事件的回调函数 */
  18252. type OnMemoryWarningCallback = (
  18253. result: OnMemoryWarningCallbackResult
  18254. ) => void
  18255. /** 网络状态变化事件的回调函数 */
  18256. type OnNetworkStatusChangeCallback = (
  18257. result: OnNetworkStatusChangeCallbackResult
  18258. ) => void
  18259. /** 用户在系统音乐播放面板点击下一曲事件的回调函数 */
  18260. type OnNextCallback = (res: GeneralCallbackResult) => void
  18261. /** WebSocket 连接打开事件的回调函数 */
  18262. type OnOpenCallback = (result: OnOpenCallbackResult) => void
  18263. /** 小程序要打开的页面不存在事件的回调函数 */
  18264. type OnPageNotFoundCallback = (result: OnPageNotFoundCallbackResult) => void
  18265. type OnPauseCallback = (res: GeneralCallbackResult) => void
  18266. type OnPlayCallback = (res: GeneralCallbackResult) => void
  18267. /** 用户在系统音乐播放面板点击上一曲事件的回调函数 */
  18268. type OnPrevCallback = (res: GeneralCallbackResult) => void
  18269. /** worker进程被系统回收事件的回调函数 */
  18270. type OnProcessKilledCallback = (res: GeneralCallbackResult) => void
  18271. /** 录音继续事件的回调函数 */
  18272. type OnResumeCallback = (res: GeneralCallbackResult) => void
  18273. type OnSeekedCallback = (res: GeneralCallbackResult) => void
  18274. type OnSeekingCallback = (res: GeneralCallbackResult) => void
  18275. /** WebSocket 连接关闭事件的回调函数 */
  18276. type OnSocketCloseCallback = (
  18277. result: SocketTaskOnCloseCallbackResult
  18278. ) => void
  18279. /** WebSocket 错误事件的回调函数 */
  18280. type OnSocketErrorCallback = (
  18281. result: UDPSocketOnErrorCallbackResult
  18282. ) => void
  18283. /** WebSocket 接受到服务器的消息事件的回调函数 */
  18284. type OnSocketMessageCallback = (
  18285. result: SocketTaskOnMessageCallbackResult
  18286. ) => void
  18287. /** WebSocket 连接打开事件的回调函数 */
  18288. type OnSocketOpenCallback = (result: OnSocketOpenCallbackResult) => void
  18289. /** 录音开始事件的回调函数 */
  18290. type OnStartCallback = (res: GeneralCallbackResult) => void
  18291. /** 系统主题改变事件的回调函数 */
  18292. type OnThemeChangeCallback = (result: OnThemeChangeCallbackResult) => void
  18293. type OnTimeUpdateCallback = (res: GeneralCallbackResult) => void
  18294. /** 未处理的 Promise 拒绝事件的回调函数 */
  18295. type OnUnhandledRejectionCallback = (
  18296. result: OnUnhandledRejectionCallbackResult
  18297. ) => void
  18298. /** 小程序更新失败事件的回调函数 */
  18299. type OnUpdateFailedCallback = (res: GeneralCallbackResult) => void
  18300. /** 小程序有版本更新事件的回调函数 */
  18301. type OnUpdateReadyCallback = (res: GeneralCallbackResult) => void
  18302. /** 用户主动截屏事件的回调函数 */
  18303. type OnUserCaptureScreenCallback = (res: GeneralCallbackResult) => void
  18304. /** 被动断开实时语音通话事件的回调函数 */
  18305. type OnVoIPChatInterruptedCallback = (
  18306. result: OnVoIPChatInterruptedCallbackResult
  18307. ) => void
  18308. /** 实时语音通话成员在线状态变化事件的回调函数 */
  18309. type OnVoIPChatMembersChangedCallback = (
  18310. result: OnVoIPChatMembersChangedCallbackResult
  18311. ) => void
  18312. /** 实时语音通话成员通话状态变化事件的回调函数 */
  18313. type OnVoIPChatSpeakersChangedCallback = (
  18314. result: OnVoIPChatSpeakersChangedCallbackResult
  18315. ) => void
  18316. /** 实时语音通话成员视频状态变化事件的回调函数 */
  18317. type OnVoIPVideoMembersChangedCallback = (
  18318. result: OnVoIPVideoMembersChangedCallbackResult
  18319. ) => void
  18320. /** 音频加载中事件的回调函数 */
  18321. type OnWaitingCallback = (res: GeneralCallbackResult) => void
  18322. /** 连接上 Wi-Fi 的事件的回调函数 */
  18323. type OnWifiConnectedCallback = (
  18324. result: OnWifiConnectedCallbackResult
  18325. ) => void
  18326. /** 窗口尺寸变化事件的回调函数 */
  18327. type OnWindowResizeCallback = (result: OnWindowResizeCallbackResult) => void
  18328. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18329. type OpenBluetoothAdapterCompleteCallback = (res: BluetoothError) => void
  18330. /** 接口调用失败的回调函数 */
  18331. type OpenBluetoothAdapterFailCallback = (res: BluetoothError) => void
  18332. /** 接口调用成功的回调函数 */
  18333. type OpenBluetoothAdapterSuccessCallback = (res: BluetoothError) => void
  18334. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18335. type OpenCardCompleteCallback = (res: GeneralCallbackResult) => void
  18336. /** 接口调用失败的回调函数 */
  18337. type OpenCardFailCallback = (res: GeneralCallbackResult) => void
  18338. /** 接口调用成功的回调函数 */
  18339. type OpenCardSuccessCallback = (res: GeneralCallbackResult) => void
  18340. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18341. type OpenDocumentCompleteCallback = (res: GeneralCallbackResult) => void
  18342. /** 接口调用失败的回调函数 */
  18343. type OpenDocumentFailCallback = (res: GeneralCallbackResult) => void
  18344. /** 接口调用成功的回调函数 */
  18345. type OpenDocumentSuccessCallback = (res: GeneralCallbackResult) => void
  18346. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18347. type OpenLocationCompleteCallback = (res: GeneralCallbackResult) => void
  18348. /** 接口调用失败的回调函数 */
  18349. type OpenLocationFailCallback = (res: GeneralCallbackResult) => void
  18350. /** 接口调用成功的回调函数 */
  18351. type OpenLocationSuccessCallback = (res: GeneralCallbackResult) => void
  18352. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18353. type OpenMapAppCompleteCallback = (res: GeneralCallbackResult) => void
  18354. /** 接口调用失败的回调函数 */
  18355. type OpenMapAppFailCallback = (res: GeneralCallbackResult) => void
  18356. /** 接口调用成功的回调函数 */
  18357. type OpenMapAppSuccessCallback = (res: GeneralCallbackResult) => void
  18358. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18359. type OpenSettingCompleteCallback = (res: GeneralCallbackResult) => void
  18360. /** 接口调用失败的回调函数 */
  18361. type OpenSettingFailCallback = (res: GeneralCallbackResult) => void
  18362. /** 接口调用成功的回调函数 */
  18363. type OpenSettingSuccessCallback = (
  18364. result: OpenSettingSuccessCallbackResult
  18365. ) => void
  18366. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18367. type OpenVideoEditorCompleteCallback = (res: GeneralCallbackResult) => void
  18368. /** 接口调用失败的回调函数 */
  18369. type OpenVideoEditorFailCallback = (res: GeneralCallbackResult) => void
  18370. /** 接口调用成功的回调函数 */
  18371. type OpenVideoEditorSuccessCallback = (
  18372. result: OpenVideoEditorSuccessCallbackResult
  18373. ) => void
  18374. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18375. type PageScrollToCompleteCallback = (res: GeneralCallbackResult) => void
  18376. /** 接口调用失败的回调函数 */
  18377. type PageScrollToFailCallback = (res: GeneralCallbackResult) => void
  18378. /** 接口调用成功的回调函数 */
  18379. type PageScrollToSuccessCallback = (res: GeneralCallbackResult) => void
  18380. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18381. type PauseBGMCompleteCallback = (res: GeneralCallbackResult) => void
  18382. /** 接口调用失败的回调函数 */
  18383. type PauseBGMFailCallback = (res: GeneralCallbackResult) => void
  18384. /** 接口调用成功的回调函数 */
  18385. type PauseBGMSuccessCallback = (res: GeneralCallbackResult) => void
  18386. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18387. type PauseBackgroundAudioCompleteCallback = (
  18388. res: GeneralCallbackResult
  18389. ) => void
  18390. /** 接口调用失败的回调函数 */
  18391. type PauseBackgroundAudioFailCallback = (res: GeneralCallbackResult) => void
  18392. /** 接口调用成功的回调函数 */
  18393. type PauseBackgroundAudioSuccessCallback = (
  18394. res: GeneralCallbackResult
  18395. ) => void
  18396. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18397. type PauseCompleteCallback = (res: GeneralCallbackResult) => void
  18398. /** 接口调用失败的回调函数 */
  18399. type PauseFailCallback = (res: GeneralCallbackResult) => void
  18400. /** 接口调用成功的回调函数 */
  18401. type PauseSuccessCallback = (res: GeneralCallbackResult) => void
  18402. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18403. type PauseVoiceCompleteCallback = (res: GeneralCallbackResult) => void
  18404. /** 接口调用失败的回调函数 */
  18405. type PauseVoiceFailCallback = (res: GeneralCallbackResult) => void
  18406. /** 接口调用成功的回调函数 */
  18407. type PauseVoiceSuccessCallback = (res: GeneralCallbackResult) => void
  18408. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18409. type PlayBGMCompleteCallback = (res: GeneralCallbackResult) => void
  18410. /** 接口调用失败的回调函数 */
  18411. type PlayBGMFailCallback = (res: GeneralCallbackResult) => void
  18412. /** 接口调用成功的回调函数 */
  18413. type PlayBGMSuccessCallback = (res: GeneralCallbackResult) => void
  18414. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18415. type PlayBackgroundAudioCompleteCallback = (
  18416. res: GeneralCallbackResult
  18417. ) => void
  18418. /** 接口调用失败的回调函数 */
  18419. type PlayBackgroundAudioFailCallback = (res: GeneralCallbackResult) => void
  18420. /** 接口调用成功的回调函数 */
  18421. type PlayBackgroundAudioSuccessCallback = (
  18422. res: GeneralCallbackResult
  18423. ) => void
  18424. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18425. type PlayCompleteCallback = (res: GeneralCallbackResult) => void
  18426. /** 接口调用失败的回调函数 */
  18427. type PlayFailCallback = (res: GeneralCallbackResult) => void
  18428. /** 接口调用成功的回调函数 */
  18429. type PlaySuccessCallback = (res: GeneralCallbackResult) => void
  18430. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18431. type PlayVoiceCompleteCallback = (res: GeneralCallbackResult) => void
  18432. /** 接口调用失败的回调函数 */
  18433. type PlayVoiceFailCallback = (res: GeneralCallbackResult) => void
  18434. /** 接口调用成功的回调函数 */
  18435. type PlayVoiceSuccessCallback = (res: GeneralCallbackResult) => void
  18436. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18437. type PreviewImageCompleteCallback = (res: GeneralCallbackResult) => void
  18438. /** 接口调用失败的回调函数 */
  18439. type PreviewImageFailCallback = (res: GeneralCallbackResult) => void
  18440. /** 接口调用成功的回调函数 */
  18441. type PreviewImageSuccessCallback = (res: GeneralCallbackResult) => void
  18442. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18443. type PreviewMediaCompleteCallback = (res: GeneralCallbackResult) => void
  18444. /** 接口调用失败的回调函数 */
  18445. type PreviewMediaFailCallback = (res: GeneralCallbackResult) => void
  18446. /** 接口调用成功的回调函数 */
  18447. type PreviewMediaSuccessCallback = (res: GeneralCallbackResult) => void
  18448. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18449. type ReLaunchCompleteCallback = (res: GeneralCallbackResult) => void
  18450. /** 接口调用失败的回调函数 */
  18451. type ReLaunchFailCallback = (res: GeneralCallbackResult) => void
  18452. /** 接口调用成功的回调函数 */
  18453. type ReLaunchSuccessCallback = (res: GeneralCallbackResult) => void
  18454. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18455. type ReadBLECharacteristicValueCompleteCallback = (
  18456. res: BluetoothError
  18457. ) => void
  18458. /** 接口调用失败的回调函数 */
  18459. type ReadBLECharacteristicValueFailCallback = (res: BluetoothError) => void
  18460. /** 接口调用成功的回调函数 */
  18461. type ReadBLECharacteristicValueSuccessCallback = (
  18462. res: BluetoothError
  18463. ) => void
  18464. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18465. type ReadFileCompleteCallback = (res: GeneralCallbackResult) => void
  18466. /** 接口调用失败的回调函数 */
  18467. type ReadFileFailCallback = (result: ReadFileFailCallbackResult) => void
  18468. /** 接口调用成功的回调函数 */
  18469. type ReadFileSuccessCallback = (
  18470. result: ReadFileSuccessCallbackResult
  18471. ) => void
  18472. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18473. type ReaddirCompleteCallback = (res: GeneralCallbackResult) => void
  18474. /** 接口调用失败的回调函数 */
  18475. type ReaddirFailCallback = (result: ReaddirFailCallbackResult) => void
  18476. /** 接口调用成功的回调函数 */
  18477. type ReaddirSuccessCallback = (result: ReaddirSuccessCallbackResult) => void
  18478. /** 录音结束事件的回调函数 */
  18479. type RecorderManagerOnStopCallback = (result: OnStopCallbackResult) => void
  18480. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18481. type RedirectToCompleteCallback = (res: GeneralCallbackResult) => void
  18482. /** 接口调用失败的回调函数 */
  18483. type RedirectToFailCallback = (res: GeneralCallbackResult) => void
  18484. /** 接口调用成功的回调函数 */
  18485. type RedirectToSuccessCallback = (res: GeneralCallbackResult) => void
  18486. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18487. type RedoCompleteCallback = (res: GeneralCallbackResult) => void
  18488. /** 接口调用失败的回调函数 */
  18489. type RedoFailCallback = (res: GeneralCallbackResult) => void
  18490. /** 接口调用成功的回调函数 */
  18491. type RedoSuccessCallback = (res: GeneralCallbackResult) => void
  18492. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18493. type RemoveCustomLayerCompleteCallback = (
  18494. res: GeneralCallbackResult
  18495. ) => void
  18496. /** 接口调用失败的回调函数 */
  18497. type RemoveCustomLayerFailCallback = (res: GeneralCallbackResult) => void
  18498. /** 接口调用成功的回调函数 */
  18499. type RemoveCustomLayerSuccessCallback = (res: GeneralCallbackResult) => void
  18500. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18501. type RemoveFormatCompleteCallback = (res: GeneralCallbackResult) => void
  18502. /** 接口调用失败的回调函数 */
  18503. type RemoveFormatFailCallback = (res: GeneralCallbackResult) => void
  18504. /** 接口调用成功的回调函数 */
  18505. type RemoveFormatSuccessCallback = (res: GeneralCallbackResult) => void
  18506. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18507. type RemoveGroundOverlayCompleteCallback = (
  18508. res: GeneralCallbackResult
  18509. ) => void
  18510. /** 接口调用失败的回调函数 */
  18511. type RemoveGroundOverlayFailCallback = (res: GeneralCallbackResult) => void
  18512. /** 接口调用成功的回调函数 */
  18513. type RemoveGroundOverlaySuccessCallback = (
  18514. res: GeneralCallbackResult
  18515. ) => void
  18516. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18517. type RemoveMarkersCompleteCallback = (res: GeneralCallbackResult) => void
  18518. /** 接口调用失败的回调函数 */
  18519. type RemoveMarkersFailCallback = (res: GeneralCallbackResult) => void
  18520. /** 接口调用成功的回调函数 */
  18521. type RemoveMarkersSuccessCallback = (res: GeneralCallbackResult) => void
  18522. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18523. type RemoveSavedFileCompleteCallback = (res: GeneralCallbackResult) => void
  18524. /** 接口调用成功的回调函数 */
  18525. type RemoveSavedFileSuccessCallback = (res: GeneralCallbackResult) => void
  18526. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18527. type RemoveServiceCompleteCallback = (res: GeneralCallbackResult) => void
  18528. /** 接口调用失败的回调函数 */
  18529. type RemoveServiceFailCallback = (res: GeneralCallbackResult) => void
  18530. /** 接口调用成功的回调函数 */
  18531. type RemoveServiceSuccessCallback = (res: GeneralCallbackResult) => void
  18532. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18533. type RemoveStorageCompleteCallback = (res: GeneralCallbackResult) => void
  18534. /** 接口调用失败的回调函数 */
  18535. type RemoveStorageFailCallback = (res: GeneralCallbackResult) => void
  18536. /** 接口调用成功的回调函数 */
  18537. type RemoveStorageSuccessCallback = (res: GeneralCallbackResult) => void
  18538. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18539. type RemoveTabBarBadgeCompleteCallback = (
  18540. res: GeneralCallbackResult
  18541. ) => void
  18542. /** 接口调用失败的回调函数 */
  18543. type RemoveTabBarBadgeFailCallback = (res: GeneralCallbackResult) => void
  18544. /** 接口调用成功的回调函数 */
  18545. type RemoveTabBarBadgeSuccessCallback = (res: GeneralCallbackResult) => void
  18546. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18547. type RenameCompleteCallback = (res: GeneralCallbackResult) => void
  18548. /** 接口调用失败的回调函数 */
  18549. type RenameFailCallback = (result: RenameFailCallbackResult) => void
  18550. /** 接口调用成功的回调函数 */
  18551. type RenameSuccessCallback = (res: GeneralCallbackResult) => void
  18552. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18553. type RequestCompleteCallback = (res: GeneralCallbackResult) => void
  18554. /** 接口调用失败的回调函数 */
  18555. type RequestFailCallback = (res: GeneralCallbackResult) => void
  18556. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18557. type RequestFullScreenCompleteCallback = (
  18558. res: GeneralCallbackResult
  18559. ) => void
  18560. /** 接口调用失败的回调函数 */
  18561. type RequestFullScreenFailCallback = (res: GeneralCallbackResult) => void
  18562. /** 接口调用成功的回调函数 */
  18563. type RequestFullScreenSuccessCallback = (res: GeneralCallbackResult) => void
  18564. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18565. type RequestPaymentCompleteCallback = (res: GeneralCallbackResult) => void
  18566. /** 接口调用失败的回调函数 */
  18567. type RequestPaymentFailCallback = (res: GeneralCallbackResult) => void
  18568. /** 接口调用成功的回调函数 */
  18569. type RequestPaymentSuccessCallback = (res: GeneralCallbackResult) => void
  18570. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18571. type RequestPictureInPictureCompleteCallback = (
  18572. res: GeneralCallbackResult
  18573. ) => void
  18574. /** 接口调用失败的回调函数 */
  18575. type RequestPictureInPictureFailCallback = (
  18576. res: GeneralCallbackResult
  18577. ) => void
  18578. /** 接口调用成功的回调函数 */
  18579. type RequestPictureInPictureSuccessCallback = (
  18580. res: GeneralCallbackResult
  18581. ) => void
  18582. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18583. type RequestSubscribeMessageCompleteCallback = (
  18584. res: GeneralCallbackResult
  18585. ) => void
  18586. /** 接口调用失败的回调函数 */
  18587. type RequestSubscribeMessageFailCallback = (
  18588. result: RequestSubscribeMessageFailCallbackResult
  18589. ) => void
  18590. /** 接口调用成功的回调函数 */
  18591. type RequestSubscribeMessageSuccessCallback = (
  18592. result: RequestSubscribeMessageSuccessCallbackResult
  18593. ) => void
  18594. /** 接口调用成功的回调函数 */
  18595. type RequestSuccessCallback<
  18596. T extends string | IAnyObject | ArrayBuffer =
  18597. | string
  18598. | IAnyObject
  18599. | ArrayBuffer
  18600. > = (result: RequestSuccessCallbackResult<T>) => void
  18601. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18602. type ResumeBGMCompleteCallback = (res: GeneralCallbackResult) => void
  18603. /** 接口调用失败的回调函数 */
  18604. type ResumeBGMFailCallback = (res: GeneralCallbackResult) => void
  18605. /** 接口调用成功的回调函数 */
  18606. type ResumeBGMSuccessCallback = (res: GeneralCallbackResult) => void
  18607. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18608. type ResumeCompleteCallback = (res: GeneralCallbackResult) => void
  18609. /** 接口调用失败的回调函数 */
  18610. type ResumeFailCallback = (res: GeneralCallbackResult) => void
  18611. /** 接口调用成功的回调函数 */
  18612. type ResumeSuccessCallback = (res: GeneralCallbackResult) => void
  18613. /** 用户点击 `关闭广告` 按钮的事件的回调函数 */
  18614. type RewardedVideoAdOffCloseCallback = (
  18615. result: RewardedVideoAdOnCloseCallbackResult
  18616. ) => void
  18617. /** 激励视频错误事件的回调函数 */
  18618. type RewardedVideoAdOffErrorCallback = (
  18619. result: RewardedVideoAdOnErrorCallbackResult
  18620. ) => void
  18621. /** 用户点击 `关闭广告` 按钮的事件的回调函数 */
  18622. type RewardedVideoAdOnCloseCallback = (
  18623. result: RewardedVideoAdOnCloseCallbackResult
  18624. ) => void
  18625. /** 激励视频错误事件的回调函数 */
  18626. type RewardedVideoAdOnErrorCallback = (
  18627. result: RewardedVideoAdOnErrorCallbackResult
  18628. ) => void
  18629. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18630. type RmdirCompleteCallback = (res: GeneralCallbackResult) => void
  18631. /** 接口调用失败的回调函数 */
  18632. type RmdirFailCallback = (result: RmdirFailCallbackResult) => void
  18633. /** 接口调用成功的回调函数 */
  18634. type RmdirSuccessCallback = (res: GeneralCallbackResult) => void
  18635. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18636. type SaveFileCompleteCallback = (res: GeneralCallbackResult) => void
  18637. /** 接口调用成功的回调函数 */
  18638. type SaveFileSuccessCallback = (
  18639. result: SaveFileSuccessCallbackResult
  18640. ) => void
  18641. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18642. type SaveFileToDiskCompleteCallback = (res: GeneralCallbackResult) => void
  18643. /** 接口调用失败的回调函数 */
  18644. type SaveFileToDiskFailCallback = (res: GeneralCallbackResult) => void
  18645. /** 接口调用成功的回调函数 */
  18646. type SaveFileToDiskSuccessCallback = (res: GeneralCallbackResult) => void
  18647. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18648. type SaveImageToPhotosAlbumCompleteCallback = (
  18649. res: GeneralCallbackResult
  18650. ) => void
  18651. /** 接口调用失败的回调函数 */
  18652. type SaveImageToPhotosAlbumFailCallback = (
  18653. res: GeneralCallbackResult
  18654. ) => void
  18655. /** 接口调用成功的回调函数 */
  18656. type SaveImageToPhotosAlbumSuccessCallback = (
  18657. res: GeneralCallbackResult
  18658. ) => void
  18659. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18660. type SaveVideoToPhotosAlbumCompleteCallback = (
  18661. res: GeneralCallbackResult
  18662. ) => void
  18663. /** 接口调用失败的回调函数 */
  18664. type SaveVideoToPhotosAlbumFailCallback = (
  18665. res: GeneralCallbackResult
  18666. ) => void
  18667. /** 接口调用成功的回调函数 */
  18668. type SaveVideoToPhotosAlbumSuccessCallback = (
  18669. res: GeneralCallbackResult
  18670. ) => void
  18671. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18672. type ScanCodeCompleteCallback = (res: GeneralCallbackResult) => void
  18673. /** 接口调用失败的回调函数 */
  18674. type ScanCodeFailCallback = (res: GeneralCallbackResult) => void
  18675. /** 接口调用成功的回调函数 */
  18676. type ScanCodeSuccessCallback = (
  18677. result: ScanCodeSuccessCallbackResult
  18678. ) => void
  18679. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */
  18680. type ScrollOffsetCallback = (result: ScrollOffsetCallbackResult) => void
  18681. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18682. type SeekBackgroundAudioCompleteCallback = (
  18683. res: GeneralCallbackResult
  18684. ) => void
  18685. /** 接口调用失败的回调函数 */
  18686. type SeekBackgroundAudioFailCallback = (res: GeneralCallbackResult) => void
  18687. /** 接口调用成功的回调函数 */
  18688. type SeekBackgroundAudioSuccessCallback = (
  18689. res: GeneralCallbackResult
  18690. ) => void
  18691. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18692. type SendCompleteCallback = (res: GeneralCallbackResult) => void
  18693. /** 接口调用失败的回调函数 */
  18694. type SendFailCallback = (res: GeneralCallbackResult) => void
  18695. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18696. type SendHCEMessageCompleteCallback = (res: NFCError) => void
  18697. /** 接口调用失败的回调函数 */
  18698. type SendHCEMessageFailCallback = (res: NFCError) => void
  18699. /** 接口调用成功的回调函数 */
  18700. type SendHCEMessageSuccessCallback = (res: NFCError) => void
  18701. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18702. type SendMessageCompleteCallback = (res: GeneralCallbackResult) => void
  18703. /** 接口调用失败的回调函数 */
  18704. type SendMessageFailCallback = (res: GeneralCallbackResult) => void
  18705. /** 接口调用成功的回调函数 */
  18706. type SendMessageSuccessCallback = (res: GeneralCallbackResult) => void
  18707. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18708. type SendSocketMessageCompleteCallback = (
  18709. res: GeneralCallbackResult
  18710. ) => void
  18711. /** 接口调用失败的回调函数 */
  18712. type SendSocketMessageFailCallback = (res: GeneralCallbackResult) => void
  18713. /** 接口调用成功的回调函数 */
  18714. type SendSocketMessageSuccessCallback = (res: GeneralCallbackResult) => void
  18715. /** 接口调用成功的回调函数 */
  18716. type SendSuccessCallback = (res: GeneralCallbackResult) => void
  18717. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18718. type SetBGMVolumeCompleteCallback = (res: GeneralCallbackResult) => void
  18719. /** 接口调用失败的回调函数 */
  18720. type SetBGMVolumeFailCallback = (res: GeneralCallbackResult) => void
  18721. /** 接口调用成功的回调函数 */
  18722. type SetBGMVolumeSuccessCallback = (res: GeneralCallbackResult) => void
  18723. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18724. type SetBLEMTUCompleteCallback = (res: GeneralCallbackResult) => void
  18725. /** 接口调用失败的回调函数 */
  18726. type SetBLEMTUFailCallback = (res: GeneralCallbackResult) => void
  18727. /** 接口调用成功的回调函数 */
  18728. type SetBLEMTUSuccessCallback = (res: GeneralCallbackResult) => void
  18729. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18730. type SetBackgroundColorCompleteCallback = (
  18731. res: GeneralCallbackResult
  18732. ) => void
  18733. /** 接口调用失败的回调函数 */
  18734. type SetBackgroundColorFailCallback = (res: GeneralCallbackResult) => void
  18735. /** 接口调用成功的回调函数 */
  18736. type SetBackgroundColorSuccessCallback = (
  18737. res: GeneralCallbackResult
  18738. ) => void
  18739. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18740. type SetBackgroundFetchTokenCompleteCallback = (
  18741. res: GeneralCallbackResult
  18742. ) => void
  18743. /** 接口调用失败的回调函数 */
  18744. type SetBackgroundFetchTokenFailCallback = (
  18745. res: GeneralCallbackResult
  18746. ) => void
  18747. /** 接口调用成功的回调函数 */
  18748. type SetBackgroundFetchTokenSuccessCallback = (
  18749. res: GeneralCallbackResult
  18750. ) => void
  18751. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18752. type SetBackgroundTextStyleCompleteCallback = (
  18753. res: GeneralCallbackResult
  18754. ) => void
  18755. /** 接口调用失败的回调函数 */
  18756. type SetBackgroundTextStyleFailCallback = (
  18757. res: GeneralCallbackResult
  18758. ) => void
  18759. /** 接口调用成功的回调函数 */
  18760. type SetBackgroundTextStyleSuccessCallback = (
  18761. res: GeneralCallbackResult
  18762. ) => void
  18763. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18764. type SetCenterOffsetCompleteCallback = (res: GeneralCallbackResult) => void
  18765. /** 接口调用失败的回调函数 */
  18766. type SetCenterOffsetFailCallback = (res: GeneralCallbackResult) => void
  18767. /** 接口调用成功的回调函数 */
  18768. type SetCenterOffsetSuccessCallback = (res: GeneralCallbackResult) => void
  18769. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18770. type SetClipboardDataCompleteCallback = (res: GeneralCallbackResult) => void
  18771. /** 接口调用失败的回调函数 */
  18772. type SetClipboardDataFailCallback = (res: GeneralCallbackResult) => void
  18773. /** 接口调用成功的回调函数 */
  18774. type SetClipboardDataSuccessCallback = (res: GeneralCallbackResult) => void
  18775. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18776. type SetContentsCompleteCallback = (res: GeneralCallbackResult) => void
  18777. /** 接口调用失败的回调函数 */
  18778. type SetContentsFailCallback = (res: GeneralCallbackResult) => void
  18779. /** 接口调用成功的回调函数 */
  18780. type SetContentsSuccessCallback = (res: GeneralCallbackResult) => void
  18781. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18782. type SetEnableDebugCompleteCallback = (res: GeneralCallbackResult) => void
  18783. /** 接口调用失败的回调函数 */
  18784. type SetEnableDebugFailCallback = (res: GeneralCallbackResult) => void
  18785. /** 接口调用成功的回调函数 */
  18786. type SetEnableDebugSuccessCallback = (res: GeneralCallbackResult) => void
  18787. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18788. type SetInnerAudioOptionCompleteCallback = (
  18789. res: GeneralCallbackResult
  18790. ) => void
  18791. /** 接口调用失败的回调函数 */
  18792. type SetInnerAudioOptionFailCallback = (res: GeneralCallbackResult) => void
  18793. /** 接口调用成功的回调函数 */
  18794. type SetInnerAudioOptionSuccessCallback = (
  18795. res: GeneralCallbackResult
  18796. ) => void
  18797. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18798. type SetKeepScreenOnCompleteCallback = (res: GeneralCallbackResult) => void
  18799. /** 接口调用失败的回调函数 */
  18800. type SetKeepScreenOnFailCallback = (res: GeneralCallbackResult) => void
  18801. /** 接口调用成功的回调函数 */
  18802. type SetKeepScreenOnSuccessCallback = (res: GeneralCallbackResult) => void
  18803. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18804. type SetMICVolumeCompleteCallback = (res: GeneralCallbackResult) => void
  18805. /** 接口调用失败的回调函数 */
  18806. type SetMICVolumeFailCallback = (res: GeneralCallbackResult) => void
  18807. /** 接口调用成功的回调函数 */
  18808. type SetMICVolumeSuccessCallback = (res: GeneralCallbackResult) => void
  18809. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18810. type SetNavigationBarColorCompleteCallback = (
  18811. res: GeneralCallbackResult
  18812. ) => void
  18813. /** 接口调用失败的回调函数 */
  18814. type SetNavigationBarColorFailCallback = (
  18815. res: GeneralCallbackResult
  18816. ) => void
  18817. /** 接口调用成功的回调函数 */
  18818. type SetNavigationBarColorSuccessCallback = (
  18819. res: GeneralCallbackResult
  18820. ) => void
  18821. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18822. type SetNavigationBarTitleCompleteCallback = (
  18823. res: GeneralCallbackResult
  18824. ) => void
  18825. /** 接口调用失败的回调函数 */
  18826. type SetNavigationBarTitleFailCallback = (
  18827. res: GeneralCallbackResult
  18828. ) => void
  18829. /** 接口调用成功的回调函数 */
  18830. type SetNavigationBarTitleSuccessCallback = (
  18831. res: GeneralCallbackResult
  18832. ) => void
  18833. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18834. type SetScreenBrightnessCompleteCallback = (
  18835. res: GeneralCallbackResult
  18836. ) => void
  18837. /** 接口调用失败的回调函数 */
  18838. type SetScreenBrightnessFailCallback = (res: GeneralCallbackResult) => void
  18839. /** 接口调用成功的回调函数 */
  18840. type SetScreenBrightnessSuccessCallback = (
  18841. res: GeneralCallbackResult
  18842. ) => void
  18843. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18844. type SetStorageCompleteCallback = (res: GeneralCallbackResult) => void
  18845. /** 接口调用失败的回调函数 */
  18846. type SetStorageFailCallback = (res: GeneralCallbackResult) => void
  18847. /** 接口调用成功的回调函数 */
  18848. type SetStorageSuccessCallback = (res: GeneralCallbackResult) => void
  18849. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18850. type SetTabBarBadgeCompleteCallback = (res: GeneralCallbackResult) => void
  18851. /** 接口调用失败的回调函数 */
  18852. type SetTabBarBadgeFailCallback = (res: GeneralCallbackResult) => void
  18853. /** 接口调用成功的回调函数 */
  18854. type SetTabBarBadgeSuccessCallback = (res: GeneralCallbackResult) => void
  18855. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18856. type SetTabBarItemCompleteCallback = (res: GeneralCallbackResult) => void
  18857. /** 接口调用失败的回调函数 */
  18858. type SetTabBarItemFailCallback = (res: GeneralCallbackResult) => void
  18859. /** 接口调用成功的回调函数 */
  18860. type SetTabBarItemSuccessCallback = (res: GeneralCallbackResult) => void
  18861. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18862. type SetTabBarStyleCompleteCallback = (res: GeneralCallbackResult) => void
  18863. /** 接口调用失败的回调函数 */
  18864. type SetTabBarStyleFailCallback = (res: GeneralCallbackResult) => void
  18865. /** 接口调用成功的回调函数 */
  18866. type SetTabBarStyleSuccessCallback = (res: GeneralCallbackResult) => void
  18867. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18868. type SetTimeoutCompleteCallback = (res: Nfcrwerror) => void
  18869. /** 接口调用失败的回调函数 */
  18870. type SetTimeoutFailCallback = (res: Nfcrwerror) => void
  18871. /** 接口调用成功的回调函数 */
  18872. type SetTimeoutSuccessCallback = (res: Nfcrwerror) => void
  18873. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18874. type SetTopBarTextCompleteCallback = (res: GeneralCallbackResult) => void
  18875. /** 接口调用失败的回调函数 */
  18876. type SetTopBarTextFailCallback = (res: GeneralCallbackResult) => void
  18877. /** 接口调用成功的回调函数 */
  18878. type SetTopBarTextSuccessCallback = (res: GeneralCallbackResult) => void
  18879. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18880. type SetWifiListCompleteCallback = (res: WifiError) => void
  18881. /** 接口调用失败的回调函数 */
  18882. type SetWifiListFailCallback = (res: WifiError) => void
  18883. /** 接口调用成功的回调函数 */
  18884. type SetWifiListSuccessCallback = (res: WifiError) => void
  18885. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18886. type SetWindowSizeCompleteCallback = (res: GeneralCallbackResult) => void
  18887. /** 接口调用失败的回调函数 */
  18888. type SetWindowSizeFailCallback = (res: GeneralCallbackResult) => void
  18889. /** 接口调用成功的回调函数 */
  18890. type SetWindowSizeSuccessCallback = (res: GeneralCallbackResult) => void
  18891. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18892. type SetZoomCompleteCallback = (res: GeneralCallbackResult) => void
  18893. /** 接口调用失败的回调函数 */
  18894. type SetZoomFailCallback = (res: GeneralCallbackResult) => void
  18895. /** 接口调用成功的回调函数 */
  18896. type SetZoomSuccessCallback = (result: SetZoomSuccessCallbackResult) => void
  18897. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18898. type ShowActionSheetCompleteCallback = (res: GeneralCallbackResult) => void
  18899. /** 接口调用失败的回调函数 */
  18900. type ShowActionSheetFailCallback = (res: GeneralCallbackResult) => void
  18901. /** 接口调用成功的回调函数 */
  18902. type ShowActionSheetSuccessCallback = (
  18903. result: ShowActionSheetSuccessCallbackResult
  18904. ) => void
  18905. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18906. type ShowLoadingCompleteCallback = (res: GeneralCallbackResult) => void
  18907. /** 接口调用失败的回调函数 */
  18908. type ShowLoadingFailCallback = (res: GeneralCallbackResult) => void
  18909. /** 接口调用成功的回调函数 */
  18910. type ShowLoadingSuccessCallback = (res: GeneralCallbackResult) => void
  18911. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18912. type ShowModalCompleteCallback = (res: GeneralCallbackResult) => void
  18913. /** 接口调用失败的回调函数 */
  18914. type ShowModalFailCallback = (res: GeneralCallbackResult) => void
  18915. /** 接口调用成功的回调函数 */
  18916. type ShowModalSuccessCallback = (
  18917. result: ShowModalSuccessCallbackResult
  18918. ) => void
  18919. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18920. type ShowNavigationBarLoadingCompleteCallback = (
  18921. res: GeneralCallbackResult
  18922. ) => void
  18923. /** 接口调用失败的回调函数 */
  18924. type ShowNavigationBarLoadingFailCallback = (
  18925. res: GeneralCallbackResult
  18926. ) => void
  18927. /** 接口调用成功的回调函数 */
  18928. type ShowNavigationBarLoadingSuccessCallback = (
  18929. res: GeneralCallbackResult
  18930. ) => void
  18931. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18932. type ShowRedPackageCompleteCallback = (res: GeneralCallbackResult) => void
  18933. /** 接口调用失败的回调函数 */
  18934. type ShowRedPackageFailCallback = (res: GeneralCallbackResult) => void
  18935. /** 接口调用成功的回调函数 */
  18936. type ShowRedPackageSuccessCallback = (res: GeneralCallbackResult) => void
  18937. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18938. type ShowShareImageMenuCompleteCallback = (
  18939. res: GeneralCallbackResult
  18940. ) => void
  18941. /** 接口调用失败的回调函数 */
  18942. type ShowShareImageMenuFailCallback = (res: GeneralCallbackResult) => void
  18943. /** 接口调用成功的回调函数 */
  18944. type ShowShareImageMenuSuccessCallback = (
  18945. res: GeneralCallbackResult
  18946. ) => void
  18947. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18948. type ShowShareMenuCompleteCallback = (res: GeneralCallbackResult) => void
  18949. /** 接口调用失败的回调函数 */
  18950. type ShowShareMenuFailCallback = (res: GeneralCallbackResult) => void
  18951. /** 接口调用成功的回调函数 */
  18952. type ShowShareMenuSuccessCallback = (res: GeneralCallbackResult) => void
  18953. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18954. type ShowTabBarCompleteCallback = (res: GeneralCallbackResult) => void
  18955. /** 接口调用失败的回调函数 */
  18956. type ShowTabBarFailCallback = (res: GeneralCallbackResult) => void
  18957. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18958. type ShowTabBarRedDotCompleteCallback = (res: GeneralCallbackResult) => void
  18959. /** 接口调用失败的回调函数 */
  18960. type ShowTabBarRedDotFailCallback = (res: GeneralCallbackResult) => void
  18961. /** 接口调用成功的回调函数 */
  18962. type ShowTabBarRedDotSuccessCallback = (res: GeneralCallbackResult) => void
  18963. /** 接口调用成功的回调函数 */
  18964. type ShowTabBarSuccessCallback = (res: GeneralCallbackResult) => void
  18965. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18966. type ShowToastCompleteCallback = (res: GeneralCallbackResult) => void
  18967. /** 接口调用失败的回调函数 */
  18968. type ShowToastFailCallback = (res: GeneralCallbackResult) => void
  18969. /** 接口调用成功的回调函数 */
  18970. type ShowToastSuccessCallback = (res: GeneralCallbackResult) => void
  18971. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18972. type SnapshotCompleteCallback = (res: GeneralCallbackResult) => void
  18973. /** 接口调用失败的回调函数 */
  18974. type SnapshotFailCallback = (res: GeneralCallbackResult) => void
  18975. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18976. type SocketTaskCloseCompleteCallback = (res: GeneralCallbackResult) => void
  18977. /** 接口调用失败的回调函数 */
  18978. type SocketTaskCloseFailCallback = (res: GeneralCallbackResult) => void
  18979. /** 接口调用成功的回调函数 */
  18980. type SocketTaskCloseSuccessCallback = (res: GeneralCallbackResult) => void
  18981. /** WebSocket 连接关闭事件的回调函数 */
  18982. type SocketTaskOnCloseCallback = (
  18983. result: SocketTaskOnCloseCallbackResult
  18984. ) => void
  18985. /** WebSocket 接受到服务器的消息事件的回调函数 */
  18986. type SocketTaskOnMessageCallback = (
  18987. result: SocketTaskOnMessageCallbackResult
  18988. ) => void
  18989. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  18990. type StartAccelerometerCompleteCallback = (
  18991. res: GeneralCallbackResult
  18992. ) => void
  18993. /** 接口调用失败的回调函数 */
  18994. type StartAccelerometerFailCallback = (res: GeneralCallbackResult) => void
  18995. /** 接口调用成功的回调函数 */
  18996. type StartAccelerometerSuccessCallback = (
  18997. res: GeneralCallbackResult
  18998. ) => void
  18999. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19000. type StartAdvertisingCompleteCallback = (res: GeneralCallbackResult) => void
  19001. /** 接口调用失败的回调函数 */
  19002. type StartAdvertisingFailCallback = (res: GeneralCallbackResult) => void
  19003. /** 接口调用成功的回调函数 */
  19004. type StartAdvertisingSuccessCallback = (res: GeneralCallbackResult) => void
  19005. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19006. type StartBeaconDiscoveryCompleteCallback = (res: IBeaconError) => void
  19007. /** 接口调用失败的回调函数 */
  19008. type StartBeaconDiscoveryFailCallback = (res: IBeaconError) => void
  19009. /** 接口调用成功的回调函数 */
  19010. type StartBeaconDiscoverySuccessCallback = (res: IBeaconError) => void
  19011. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19012. type StartBluetoothDevicesDiscoveryCompleteCallback = (
  19013. res: BluetoothError
  19014. ) => void
  19015. /** 接口调用失败的回调函数 */
  19016. type StartBluetoothDevicesDiscoveryFailCallback = (
  19017. res: BluetoothError
  19018. ) => void
  19019. /** 接口调用成功的回调函数 */
  19020. type StartBluetoothDevicesDiscoverySuccessCallback = (
  19021. res: BluetoothError
  19022. ) => void
  19023. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19024. type StartCompassCompleteCallback = (res: GeneralCallbackResult) => void
  19025. /** 接口调用失败的回调函数 */
  19026. type StartCompassFailCallback = (res: GeneralCallbackResult) => void
  19027. /** 接口调用成功的回调函数 */
  19028. type StartCompassSuccessCallback = (res: GeneralCallbackResult) => void
  19029. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19030. type StartCompleteCallback = (res: GeneralCallbackResult) => void
  19031. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19032. type StartDeviceMotionListeningCompleteCallback = (
  19033. res: GeneralCallbackResult
  19034. ) => void
  19035. /** 接口调用失败的回调函数 */
  19036. type StartDeviceMotionListeningFailCallback = (
  19037. res: GeneralCallbackResult
  19038. ) => void
  19039. /** 接口调用成功的回调函数 */
  19040. type StartDeviceMotionListeningSuccessCallback = (
  19041. res: GeneralCallbackResult
  19042. ) => void
  19043. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19044. type StartDiscoveryCompleteCallback = (res: Nfcrwerror) => void
  19045. /** 接口调用失败的回调函数 */
  19046. type StartDiscoveryFailCallback = (res: Nfcrwerror) => void
  19047. /** 接口调用成功的回调函数 */
  19048. type StartDiscoverySuccessCallback = (res: Nfcrwerror) => void
  19049. /** 接口调用失败的回调函数 */
  19050. type StartFailCallback = (res: GeneralCallbackResult) => void
  19051. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19052. type StartGyroscopeCompleteCallback = (res: GeneralCallbackResult) => void
  19053. /** 接口调用失败的回调函数 */
  19054. type StartGyroscopeFailCallback = (res: GeneralCallbackResult) => void
  19055. /** 接口调用成功的回调函数 */
  19056. type StartGyroscopeSuccessCallback = (res: GeneralCallbackResult) => void
  19057. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19058. type StartHCECompleteCallback = (res: NFCError) => void
  19059. /** 接口调用失败的回调函数 */
  19060. type StartHCEFailCallback = (res: NFCError) => void
  19061. /** 接口调用成功的回调函数 */
  19062. type StartHCESuccessCallback = (res: NFCError) => void
  19063. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19064. type StartLocalServiceDiscoveryCompleteCallback = (
  19065. res: GeneralCallbackResult
  19066. ) => void
  19067. /** 接口调用失败的回调函数 */
  19068. type StartLocalServiceDiscoveryFailCallback = (
  19069. result: StartLocalServiceDiscoveryFailCallbackResult
  19070. ) => void
  19071. /** 接口调用成功的回调函数 */
  19072. type StartLocalServiceDiscoverySuccessCallback = (
  19073. res: GeneralCallbackResult
  19074. ) => void
  19075. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19076. type StartLocationUpdateBackgroundCompleteCallback = (
  19077. res: GeneralCallbackResult
  19078. ) => void
  19079. /** 接口调用失败的回调函数 */
  19080. type StartLocationUpdateBackgroundFailCallback = (
  19081. res: GeneralCallbackResult
  19082. ) => void
  19083. /** 接口调用成功的回调函数 */
  19084. type StartLocationUpdateBackgroundSuccessCallback = (
  19085. res: GeneralCallbackResult
  19086. ) => void
  19087. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19088. type StartLocationUpdateCompleteCallback = (
  19089. res: GeneralCallbackResult
  19090. ) => void
  19091. /** 接口调用失败的回调函数 */
  19092. type StartLocationUpdateFailCallback = (res: GeneralCallbackResult) => void
  19093. /** 接口调用成功的回调函数 */
  19094. type StartLocationUpdateSuccessCallback = (
  19095. res: GeneralCallbackResult
  19096. ) => void
  19097. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19098. type StartPreviewCompleteCallback = (res: GeneralCallbackResult) => void
  19099. /** 接口调用失败的回调函数 */
  19100. type StartPreviewFailCallback = (res: GeneralCallbackResult) => void
  19101. /** 接口调用成功的回调函数 */
  19102. type StartPreviewSuccessCallback = (res: GeneralCallbackResult) => void
  19103. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19104. type StartPullDownRefreshCompleteCallback = (
  19105. res: GeneralCallbackResult
  19106. ) => void
  19107. /** 接口调用失败的回调函数 */
  19108. type StartPullDownRefreshFailCallback = (res: GeneralCallbackResult) => void
  19109. /** 接口调用成功的回调函数 */
  19110. type StartPullDownRefreshSuccessCallback = (
  19111. res: GeneralCallbackResult
  19112. ) => void
  19113. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19114. type StartRecordCompleteCallback = (res: GeneralCallbackResult) => void
  19115. /** 接口调用失败的回调函数 */
  19116. type StartRecordFailCallback = (res: GeneralCallbackResult) => void
  19117. /** 超过30s或页面 `onHide` 时会结束录像 */
  19118. type StartRecordTimeoutCallback = (
  19119. result: StartRecordTimeoutCallbackResult
  19120. ) => void
  19121. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19122. type StartSoterAuthenticationCompleteCallback = (
  19123. res: GeneralCallbackResult
  19124. ) => void
  19125. /** 接口调用失败的回调函数 */
  19126. type StartSoterAuthenticationFailCallback = (
  19127. res: GeneralCallbackResult
  19128. ) => void
  19129. /** 接口调用成功的回调函数 */
  19130. type StartSoterAuthenticationSuccessCallback = (
  19131. result: StartSoterAuthenticationSuccessCallbackResult
  19132. ) => void
  19133. /** 接口调用成功的回调函数 */
  19134. type StartSuccessCallback = (res: GeneralCallbackResult) => void
  19135. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19136. type StartWifiCompleteCallback = (res: WifiError) => void
  19137. /** 接口调用失败的回调函数 */
  19138. type StartWifiFailCallback = (res: WifiError) => void
  19139. /** 接口调用成功的回调函数 */
  19140. type StartWifiSuccessCallback = (res: WifiError) => void
  19141. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19142. type StatCompleteCallback = (res: GeneralCallbackResult) => void
  19143. /** 接口调用失败的回调函数 */
  19144. type StatFailCallback = (result: StatFailCallbackResult) => void
  19145. /** 接口调用成功的回调函数 */
  19146. type StatSuccessCallback = (result: StatSuccessCallbackResult) => void
  19147. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19148. type StopAccelerometerCompleteCallback = (
  19149. res: GeneralCallbackResult
  19150. ) => void
  19151. /** 接口调用失败的回调函数 */
  19152. type StopAccelerometerFailCallback = (res: GeneralCallbackResult) => void
  19153. /** 接口调用成功的回调函数 */
  19154. type StopAccelerometerSuccessCallback = (res: GeneralCallbackResult) => void
  19155. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19156. type StopAdvertisingCompleteCallback = (res: GeneralCallbackResult) => void
  19157. /** 接口调用失败的回调函数 */
  19158. type StopAdvertisingFailCallback = (res: GeneralCallbackResult) => void
  19159. /** 接口调用成功的回调函数 */
  19160. type StopAdvertisingSuccessCallback = (res: GeneralCallbackResult) => void
  19161. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19162. type StopBGMCompleteCallback = (res: GeneralCallbackResult) => void
  19163. /** 接口调用失败的回调函数 */
  19164. type StopBGMFailCallback = (res: GeneralCallbackResult) => void
  19165. /** 接口调用成功的回调函数 */
  19166. type StopBGMSuccessCallback = (res: GeneralCallbackResult) => void
  19167. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19168. type StopBackgroundAudioCompleteCallback = (
  19169. res: GeneralCallbackResult
  19170. ) => void
  19171. /** 接口调用失败的回调函数 */
  19172. type StopBackgroundAudioFailCallback = (res: GeneralCallbackResult) => void
  19173. /** 接口调用成功的回调函数 */
  19174. type StopBackgroundAudioSuccessCallback = (
  19175. res: GeneralCallbackResult
  19176. ) => void
  19177. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19178. type StopBeaconDiscoveryCompleteCallback = (res: IBeaconError) => void
  19179. /** 接口调用失败的回调函数 */
  19180. type StopBeaconDiscoveryFailCallback = (res: IBeaconError) => void
  19181. /** 接口调用成功的回调函数 */
  19182. type StopBeaconDiscoverySuccessCallback = (res: IBeaconError) => void
  19183. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19184. type StopBluetoothDevicesDiscoveryCompleteCallback = (
  19185. res: BluetoothError
  19186. ) => void
  19187. /** 接口调用失败的回调函数 */
  19188. type StopBluetoothDevicesDiscoveryFailCallback = (
  19189. res: BluetoothError
  19190. ) => void
  19191. /** 接口调用成功的回调函数 */
  19192. type StopBluetoothDevicesDiscoverySuccessCallback = (
  19193. res: BluetoothError
  19194. ) => void
  19195. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19196. type StopCompassCompleteCallback = (res: GeneralCallbackResult) => void
  19197. /** 接口调用失败的回调函数 */
  19198. type StopCompassFailCallback = (res: GeneralCallbackResult) => void
  19199. /** 接口调用成功的回调函数 */
  19200. type StopCompassSuccessCallback = (res: GeneralCallbackResult) => void
  19201. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19202. type StopCompleteCallback = (res: GeneralCallbackResult) => void
  19203. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19204. type StopDeviceMotionListeningCompleteCallback = (
  19205. res: GeneralCallbackResult
  19206. ) => void
  19207. /** 接口调用失败的回调函数 */
  19208. type StopDeviceMotionListeningFailCallback = (
  19209. res: GeneralCallbackResult
  19210. ) => void
  19211. /** 接口调用成功的回调函数 */
  19212. type StopDeviceMotionListeningSuccessCallback = (
  19213. res: GeneralCallbackResult
  19214. ) => void
  19215. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19216. type StopDiscoveryCompleteCallback = (res: Nfcrwerror) => void
  19217. /** 接口调用失败的回调函数 */
  19218. type StopDiscoveryFailCallback = (res: Nfcrwerror) => void
  19219. /** 接口调用成功的回调函数 */
  19220. type StopDiscoverySuccessCallback = (res: Nfcrwerror) => void
  19221. /** 接口调用失败的回调函数 */
  19222. type StopFailCallback = (res: GeneralCallbackResult) => void
  19223. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19224. type StopGyroscopeCompleteCallback = (res: GeneralCallbackResult) => void
  19225. /** 接口调用失败的回调函数 */
  19226. type StopGyroscopeFailCallback = (res: GeneralCallbackResult) => void
  19227. /** 接口调用成功的回调函数 */
  19228. type StopGyroscopeSuccessCallback = (res: GeneralCallbackResult) => void
  19229. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19230. type StopHCECompleteCallback = (res: NFCError) => void
  19231. /** 接口调用失败的回调函数 */
  19232. type StopHCEFailCallback = (res: NFCError) => void
  19233. /** 接口调用成功的回调函数 */
  19234. type StopHCESuccessCallback = (res: NFCError) => void
  19235. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19236. type StopLocalServiceDiscoveryCompleteCallback = (
  19237. res: GeneralCallbackResult
  19238. ) => void
  19239. /** 接口调用失败的回调函数 */
  19240. type StopLocalServiceDiscoveryFailCallback = (
  19241. result: StopLocalServiceDiscoveryFailCallbackResult
  19242. ) => void
  19243. /** 接口调用成功的回调函数 */
  19244. type StopLocalServiceDiscoverySuccessCallback = (
  19245. res: GeneralCallbackResult
  19246. ) => void
  19247. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19248. type StopLocationUpdateCompleteCallback = (
  19249. res: GeneralCallbackResult
  19250. ) => void
  19251. /** 接口调用失败的回调函数 */
  19252. type StopLocationUpdateFailCallback = (res: GeneralCallbackResult) => void
  19253. /** 接口调用成功的回调函数 */
  19254. type StopLocationUpdateSuccessCallback = (
  19255. res: GeneralCallbackResult
  19256. ) => void
  19257. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19258. type StopPreviewCompleteCallback = (res: GeneralCallbackResult) => void
  19259. /** 接口调用失败的回调函数 */
  19260. type StopPreviewFailCallback = (res: GeneralCallbackResult) => void
  19261. /** 接口调用成功的回调函数 */
  19262. type StopPreviewSuccessCallback = (res: GeneralCallbackResult) => void
  19263. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19264. type StopPullDownRefreshCompleteCallback = (
  19265. res: GeneralCallbackResult
  19266. ) => void
  19267. /** 接口调用失败的回调函数 */
  19268. type StopPullDownRefreshFailCallback = (res: GeneralCallbackResult) => void
  19269. /** 接口调用成功的回调函数 */
  19270. type StopPullDownRefreshSuccessCallback = (
  19271. res: GeneralCallbackResult
  19272. ) => void
  19273. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19274. type StopRecordCompleteCallback = (res: GeneralCallbackResult) => void
  19275. /** 接口调用失败的回调函数 */
  19276. type StopRecordFailCallback = (res: GeneralCallbackResult) => void
  19277. /** 接口调用成功的回调函数 */
  19278. type StopSuccessCallback = (res: GeneralCallbackResult) => void
  19279. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19280. type StopVoiceCompleteCallback = (res: GeneralCallbackResult) => void
  19281. /** 接口调用失败的回调函数 */
  19282. type StopVoiceFailCallback = (res: GeneralCallbackResult) => void
  19283. /** 接口调用成功的回调函数 */
  19284. type StopVoiceSuccessCallback = (res: GeneralCallbackResult) => void
  19285. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19286. type StopWifiCompleteCallback = (res: WifiError) => void
  19287. /** 接口调用失败的回调函数 */
  19288. type StopWifiFailCallback = (res: WifiError) => void
  19289. /** 接口调用成功的回调函数 */
  19290. type StopWifiSuccessCallback = (res: WifiError) => void
  19291. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19292. type SubscribeVoIPVideoMembersCompleteCallback = (
  19293. res: GeneralCallbackResult
  19294. ) => void
  19295. /** 接口调用失败的回调函数 */
  19296. type SubscribeVoIPVideoMembersFailCallback = (
  19297. res: GeneralCallbackResult
  19298. ) => void
  19299. /** 接口调用成功的回调函数 */
  19300. type SubscribeVoIPVideoMembersSuccessCallback = (
  19301. res: GeneralCallbackResult
  19302. ) => void
  19303. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19304. type SwitchCameraCompleteCallback = (res: GeneralCallbackResult) => void
  19305. /** 接口调用失败的回调函数 */
  19306. type SwitchCameraFailCallback = (res: GeneralCallbackResult) => void
  19307. /** 接口调用成功的回调函数 */
  19308. type SwitchCameraSuccessCallback = (res: GeneralCallbackResult) => void
  19309. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19310. type SwitchTabCompleteCallback = (res: GeneralCallbackResult) => void
  19311. /** 接口调用失败的回调函数 */
  19312. type SwitchTabFailCallback = (res: GeneralCallbackResult) => void
  19313. /** 接口调用成功的回调函数 */
  19314. type SwitchTabSuccessCallback = (res: GeneralCallbackResult) => void
  19315. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19316. type TakePhotoCompleteCallback = (res: GeneralCallbackResult) => void
  19317. /** 接口调用失败的回调函数 */
  19318. type TakePhotoFailCallback = (res: GeneralCallbackResult) => void
  19319. /** 接口调用成功的回调函数 */
  19320. type TakePhotoSuccessCallback = (
  19321. result: TakePhotoSuccessCallbackResult
  19322. ) => void
  19323. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19324. type ToScreenLocationCompleteCallback = (res: GeneralCallbackResult) => void
  19325. /** 接口调用失败的回调函数 */
  19326. type ToScreenLocationFailCallback = (res: GeneralCallbackResult) => void
  19327. /** 接口调用成功的回调函数 */
  19328. type ToScreenLocationSuccessCallback = (
  19329. result: ToScreenLocationSuccessCallbackResult
  19330. ) => void
  19331. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19332. type ToggleTorchCompleteCallback = (res: GeneralCallbackResult) => void
  19333. /** 接口调用失败的回调函数 */
  19334. type ToggleTorchFailCallback = (res: GeneralCallbackResult) => void
  19335. /** 接口调用成功的回调函数 */
  19336. type ToggleTorchSuccessCallback = (res: GeneralCallbackResult) => void
  19337. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19338. type TransceiveCompleteCallback = (res: Nfcrwerror) => void
  19339. /** 接口调用失败的回调函数 */
  19340. type TransceiveFailCallback = (res: Nfcrwerror) => void
  19341. /** 接口调用成功的回调函数 */
  19342. type TransceiveSuccessCallback = (
  19343. result: TransceiveSuccessCallbackResult
  19344. ) => void
  19345. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19346. type TranslateMarkerCompleteCallback = (res: GeneralCallbackResult) => void
  19347. /** 接口调用失败的回调函数 */
  19348. type TranslateMarkerFailCallback = (res: GeneralCallbackResult) => void
  19349. /** 接口调用成功的回调函数 */
  19350. type TranslateMarkerSuccessCallback = (res: GeneralCallbackResult) => void
  19351. type UDPSocketOffCloseCallback = (res: GeneralCallbackResult) => void
  19352. /** 错误事件的回调函数 */
  19353. type UDPSocketOffErrorCallback = (
  19354. result: UDPSocketOnErrorCallbackResult
  19355. ) => void
  19356. type UDPSocketOnCloseCallback = (res: GeneralCallbackResult) => void
  19357. type UDPSocketOnErrorCallback = (
  19358. result: UDPSocketOnErrorCallbackResult
  19359. ) => void
  19360. /** 收到消息的事件的回调函数 */
  19361. type UDPSocketOnMessageCallback = (
  19362. result: UDPSocketOnMessageCallbackResult
  19363. ) => void
  19364. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19365. type UndoCompleteCallback = (res: GeneralCallbackResult) => void
  19366. /** 接口调用失败的回调函数 */
  19367. type UndoFailCallback = (res: GeneralCallbackResult) => void
  19368. /** 接口调用成功的回调函数 */
  19369. type UndoSuccessCallback = (res: GeneralCallbackResult) => void
  19370. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19371. type UnlinkCompleteCallback = (res: GeneralCallbackResult) => void
  19372. /** 接口调用失败的回调函数 */
  19373. type UnlinkFailCallback = (result: UnlinkFailCallbackResult) => void
  19374. /** 接口调用成功的回调函数 */
  19375. type UnlinkSuccessCallback = (res: GeneralCallbackResult) => void
  19376. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19377. type UnzipCompleteCallback = (res: GeneralCallbackResult) => void
  19378. /** 接口调用失败的回调函数 */
  19379. type UnzipFailCallback = (result: UnzipFailCallbackResult) => void
  19380. /** 接口调用成功的回调函数 */
  19381. type UnzipSuccessCallback = (res: GeneralCallbackResult) => void
  19382. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19383. type UpdateGroundOverlayCompleteCallback = (
  19384. res: GeneralCallbackResult
  19385. ) => void
  19386. /** 接口调用失败的回调函数 */
  19387. type UpdateGroundOverlayFailCallback = (res: GeneralCallbackResult) => void
  19388. /** 接口调用成功的回调函数 */
  19389. type UpdateGroundOverlaySuccessCallback = (
  19390. res: GeneralCallbackResult
  19391. ) => void
  19392. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19393. type UpdateShareMenuCompleteCallback = (res: GeneralCallbackResult) => void
  19394. /** 接口调用失败的回调函数 */
  19395. type UpdateShareMenuFailCallback = (res: GeneralCallbackResult) => void
  19396. /** 接口调用成功的回调函数 */
  19397. type UpdateShareMenuSuccessCallback = (res: GeneralCallbackResult) => void
  19398. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19399. type UpdateVoIPChatMuteConfigCompleteCallback = (
  19400. res: GeneralCallbackResult
  19401. ) => void
  19402. /** 接口调用失败的回调函数 */
  19403. type UpdateVoIPChatMuteConfigFailCallback = (
  19404. res: GeneralCallbackResult
  19405. ) => void
  19406. /** 接口调用成功的回调函数 */
  19407. type UpdateVoIPChatMuteConfigSuccessCallback = (
  19408. res: GeneralCallbackResult
  19409. ) => void
  19410. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19411. type UpdateWeChatAppCompleteCallback = (res: GeneralCallbackResult) => void
  19412. /** 接口调用失败的回调函数 */
  19413. type UpdateWeChatAppFailCallback = (res: GeneralCallbackResult) => void
  19414. /** 接口调用成功的回调函数 */
  19415. type UpdateWeChatAppSuccessCallback = (res: GeneralCallbackResult) => void
  19416. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19417. type UploadFileCompleteCallback = (res: GeneralCallbackResult) => void
  19418. /** 接口调用失败的回调函数 */
  19419. type UploadFileFailCallback = (res: GeneralCallbackResult) => void
  19420. /** 接口调用成功的回调函数 */
  19421. type UploadFileSuccessCallback = (
  19422. result: UploadFileSuccessCallbackResult
  19423. ) => void
  19424. /** 上传进度变化事件的回调函数 */
  19425. type UploadTaskOffProgressUpdateCallback = (
  19426. result: UploadTaskOnProgressUpdateCallbackResult
  19427. ) => void
  19428. /** 上传进度变化事件的回调函数 */
  19429. type UploadTaskOnProgressUpdateCallback = (
  19430. result: UploadTaskOnProgressUpdateCallbackResult
  19431. ) => void
  19432. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19433. type VibrateLongCompleteCallback = (res: GeneralCallbackResult) => void
  19434. /** 接口调用失败的回调函数 */
  19435. type VibrateLongFailCallback = (res: GeneralCallbackResult) => void
  19436. /** 接口调用成功的回调函数 */
  19437. type VibrateLongSuccessCallback = (res: GeneralCallbackResult) => void
  19438. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19439. type VibrateShortCompleteCallback = (res: GeneralCallbackResult) => void
  19440. /** 接口调用失败的回调函数 */
  19441. type VibrateShortFailCallback = (res: GeneralCallbackResult) => void
  19442. /** 接口调用成功的回调函数 */
  19443. type VibrateShortSuccessCallback = (res: GeneralCallbackResult) => void
  19444. /** 主线程/Worker 线程向当前线程发送的消息的事件的回调函数 */
  19445. type WorkerOnMessageCallback = (
  19446. result: WorkerOnMessageCallbackResult
  19447. ) => void
  19448. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19449. type WriteBLECharacteristicValueCompleteCallback = (
  19450. res: BluetoothError
  19451. ) => void
  19452. /** 接口调用失败的回调函数 */
  19453. type WriteBLECharacteristicValueFailCallback = (res: BluetoothError) => void
  19454. /** 接口调用成功的回调函数 */
  19455. type WriteBLECharacteristicValueSuccessCallback = (
  19456. res: BluetoothError
  19457. ) => void
  19458. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19459. type WriteCharacteristicValueCompleteCallback = (
  19460. res: GeneralCallbackResult
  19461. ) => void
  19462. /** 接口调用失败的回调函数 */
  19463. type WriteCharacteristicValueFailCallback = (
  19464. res: GeneralCallbackResult
  19465. ) => void
  19466. /** 接口调用成功的回调函数 */
  19467. type WriteCharacteristicValueSuccessCallback = (
  19468. res: GeneralCallbackResult
  19469. ) => void
  19470. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19471. type WriteFileCompleteCallback = (res: GeneralCallbackResult) => void
  19472. /** 接口调用失败的回调函数 */
  19473. type WriteFileFailCallback = (result: WriteFileFailCallbackResult) => void
  19474. /** 接口调用成功的回调函数 */
  19475. type WriteFileSuccessCallback = (res: GeneralCallbackResult) => void
  19476. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  19477. type WriteNdefMessageCompleteCallback = (res: Nfcrwerror) => void
  19478. /** 接口调用失败的回调函数 */
  19479. type WriteNdefMessageFailCallback = (res: Nfcrwerror) => void
  19480. /** 接口调用成功的回调函数 */
  19481. type WriteNdefMessageSuccessCallback = (res: Nfcrwerror) => void
  19482. /** 接口调用失败的回调函数 */
  19483. type WxGetFileInfoFailCallback = (res: GeneralCallbackResult) => void
  19484. /** 接口调用成功的回调函数 */
  19485. type WxGetFileInfoSuccessCallback = (
  19486. result: WxGetFileInfoSuccessCallbackResult
  19487. ) => void
  19488. /** 接口调用成功的回调函数 */
  19489. type WxGetSavedFileListSuccessCallback = (
  19490. result: WxGetSavedFileListSuccessCallbackResult
  19491. ) => void
  19492. /** 接口调用失败的回调函数 */
  19493. type WxRemoveSavedFileFailCallback = (res: GeneralCallbackResult) => void
  19494. /** 接口调用失败的回调函数 */
  19495. type WxSaveFileFailCallback = (res: GeneralCallbackResult) => void
  19496. /** 接口调用成功的回调函数 */
  19497. type WxStartRecordSuccessCallback = (
  19498. result: StartRecordSuccessCallbackResult
  19499. ) => void
  19500. /** 接口调用成功的回调函数 */
  19501. type WxStopRecordSuccessCallback = (res: GeneralCallbackResult) => void
  19502. }
  19503. /** [clearInterval(number intervalID)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/clearInterval.html)
  19504. *
  19505. * 取消由 setInterval 设置的定时器。 */
  19506. declare function clearInterval(
  19507. /** 要取消的定时器的 ID */
  19508. intervalID: number
  19509. ): void
  19510. /** [clearTimeout(number timeoutID)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/clearTimeout.html)
  19511. *
  19512. * 取消由 setTimeout 设置的定时器。 */
  19513. declare function clearTimeout(
  19514. /** 要取消的定时器的 ID */
  19515. timeoutID: number
  19516. ): void
  19517. /** [number setInterval(function callback, number delay, any rest)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/setInterval.html)
  19518. *
  19519. * 设定一个定时器。按照指定的周期(以毫秒计)来执行注册的回调函数 */
  19520. declare function setInterval(
  19521. /** 回调函数 */
  19522. callback: (...args: any[]) => any,
  19523. /** 执行回调函数之间的时间间隔,单位 ms。 */
  19524. delay?: number,
  19525. /** param1, param2, ..., paramN 等附加参数,它们会作为参数传递给回调函数。 */
  19526. rest?: any
  19527. ): number
  19528. /** [number setTimeout(function callback, number delay, any rest)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/setTimeout.html)
  19529. *
  19530. * 设定一个定时器。在定时到期以后执行注册的回调函数 */
  19531. declare function setTimeout(
  19532. /** 回调函数 */
  19533. callback: (...args: any[]) => any,
  19534. /** 延迟的时间,函数的调用会在该延迟之后发生,单位 ms。 */
  19535. delay?: number,
  19536. /** param1, param2, ..., paramN 等附加参数,它们会作为参数传递给回调函数。 */
  19537. rest?: any
  19538. ): number