lib.wx.api.d.ts 1.4 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387
  1. /*! *****************************************************************************
  2. Copyright (c) 2023 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. /// <reference path="./lib.wx.xr-frame.d.ts" />
  20. declare namespace WechatMiniprogram {
  21. interface AccessOption {
  22. /** 要判断是否存在的文件/目录路径 (本地路径) */
  23. path: string
  24. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  25. complete?: AccessCompleteCallback
  26. /** 接口调用失败的回调函数 */
  27. fail?: AccessFailCallback
  28. /** 接口调用成功的回调函数 */
  29. success?: AccessSuccessCallback
  30. }
  31. /** 账号信息 */
  32. interface AccountInfo {
  33. /** 小程序账号信息 */
  34. miniProgram: MiniProgram
  35. /** 插件账号信息(仅在插件中调用时包含这一项) */
  36. plugin: Plugin
  37. }
  38. interface AddArcOption {
  39. /** 终点 */
  40. end: MapPostion
  41. /** 圆弧 id */
  42. id: number
  43. /** 起始点 */
  44. start: MapPostion
  45. /** 夹角角度 */
  46. angle?: number
  47. /** 线的颜色 */
  48. color?: number
  49. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  50. complete?: AddArcCompleteCallback
  51. /** 接口调用失败的回调函数 */
  52. fail?: AddArcFailCallback
  53. /** 途经点 */
  54. pass?: MapPostion
  55. /** 接口调用成功的回调函数 */
  56. success?: AddArcSuccessCallback
  57. /** 线宽 */
  58. width?: number
  59. }
  60. interface AddCardOption {
  61. /** 需要添加的卡券列表 */
  62. cardList: AddCardRequestInfo[]
  63. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  64. complete?: AddCardCompleteCallback
  65. /** 接口调用失败的回调函数 */
  66. fail?: AddCardFailCallback
  67. /** 接口调用成功的回调函数 */
  68. success?: AddCardSuccessCallback
  69. }
  70. /** 需要添加的卡券列表 */
  71. interface AddCardRequestInfo {
  72. /** 卡券的扩展参数。需将 CardExt 对象 JSON 序列化为**字符串**传入 */
  73. cardExt: string
  74. /** 卡券 ID */
  75. cardId: string
  76. }
  77. /** 卡券添加结果列表 */
  78. interface AddCardResponseInfo {
  79. /** 卡券的扩展参数,结构请参考下文 */
  80. cardExt: string
  81. /** 用户领取到卡券的 ID */
  82. cardId: string
  83. /** 加密 code,为用户领取到卡券的code加密后的字符串,解密请参照:[code 解码接口](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1499332673_Unm7V) */
  84. code: string
  85. /** 是否成功 */
  86. isSuccess: boolean
  87. }
  88. interface AddCardSuccessCallbackResult {
  89. /** 卡券添加结果列表 */
  90. cardList: AddCardResponseInfo[]
  91. errMsg: string
  92. }
  93. interface AddCustomLayerOption {
  94. /** 个性化图层id */
  95. layerId: string
  96. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  97. complete?: AddCustomLayerCompleteCallback
  98. /** 接口调用失败的回调函数 */
  99. fail?: AddCustomLayerFailCallback
  100. /** 接口调用成功的回调函数 */
  101. success?: AddCustomLayerSuccessCallback
  102. }
  103. interface AddFileToFavoritesOption {
  104. /** 要收藏的文件地址,必须为本地路径或临时路径 */
  105. filePath: string
  106. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  107. complete?: AddFileToFavoritesCompleteCallback
  108. /** 接口调用失败的回调函数 */
  109. fail?: AddFileToFavoritesFailCallback
  110. /** 自定义文件名,若留空则使用filePath中的文件名 */
  111. fileName?: string
  112. /** 接口调用成功的回调函数 */
  113. success?: AddFileToFavoritesSuccessCallback
  114. }
  115. interface AddGroundOverlayOption {
  116. /** 图片覆盖的经纬度范围 */
  117. bounds: MapBounds
  118. /** 图片图层 id */
  119. id: string
  120. /** 图片路径,支持网络图片、临时路径、代码包路径 */
  121. src: string
  122. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  123. complete?: AddGroundOverlayCompleteCallback
  124. /** 接口调用失败的回调函数 */
  125. fail?: AddGroundOverlayFailCallback
  126. /** 图层透明度 */
  127. opacity?: number
  128. /** 接口调用成功的回调函数 */
  129. success?: AddGroundOverlaySuccessCallback
  130. /** 是否可见 */
  131. visible?: boolean
  132. /** 图层绘制顺序 */
  133. zIndex?: number
  134. }
  135. interface AddMarkersOption {
  136. /** 同传入 map 组件的 marker 属性 */
  137. markers: any[]
  138. /** 是否先清空地图上所有 marker */
  139. clear?: boolean
  140. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  141. complete?: AddMarkersCompleteCallback
  142. /** 接口调用失败的回调函数 */
  143. fail?: AddMarkersFailCallback
  144. /** 接口调用成功的回调函数 */
  145. success?: AddMarkersSuccessCallback
  146. }
  147. interface AddPhoneCalendarOption {
  148. /** 开始时间的 unix 时间戳 */
  149. startTime: number
  150. /** 日历事件标题 */
  151. title: string
  152. /** 是否提醒,默认 true */
  153. alarm?: boolean
  154. /** 提醒提前量,单位秒,默认 0 表示开始时提醒 */
  155. alarmOffset?: number
  156. /** 是否全天事件,默认 false */
  157. allDay?: boolean
  158. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  159. complete?: AddPhoneCalendarCompleteCallback
  160. /** 事件说明 */
  161. description?: string
  162. /** 结束时间的 unix 时间戳,默认与开始时间相同 */
  163. endTime?: string
  164. /** 接口调用失败的回调函数 */
  165. fail?: AddPhoneCalendarFailCallback
  166. /** 事件位置 */
  167. location?: string
  168. /** 接口调用成功的回调函数 */
  169. success?: AddPhoneCalendarSuccessCallback
  170. }
  171. interface AddPhoneContactOption {
  172. /** 名字 */
  173. firstName: string
  174. /** 联系地址城市 */
  175. addressCity?: string
  176. /** 联系地址国家 */
  177. addressCountry?: string
  178. /** 联系地址邮政编码 */
  179. addressPostalCode?: string
  180. /** 联系地址省份 */
  181. addressState?: string
  182. /** 联系地址街道 */
  183. addressStreet?: string
  184. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  185. complete?: AddPhoneContactCompleteCallback
  186. /** 电子邮件 */
  187. email?: string
  188. /** 接口调用失败的回调函数 */
  189. fail?: AddPhoneContactFailCallback
  190. /** 住宅地址城市 */
  191. homeAddressCity?: string
  192. /** 住宅地址国家 */
  193. homeAddressCountry?: string
  194. /** 住宅地址邮政编码 */
  195. homeAddressPostalCode?: string
  196. /** 住宅地址省份 */
  197. homeAddressState?: string
  198. /** 住宅地址街道 */
  199. homeAddressStreet?: string
  200. /** 住宅传真 */
  201. homeFaxNumber?: string
  202. /** 住宅电话 */
  203. homePhoneNumber?: string
  204. /** 公司电话 */
  205. hostNumber?: string
  206. /** 姓氏 */
  207. lastName?: string
  208. /** 中间名 */
  209. middleName?: string
  210. /** 手机号 */
  211. mobilePhoneNumber?: string
  212. /** 昵称 */
  213. nickName?: string
  214. /** 公司 */
  215. organization?: string
  216. /** 头像本地文件路径 */
  217. photoFilePath?: string
  218. /** 备注 */
  219. remark?: string
  220. /** 接口调用成功的回调函数 */
  221. success?: AddPhoneContactSuccessCallback
  222. /** 职位 */
  223. title?: string
  224. /** 网站 */
  225. url?: string
  226. /** 微信号 */
  227. weChatNumber?: string
  228. /** 工作地址城市 */
  229. workAddressCity?: string
  230. /** 工作地址国家 */
  231. workAddressCountry?: string
  232. /** 工作地址邮政编码 */
  233. workAddressPostalCode?: string
  234. /** 工作地址省份 */
  235. workAddressState?: string
  236. /** 工作地址街道 */
  237. workAddressStreet?: string
  238. /** 工作传真 */
  239. workFaxNumber?: string
  240. /** 工作电话 */
  241. workPhoneNumber?: string
  242. }
  243. interface AddPhoneRepeatCalendarOption {
  244. /** 开始时间的 unix 时间戳 (1970年1月1日开始所经过的秒数) */
  245. startTime: number
  246. /** 日历事件标题 */
  247. title: string
  248. /** 是否提醒,默认 true */
  249. alarm?: boolean
  250. /** 提醒提前量,单位秒,默认 0 表示开始时提醒 */
  251. alarmOffset?: number
  252. /** 是否全天事件,默认 false */
  253. allDay?: boolean
  254. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  255. complete?: AddPhoneRepeatCalendarCompleteCallback
  256. /** 事件说明 */
  257. description?: string
  258. /** 结束时间的 unix 时间戳,默认与开始时间相同 */
  259. endTime?: string
  260. /** 接口调用失败的回调函数 */
  261. fail?: AddPhoneRepeatCalendarFailCallback
  262. /** 事件位置 */
  263. location?: string
  264. /** 重复周期结束时间的 unix 时间戳,不填表示一直重复 */
  265. repeatEndTime?: number
  266. /** 重复周期,默认 month 每月重复
  267. *
  268. * 可选值:
  269. * - 'day': 每天重复;
  270. * - 'week': 每周重复;
  271. * - 'month': 每月重复。该模式日期不能大于 28 日;
  272. * - 'year': 每年重复; */
  273. repeatInterval?: 'day' | 'week' | 'month' | 'year'
  274. /** 接口调用成功的回调函数 */
  275. success?: AddPhoneRepeatCalendarSuccessCallback
  276. }
  277. interface AddServiceOption {
  278. /** 描述service的Object */
  279. service: BLEPeripheralService
  280. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  281. complete?: AddServiceCompleteCallback
  282. /** 接口调用失败的回调函数 */
  283. fail?: AddServiceFailCallback
  284. /** 接口调用成功的回调函数 */
  285. success?: AddServiceSuccessCallback
  286. }
  287. interface AddVideoToFavoritesOption {
  288. /** 要收藏的视频地址,必须为本地路径或临时路径 */
  289. videoPath: string
  290. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  291. complete?: AddVideoToFavoritesCompleteCallback
  292. /** 接口调用失败的回调函数 */
  293. fail?: AddVideoToFavoritesFailCallback
  294. /** 接口调用成功的回调函数 */
  295. success?: AddVideoToFavoritesSuccessCallback
  296. /** 缩略图路径,若留空则使用视频首帧 */
  297. thumbPath?: string
  298. }
  299. interface AddVisualLayerOption {
  300. /** 可视化图层id([创建图层指引](https://lbs.qq.com/dev/console/layers/layerEdit)) */
  301. layerId: string
  302. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  303. complete?: AddVisualLayerCompleteCallback
  304. /** 接口调用失败的回调函数 */
  305. fail?: AddVisualLayerFailCallback
  306. /** 刷新周期,单位秒 */
  307. interval?: number
  308. /** 图层透明度 */
  309. opacity?: number
  310. /** 接口调用成功的回调函数 */
  311. success?: AddVisualLayerSuccessCallback
  312. /** 图层绘制顺序 */
  313. zIndex?: number
  314. }
  315. /** 广播自定义参数 */
  316. interface AdvertiseReqObj {
  317. /** 需要基础库: `2.20.1`
  318. *
  319. * 以 beacon 设备形式广播的参数。 */
  320. beacon?: BeaconInfoObj
  321. /** 当前设备是否可连接 */
  322. connectable?: boolean
  323. /** 广播中 deviceName 字段,默认为空 */
  324. deviceName?: string
  325. /** 广播的制造商信息。仅安卓支持,iOS 因系统限制无法定制。 */
  326. manufacturerData?: ManufacturerData[]
  327. /** 要广播的服务 UUID 列表。使用 16/32 位 UUID 时请参考注意事项。 */
  328. serviceUuids?: string[]
  329. }
  330. /** animationData */
  331. interface AnimationExportResult {
  332. actions: IAnyObject[]
  333. }
  334. /** 动画效果 */
  335. interface AnimationOption {
  336. /** 动画变化时间,单位 ms */
  337. duration?: number
  338. /** 动画变化方式
  339. *
  340. * 可选值:
  341. * - 'linear': 动画从头到尾的速度是相同的;
  342. * - 'easeIn': 动画以低速开始;
  343. * - 'easeOut': 动画以低速结束;
  344. * - 'easeInOut': 动画以低速开始和结束; */
  345. timingFunc?: 'linear' | 'easeIn' | 'easeOut' | 'easeInOut'
  346. }
  347. interface AppAuthorizeSetting {
  348. /** 允许微信使用相册的开关(仅 iOS 有效) */
  349. albumAuthorized: 'authorized' | 'denied' | 'not determined'
  350. /** 允许微信使用蓝牙的开关(仅 iOS 有效) */
  351. bluetoothAuthorized: 'authorized' | 'denied' | 'not determined'
  352. /** 允许微信使用摄像头的开关 */
  353. cameraAuthorized: 'authorized' | 'denied' | 'not determined'
  354. /** 允许微信使用定位的开关 */
  355. locationAuthorized: 'authorized' | 'denied' | 'not determined'
  356. /** 定位准确度。true 表示模糊定位,false 表示精确定位(仅 iOS 有效) */
  357. locationReducedAccuracy: boolean
  358. /** 允许微信使用麦克风的开关 */
  359. microphoneAuthorized: 'authorized' | 'denied' | 'not determined'
  360. /** 允许微信通知带有提醒的开关(仅 iOS 有效) */
  361. notificationAlertAuthorized: 'authorized' | 'denied' | 'not determined'
  362. /** 允许微信通知的开关 */
  363. notificationAuthorized: 'authorized' | 'denied' | 'not determined'
  364. /** 允许微信通知带有标记的开关(仅 iOS 有效) */
  365. notificationBadgeAuthorized: 'authorized' | 'denied' | 'not determined'
  366. /** 允许微信通知带有声音的开关(仅 iOS 有效) */
  367. notificationSoundAuthorized: 'authorized' | 'denied' | 'not determined'
  368. /** 允许微信读写日历的开关 */
  369. phoneCalendarAuthorized: 'authorized' | 'denied' | 'not determined'
  370. }
  371. interface AppBaseInfo {
  372. /** 客户端基础库版本 */
  373. SDKVersion: string
  374. /** 是否已打开调试。可通过右上角菜单或 [wx.setEnableDebug](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html) 打开调试。 */
  375. enableDebug: boolean
  376. /** 当前小程序运行的宿主环境 */
  377. host: AppBaseInfoHost
  378. /** 微信设置的语言 */
  379. language: string
  380. /** 微信版本号 */
  381. version: string
  382. /** 系统当前主题,取值为`light`或`dark`,全局配置`"darkmode":true`时才能获取,否则为 undefined (不支持小游戏)
  383. *
  384. * 可选值:
  385. * - 'dark': 深色主题;
  386. * - 'light': 浅色主题; */
  387. theme?: 'dark' | 'light'
  388. }
  389. /** 当前小程序运行的宿主环境 */
  390. interface AppBaseInfoHost {
  391. /** 宿主 app(第三方App) 对应的 appId (当小程序运行在第三方App环境时才返回) */
  392. appId: string
  393. }
  394. interface AppendFileOption {
  395. /** 要追加的文本或二进制数据 */
  396. data: string | ArrayBuffer
  397. /** 要追加内容的文件路径 (本地路径) */
  398. filePath: string
  399. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  400. complete?: AppendFileCompleteCallback
  401. /** 指定写入文件的字符编码
  402. *
  403. * 可选值:
  404. * - 'ascii': ;
  405. * - 'base64': ;
  406. * - 'binary': ;
  407. * - 'hex': ;
  408. * - 'ucs2': 以小端序读取;
  409. * - 'ucs-2': 以小端序读取;
  410. * - 'utf16le': 以小端序读取;
  411. * - 'utf-16le': 以小端序读取;
  412. * - 'utf-8': ;
  413. * - 'utf8': ;
  414. * - 'latin1': ; */
  415. encoding?:
  416. | 'ascii'
  417. | 'base64'
  418. | 'binary'
  419. | 'hex'
  420. | 'ucs2'
  421. | 'ucs-2'
  422. | 'utf16le'
  423. | 'utf-16le'
  424. | 'utf-8'
  425. | 'utf8'
  426. | 'latin1'
  427. /** 接口调用失败的回调函数 */
  428. fail?: AppendFileFailCallback
  429. /** 接口调用成功的回调函数 */
  430. success?: AppendFileSuccessCallback
  431. }
  432. interface ApplyBlusherStickMakeupOption {
  433. /** 上色程度 0-1 */
  434. alpha: number
  435. blendMode: string
  436. /** 左腮红资源路径 */
  437. path: string
  438. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  439. complete?: ApplyBlusherStickMakeupCompleteCallback
  440. /** 接口调用失败的回调函数 */
  441. fail?: ApplyBlusherStickMakeupFailCallback
  442. /** 接口调用成功的回调函数 */
  443. success?: ApplyBlusherStickMakeupSuccessCallback
  444. }
  445. interface ApplyEyeBrowMakeupOption {
  446. /** 上色程度 0-1 */
  447. alpha: number
  448. blendMode: string
  449. path: string
  450. shrinkRate: number
  451. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  452. complete?: ApplyEyeBrowMakeupCompleteCallback
  453. /** 接口调用失败的回调函数 */
  454. fail?: ApplyEyeBrowMakeupFailCallback
  455. /** 接口调用成功的回调函数 */
  456. success?: ApplyEyeBrowMakeupSuccessCallback
  457. }
  458. interface ApplyEyeShadowMakeupOption {
  459. /** 上色程度 0-1 */
  460. alpha: number
  461. blendMode: string
  462. /** 眼影资源路径 */
  463. path: string
  464. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  465. complete?: ApplyEyeShadowMakeupCompleteCallback
  466. /** 接口调用失败的回调函数 */
  467. fail?: ApplyEyeShadowMakeupFailCallback
  468. /** 细致效果图片资源路径 */
  469. shimmerPosition?: string
  470. /** 细致效果图片资源 md5 */
  471. shimmerPositionMD5?: string
  472. /** 接口调用成功的回调函数 */
  473. success?: ApplyEyeShadowMakeupSuccessCallback
  474. }
  475. interface ApplyFaceContourMakeupOption {
  476. alpha: number
  477. /** 高光资源路径 */
  478. path: string
  479. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  480. complete?: ApplyFaceContourMakeupCompleteCallback
  481. /** 接口调用失败的回调函数 */
  482. fail?: ApplyFaceContourMakeupFailCallback
  483. /** 接口调用成功的回调函数 */
  484. success?: ApplyFaceContourMakeupSuccessCallback
  485. }
  486. interface ApplyFilterOption {
  487. /** 滤镜效果透明度,范围是 0-1 */
  488. alpha: number
  489. /** 滤镜资源路径 */
  490. path: string
  491. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  492. complete?: ApplyFilterCompleteCallback
  493. /** 接口调用失败的回调函数 */
  494. fail?: ApplyFilterFailCallback
  495. /** 滤镜资源 md5 */
  496. md5?: string
  497. /** 接口调用成功的回调函数 */
  498. success?: ApplyFilterSuccessCallback
  499. }
  500. interface ApplyLipStickMakeupOption {
  501. /** 上色程度 0-1 */
  502. alpha: number
  503. blendMode: string
  504. faceModel: string
  505. path: string
  506. shimmerPath: string
  507. shimmerType: string
  508. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  509. complete?: ApplyLipStickMakeupCompleteCallback
  510. /** 接口调用失败的回调函数 */
  511. fail?: ApplyLipStickMakeupFailCallback
  512. /** 接口调用成功的回调函数 */
  513. success?: ApplyLipStickMakeupSuccessCallback
  514. }
  515. interface ApplyStickerOption {
  516. /** 贴纸类型 */
  517. stickers: Sticker[]
  518. /** 贴纸类型 */
  519. type: string
  520. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  521. complete?: ApplyStickerCompleteCallback
  522. /** 接口调用失败的回调函数 */
  523. fail?: ApplyStickerFailCallback
  524. /** 接口调用成功的回调函数 */
  525. success?: ApplyStickerSuccessCallback
  526. templateTransSet?: IAnyObject
  527. }
  528. interface Asset {
  529. src: string
  530. /** 可选值:
  531. * - 'font': 字体;
  532. * - 'image': 图片; */
  533. type: 'font' | 'image'
  534. }
  535. /** 需要基础库: `2.19.0`
  536. *
  537. * AudioBuffer接口表示存在内存里的一段短小的音频资源,利用[WebAudioContext.decodeAudioData](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.decodeAudioData.html)方法从一个音频文件构建,或者利用 [AudioContext.createBuffer](#)从原始数据构建。把音频放入AudioBuffer后,可以传入到一个 AudioBufferSourceNode进行播放。 */
  538. interface AudioBuffer {
  539. /** 返回存储在缓存区的PCM数据的时长(单位为秒) */
  540. duration: number
  541. /** 返回存储在缓存区的PCM数据的采样帧率 */
  542. length: number
  543. /** 储存在缓存区的PCM数据的通道数 */
  544. numberOfChannels: number
  545. /** 存储在缓存区的PCM数据的采样率(单位为sample/s) */
  546. sampleRate: number
  547. /** [AudioBuffer.copyFromChannel()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.copyFromChannel.html)
  548. *
  549. * 在插件中使用:不支持
  550. *
  551. * 从AudioBuffer的指定频道复制到数组终端。 */
  552. copyFromChannel(): void
  553. /** [AudioBuffer.copyToChannel(Float32Array source, number channelNumber, number startInChannel)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.copyToChannel.html)
  554. *
  555. * 在插件中使用:不支持
  556. *
  557. * 从指定数组复制样本到audioBuffer的特定通道
  558. *
  559. * **示例代码**
  560. *
  561. * 示例代码参考AudioBuffer.copyFromChannel */
  562. copyToChannel(
  563. /** 需要复制的源数组 */
  564. source: Float32Array,
  565. /** 需要复制到的目的通道号 */
  566. channelNumber: number,
  567. /** 复制偏移数据量 */
  568. startInChannel: number
  569. ): void
  570. /** [Float32Array AudioBuffer.getChannelData(number channel)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.getChannelData.html)
  571. *
  572. * 在插件中使用:不支持
  573. *
  574. * 返回一个 Float32Array,包含了带有频道的PCM数据,由频道参数定义(有0代表第一个频道) */
  575. getChannelData(
  576. /** 要获取特定通道数据的索引 */
  577. channel: number
  578. ): Float32Array
  579. }
  580. /** 需要基础库: `2.19.0`
  581. *
  582. * AudioParam 接口代表音频相关的参数,通常是 AudioNode(例如 GainNode.gain)的参数 */
  583. interface AudioParam {
  584. /** 代表被具体的 AudioNode 创建的 AudioParam 的属性的初始值(只读) */
  585. defaultValue: number
  586. /** 代表参数有效范围的最大可能值(只读) */
  587. maxValue: number
  588. /** 代表参数有效范围的最小可能值(只读) */
  589. minValue: number
  590. /** 当前属性的值(比如音量值或播放倍速值)(可读可写) */
  591. value: number
  592. }
  593. interface AuthPrivateMessageOption {
  594. /** shareTicket。可以从 wx.onShow 中获取。详情 [shareTicket](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
  595. shareTicket: string
  596. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  597. complete?: AuthPrivateMessageCompleteCallback
  598. /** 接口调用失败的回调函数 */
  599. fail?: AuthPrivateMessageFailCallback
  600. /** 接口调用成功的回调函数 */
  601. success?: AuthPrivateMessageSuccessCallback
  602. }
  603. interface AuthPrivateMessageSuccessCallbackResult {
  604. /** 经过加密的activityId,解密后可得到原始的activityId。若解密后得到的activityId可以与开发者后台的活动id对应上则验证通过,否则表明valid字段不可靠(被篡改) 详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  605. encryptedData: string
  606. /** 错误信息 */
  607. errMsg: string
  608. /** 加密算法的初始向量,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  609. iv: string
  610. /** 验证是否通过 */
  611. valid: boolean
  612. }
  613. /** 用户授权设置信息,详情参考[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) */
  614. interface AuthSetting {
  615. /** 是否授权系统日历,对应接口 [wx.addPhoneRepeatCalendar](https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneRepeatCalendar.html)、[wx.addPhoneCalendar](https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneCalendar.html) */
  616. 'scope.addPhoneCalendar'?: boolean
  617. /** 是否添加通讯录联系人,对应接口 [wx.addPhoneContact](https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.addPhoneContact.html) */
  618. 'scope.addPhoneContact'?: boolean
  619. /** 是否授权通讯地址,已取消此项授权,会默认返回true */
  620. 'scope.address'?: boolean
  621. /** 是否授权蓝牙,对应接口 [wx.openBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html)、[wx.createBLEPeripheralServer](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.createBLEPeripheralServer.html) */
  622. 'scope.bluetooth'?: boolean
  623. /** 是否授权摄像头,对应[[camera](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html)](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html) 组件 */
  624. 'scope.camera'?: boolean
  625. /** 是否授权获取发票,已取消此项授权,会默认返回true */
  626. 'scope.invoice'?: boolean
  627. /** 是否授权发票抬头,已取消此项授权,会默认返回true */
  628. 'scope.invoiceTitle'?: boolean
  629. /** 是否授权录音功能,对应接口 [wx.startRecord](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.startRecord.html) */
  630. 'scope.record'?: boolean
  631. /** 是否授权模糊地理位置,对应接口 [wx.getFuzzyLocation](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getFuzzyLocation.html) */
  632. 'scope.userFuzzyLocation'?: boolean
  633. /** 是否授权用户信息,对应接口 [wx.getUserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html) */
  634. 'scope.userInfo'?: boolean
  635. /** 是否授权精确地理位置,对应接口 [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) */
  636. 'scope.userLocation'?: boolean
  637. /** 是否授权微信运动步数,对应接口 [wx.getWeRunData](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.getWeRunData.html) */
  638. 'scope.werun'?: boolean
  639. /** 是否授权保存到相册 [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) */
  640. 'scope.writePhotosAlbum'?: boolean
  641. }
  642. interface AuthorizeForMiniProgramOption {
  643. /** 需要获取权限的 scope,详见 [scope 列表](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html#scope-列表)
  644. *
  645. * 可选值:
  646. * - 'scope.record': ;
  647. * - 'scope.writePhotosAlbum': ;
  648. * - 'scope.camera': ; */
  649. scope: 'scope.record' | 'scope.writePhotosAlbum' | 'scope.camera'
  650. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  651. complete?: AuthorizeForMiniProgramCompleteCallback
  652. /** 接口调用失败的回调函数 */
  653. fail?: AuthorizeForMiniProgramFailCallback
  654. /** 接口调用成功的回调函数 */
  655. success?: AuthorizeForMiniProgramSuccessCallback
  656. }
  657. interface AuthorizeOption {
  658. /** 需要获取权限的 scope,详见 [scope 列表](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html#scope-列表) */
  659. scope: string
  660. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  661. complete?: AuthorizeCompleteCallback
  662. /** 接口调用失败的回调函数 */
  663. fail?: AuthorizeFailCallback
  664. /** 接口调用成功的回调函数 */
  665. success?: AuthorizeSuccessCallback
  666. }
  667. /** 设备特征列表 */
  668. interface BLECharacteristic {
  669. /** 该特征支持的操作类型 */
  670. properties: BLECharacteristicProperties
  671. /** 蓝牙设备特征的 UUID */
  672. uuid: string
  673. }
  674. /** 该特征支持的操作类型 */
  675. interface BLECharacteristicProperties {
  676. /** 该特征是否支持 indicate 操作 */
  677. indicate: boolean
  678. /** 该特征是否支持 notify 操作 */
  679. notify: boolean
  680. /** 该特征是否支持 read 操作 */
  681. read: boolean
  682. /** 该特征是否支持 write 操作 */
  683. write: boolean
  684. /** 该特征是否支持有回复写操作 */
  685. writeDefault: boolean
  686. /** 该特征是否支持无回复写操作 */
  687. writeNoResponse: boolean
  688. }
  689. interface BLEPeripheralServerCloseOption {
  690. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  691. complete?: SocketTaskCloseCompleteCallback
  692. /** 接口调用失败的回调函数 */
  693. fail?: SocketTaskCloseFailCallback
  694. /** 接口调用成功的回调函数 */
  695. success?: SocketTaskCloseSuccessCallback
  696. }
  697. /** 描述service的Object */
  698. interface BLEPeripheralService {
  699. /** characteristics列表 */
  700. characteristics: Characteristic[]
  701. /** 蓝牙服务的 UUID */
  702. uuid: string
  703. }
  704. /** 设备服务列表 */
  705. interface BLEService {
  706. /** 该服务是否为主服务 */
  707. isPrimary: boolean
  708. /** 蓝牙设备服务的 UUID */
  709. uuid: string
  710. }
  711. /** BackgroundAudioManager 实例,可通过 [wx.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 获取。
  712. *
  713. * **示例代码**
  714. *
  715. * ```js
  716. const backgroundAudioManager = wx.getBackgroundAudioManager()
  717. backgroundAudioManager.title = '此时此刻'
  718. backgroundAudioManager.epname = '此时此刻'
  719. backgroundAudioManager.singer = '许巍'
  720. backgroundAudioManager.coverImgUrl = 'http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000'
  721. // 设置了 src 之后会自动播放
  722. backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46'
  723. ``` */
  724. interface BackgroundAudioManager {
  725. /** 音频已缓冲的时间,仅保证当前播放时间点到此时间点内容已缓冲。(只读) */
  726. buffered: number
  727. /** 封面图 URL,用于做原生音频播放器背景图。原生音频播放器中的分享功能,分享出去的卡片配图及背景也将使用该图。 */
  728. coverImgUrl: string
  729. /** 当前音频的播放位置(单位:s),只有在有合法 src 时返回。(只读) */
  730. currentTime: number
  731. /** 当前音频的长度(单位:s),只有在有合法 src 时返回。(只读) */
  732. duration: number
  733. /** 专辑名,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */
  734. epname: string
  735. /** 当前是否暂停或停止。(只读) */
  736. paused: boolean
  737. /** 需要基础库: `2.11.0`
  738. *
  739. * 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本) */
  740. playbackRate: number
  741. /** 需要基础库: `1.9.94`
  742. *
  743. * 音频协议。默认值为 'http',设置 'hls' 可以支持播放 HLS 协议的直播音频。 */
  744. protocol: string
  745. /** 需要基础库: `2.13.0`
  746. *
  747. * `origin`: 发送完整的referrer; `no-referrer`: 不发送。格式固定为 `https://servicewechat.com/{appid}/{version}/page-frame.html`,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本; */
  748. referrerPolicy: string
  749. /** 歌手名,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */
  750. singer: string
  751. /** 音频的数据源([2.2.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 开始支持云文件ID)。默认为空字符串,**当设置了新的 src 时,会自动开始播放**,目前支持的格式有 m4a, aac, mp3, wav。 */
  752. src: string
  753. /** 音频开始播放的位置(单位:s)。 */
  754. startTime: number
  755. /** 音频标题,用于原生音频播放器音频标题(必填)。原生音频播放器中的分享功能,分享出去的卡片标题,也将使用该值。 */
  756. title: string
  757. /** 页面链接,原生音频播放器中的分享功能,分享出去的卡片简介,也将使用该值。 */
  758. webUrl: string
  759. /** [BackgroundAudioManager.onCanplay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onCanplay.html)
  760. *
  761. * 在插件中使用:支持
  762. *
  763. * 监听背景音频进入可播放状态事件。 但不保证后面可以流畅播放 */
  764. onCanplay(
  765. /** 背景音频进入可播放状态事件的监听函数 */
  766. listener: OnCanplayCallback
  767. ): void
  768. /** [BackgroundAudioManager.onEnded(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onEnded.html)
  769. *
  770. * 在插件中使用:支持
  771. *
  772. * 监听背景音频自然播放结束事件 */
  773. onEnded(
  774. /** 背景音频自然播放结束事件的监听函数 */
  775. listener: OnEndedCallback
  776. ): void
  777. /** [BackgroundAudioManager.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onError.html)
  778. *
  779. * 在插件中使用:支持
  780. *
  781. * 监听背景音频播放错误事件 */
  782. onError(
  783. /** 背景音频播放错误事件的监听函数 */
  784. listener: BackgroundAudioManagerOnErrorCallback
  785. ): void
  786. /** [BackgroundAudioManager.onNext(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onNext.html)
  787. *
  788. * 在插件中使用:支持
  789. *
  790. * 监听用户在系统音乐播放面板点击下一曲事件(仅iOS) */
  791. onNext(
  792. /** 用户在系统音乐播放面板点击下一曲事件的监听函数 */
  793. listener: OnNextCallback
  794. ): void
  795. /** [BackgroundAudioManager.onPause(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPause.html)
  796. *
  797. * 在插件中使用:支持
  798. *
  799. * 监听背景音频暂停事件 */
  800. onPause(
  801. /** 背景音频暂停事件的监听函数 */
  802. listener: OnPauseCallback
  803. ): void
  804. /** [BackgroundAudioManager.onPlay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPlay.html)
  805. *
  806. * 在插件中使用:支持
  807. *
  808. * 监听背景音频播放事件 */
  809. onPlay(
  810. /** 背景音频播放事件的监听函数 */
  811. listener: OnPlayCallback
  812. ): void
  813. /** [BackgroundAudioManager.onPrev(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onPrev.html)
  814. *
  815. * 在插件中使用:支持
  816. *
  817. * 监听用户在系统音乐播放面板点击上一曲事件(仅iOS) */
  818. onPrev(
  819. /** 用户在系统音乐播放面板点击上一曲事件的监听函数 */
  820. listener: OnPrevCallback
  821. ): void
  822. /** [BackgroundAudioManager.onSeeked(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onSeeked.html)
  823. *
  824. * 在插件中使用:支持
  825. *
  826. * 监听背景音频完成跳转操作事件 */
  827. onSeeked(
  828. /** 背景音频完成跳转操作事件的监听函数 */
  829. listener: OnSeekedCallback
  830. ): void
  831. /** [BackgroundAudioManager.onSeeking(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onSeeking.html)
  832. *
  833. * 在插件中使用:支持
  834. *
  835. * 监听背景音频开始跳转操作事件 */
  836. onSeeking(
  837. /** 背景音频开始跳转操作事件的监听函数 */
  838. listener: OnSeekingCallback
  839. ): void
  840. /** [BackgroundAudioManager.onStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onStop.html)
  841. *
  842. * 在插件中使用:支持
  843. *
  844. * 监听背景音频停止事件 */
  845. onStop(
  846. /** 背景音频停止事件的监听函数 */
  847. listener: InnerAudioContextOnStopCallback
  848. ): void
  849. /** [BackgroundAudioManager.onTimeUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onTimeUpdate.html)
  850. *
  851. * 在插件中使用:支持
  852. *
  853. * 监听背景音频播放进度更新事件,只有小程序在前台时会回调。 */
  854. onTimeUpdate(
  855. /** 背景音频播放进度更新事件的监听函数 */
  856. listener: OnTimeUpdateCallback
  857. ): void
  858. /** [BackgroundAudioManager.onWaiting(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.onWaiting.html)
  859. *
  860. * 在插件中使用:支持
  861. *
  862. * 监听音频加载中事件。当音频因为数据不足,需要停下来加载时会触发 */
  863. onWaiting(
  864. /** 音频加载中事件的监听函数 */
  865. listener: OnWaitingCallback
  866. ): void
  867. /** [BackgroundAudioManager.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.pause.html)
  868. *
  869. * 在插件中使用:支持
  870. *
  871. * 暂停音乐 */
  872. pause(): void
  873. /** [BackgroundAudioManager.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.play.html)
  874. *
  875. * 在插件中使用:支持
  876. *
  877. * 播放音乐 */
  878. play(): void
  879. /** [BackgroundAudioManager.seek(number currentTime)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.seek.html)
  880. *
  881. * 在插件中使用:支持
  882. *
  883. * 跳转到指定位置 */
  884. seek(
  885. /** 跳转的位置,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */
  886. currentTime: number
  887. ): void
  888. /** [BackgroundAudioManager.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.stop.html)
  889. *
  890. * 在插件中使用:支持
  891. *
  892. * 停止音乐 */
  893. stop(): void
  894. }
  895. interface BatchGetStorageOption {
  896. /** 本地缓存中指定的 keyList */
  897. keyList: string[]
  898. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  899. complete?: BatchGetStorageCompleteCallback
  900. /** 接口调用失败的回调函数 */
  901. fail?: BatchGetStorageFailCallback
  902. /** 接口调用成功的回调函数 */
  903. success?: BatchGetStorageSuccessCallback
  904. }
  905. interface BatchSetStorageOption {
  906. /** [{ key, value }] */
  907. kvList: any[]
  908. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  909. complete?: BatchSetStorageCompleteCallback
  910. /** 接口调用失败的回调函数 */
  911. fail?: BatchSetStorageFailCallback
  912. /** 接口调用成功的回调函数 */
  913. success?: BatchSetStorageSuccessCallback
  914. }
  915. /** Beacon 设备 */
  916. interface BeaconInfo {
  917. /** Beacon 设备的距离,单位 m。iOS 上,proximity 为 0 时,accuracy 为 -1。 */
  918. accuracy: number
  919. /** Beacon 设备的主 ID */
  920. major: number
  921. /** Beacon 设备的次 ID */
  922. minor: number
  923. /** 表示设备距离的枚举值(仅iOS)
  924. *
  925. * 可选值:
  926. * - 0: 信号太弱不足以计算距离,或非 iOS 设备;
  927. * - 1: 十分近;
  928. * - 2: 比较近;
  929. * - 3: 远; */
  930. proximity: 0 | 1 | 2 | 3
  931. /** 表示设备的信号强度,单位 dBm */
  932. rssi: number
  933. /** Beacon 设备广播的 UUID */
  934. uuid: string
  935. }
  936. /** 需要基础库: `2.20.1`
  937. *
  938. * 以 beacon 设备形式广播的参数。 */
  939. interface BeaconInfoObj {
  940. /** Beacon 设备的主 ID */
  941. major: number
  942. /** Beacon 设备的次 ID */
  943. minor: number
  944. /** Beacon 设备广播的 UUID */
  945. uuid: string
  946. /** 用于判断距离设备 1 米时 RSSI 大小的参考值 */
  947. measuredPower?: number
  948. }
  949. interface BindWifiOption {
  950. /** 当前 wifi 网络的 BSSID ,可通过 wx.getConnectedWifi 获取 */
  951. BSSID: string
  952. }
  953. interface BlueToothDevice {
  954. /** 当前蓝牙设备的信号强度,单位 dBm */
  955. RSSI: number
  956. /** 当前蓝牙设备的广播数据段中的 ManufacturerData 数据段。 */
  957. advertisData: ArrayBuffer
  958. /** 当前蓝牙设备的广播数据段中的 ServiceUUIDs 数据段 */
  959. advertisServiceUUIDs: string[]
  960. /** 当前蓝牙设备是否可连接( Android 8.0 以下不支持返回该值 ) */
  961. connectable: boolean
  962. /** 蓝牙设备 id */
  963. deviceId: string
  964. /** 当前蓝牙设备的广播数据段中的 LocalName 数据段 */
  965. localName: string
  966. /** 蓝牙设备名称,某些设备可能没有 */
  967. name: string
  968. /** 当前蓝牙设备的广播数据段中的 ServiceData 数据段 */
  969. serviceData: IAnyObject
  970. }
  971. /** 搜索到的设备列表 */
  972. interface BluetoothDeviceInfo {
  973. /** 用于区分设备的 id */
  974. deviceId: string
  975. /** 蓝牙设备名称,某些设备可能没有 */
  976. name: string
  977. }
  978. interface BlurOption {
  979. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  980. complete?: BlurCompleteCallback
  981. /** 接口调用失败的回调函数 */
  982. fail?: BlurFailCallback
  983. /** 接口调用成功的回调函数 */
  984. success?: BlurSuccessCallback
  985. }
  986. /** 需要基础库: `2.28.0`
  987. *
  988. * 人体检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/body.html)。 */
  989. interface BodyTrack {
  990. /** 需要基础库: `2.28.0`
  991. *
  992. * 人体检测模式
  993. *
  994. * 可选值:
  995. * - 1: 通过摄像头实时检测;
  996. * - 2: 静态图片检测; */
  997. mode: 1 | 2
  998. }
  999. interface BoundingClientRectCallbackResult {
  1000. /** 节点的下边界坐标 */
  1001. bottom: number
  1002. /** 节点的 dataset */
  1003. dataset: IAnyObject
  1004. /** 节点的高度 */
  1005. height: number
  1006. /** 节点的 ID */
  1007. id: string
  1008. /** 节点的左边界坐标 */
  1009. left: number
  1010. /** 节点的右边界坐标 */
  1011. right: number
  1012. /** 节点的上边界坐标 */
  1013. top: number
  1014. /** 节点的宽度 */
  1015. width: number
  1016. }
  1017. /** 目标边界 */
  1018. interface BoundingClientRectResult {
  1019. /** 下边界 */
  1020. bottom: number
  1021. /** 高度 */
  1022. height: number
  1023. /** 左边界 */
  1024. left: number
  1025. /** 右边界 */
  1026. right: number
  1027. /** 上边界 */
  1028. top: number
  1029. /** 宽度 */
  1030. width: number
  1031. }
  1032. /** 音频源节点,通过 [WebAudioContext.createBufferSource](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createBufferSource.html)方法获得。
  1033. *
  1034. * **示例代码**
  1035. *
  1036. * ```js
  1037. const source = audioCtx.createBufferSource()
  1038. source.buffer = AudioBuffer
  1039. source.connect(audioCtx.destination)
  1040. sourceCache.add(source) // Tips:缓存住 source,防止被GC掉,GC掉的话音频会中断
  1041. source.onended = () => {
  1042. sourceCache.delete(source) // Tips:播放完之后,再清掉source缓存
  1043. }
  1044. source.start()
  1045. ``` */
  1046. interface BufferSourceNode {
  1047. /** [AudioBuffer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.html)
  1048. *
  1049. * 是一个 AudioBuffer, 它定义了要播放的音频,当设置它的值为 0 时,它会定义一个静默的单通道。(可读可写) */
  1050. buffer: AudioBuffer
  1051. /** 定义音频是否循环播放(可读可写) */
  1052. loop?: boolean
  1053. /** 定义音频循环播放时,结束播放的位置。单位是秒,默认值是0(可读可写) */
  1054. loopEnd?: number
  1055. /** 定义音频循环播放时,开始播放的位置。单位是秒,默认值是0(可读可写) */
  1056. loopStart?: number
  1057. /** 定义音频播放结束事件回调函数(可读可写)
  1058. *
  1059. * ## 注意事项
  1060. * - bug:从微信8.0.34开始,BufferSource在JS中如果不一直持有的话,会被客户端GC掉,GC掉之后,BufferSource如果正在播放的话会被中断。因此,建议开发者在 BufferSource.start() 开始播放之前缓存 BufferSource 并在 BufferSource.onended 的时候释放缓存。具体可参考下面示例代码中的缓存逻辑。 */
  1061. onended?: (...args: any[]) => any
  1062. /** [AudioParam](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioParam.html)
  1063. *
  1064. * 定义音频的播放倍速,数值越大速度越快,默认速度1.0,有效范围为 0 < playbackRate <= 2.0(可读可写) */
  1065. playbackRate?: AudioParam
  1066. /** [BufferSourceNode.connect(AudioNode|[AudioParam](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioParam.html) destination)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/BufferSourceNode.connect.html)
  1067. *
  1068. * 在插件中使用:不支持
  1069. *
  1070. * 连接到一个指定目标。这个指定的目标可能是另一个 AudioNode(从而将音频数据引导到下一个指定节点)或一个AudioParam, 以便上一个节点的输出数据随着时间流逝能自动地对下一个参数值进行改变 */
  1071. connect(
  1072. /** 要建立连接的目标节点 */
  1073. destination: AudioNode | AudioParam
  1074. ): void
  1075. /** [BufferSourceNode.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/BufferSourceNode.disconnect.html)
  1076. *
  1077. * 在插件中使用:不支持
  1078. *
  1079. * 与已连接的目标节点断开连接 */
  1080. disconnect(): void
  1081. /** [BufferSourceNode.start(number when, number offset, number duration)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/BufferSourceNode.start.html)
  1082. *
  1083. * 在插件中使用:不支持
  1084. *
  1085. * 音频源开始播放 */
  1086. start(
  1087. /** 延迟播放的时间,单位是秒。与 AudioContext 使用相同的时间坐标系统。如果 when 小于 AudioContext.currentTime, 或者是 0,声音立即被播放。 默认值是 0 */
  1088. when?: number,
  1089. /** 音频开始播放的位置,单位是秒。默认值是 0 */
  1090. offset?: number,
  1091. /** 音频播放的持续时间,单位是秒。如果这个参数没有被指定,声音播放到自然结束或者使用stop() 方法结束。使用这个参数的功能与调用 start(when, offset) 和调用 stop(when+duration)效果完全相同 */
  1092. duration?: number
  1093. ): void
  1094. /** [BufferSourceNode.stop(number when)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/BufferSourceNode.stop.html)
  1095. *
  1096. * 在插件中使用:不支持
  1097. *
  1098. * 停止播放 */
  1099. stop(
  1100. /** 延迟停止播放的时间,单位是秒。与 AudioContext 使用相同的时间坐标系统。省略此参数、指定值 0 或传递负值会使声音立即停止播放。 */
  1101. when?: number
  1102. ): void
  1103. }
  1104. /** 需要基础库: `2.24.0`
  1105. *
  1106. * 缓存管理器。全局只有唯一实例,一旦被创建出来即表示接入缓存管理器。其有以下几个能力:
  1107. *
  1108. * 1. 在网络通畅时,符合一定规则的用户网络请求(目前只包括普通 wx.request 请求)会被缓存。
  1109. * 2. 在网络通畅时,某些 wx api 调用会被缓存。
  1110. * 3. 进入弱网/离线状态时,会提供事件给用户,用户可以决定是否使用缓存返回。
  1111. * 4. 提供进入和退出弱网/离线状态的事件。
  1112. *
  1113. * > 1. 缓存管理器中涉及的网络请求如无特指,均指普通的 wx.request 异步请求,参数和返回值中均不考虑涉及 ArrayBuffer 或 TypedArray 的情形。
  1114. * > 2. 缓存管理器中的缓存不会占用 storage 空间,但是有大小限制,请勿在非必要的请求上使用缓存。 */
  1115. interface CacheManager {
  1116. /** 全局缓存有效时间 */
  1117. maxAge: number
  1118. /** 当前缓存模式
  1119. *
  1120. * 可选值:
  1121. * - 'weakNetwork': 默认值,弱网/离线使用缓存返回;
  1122. * - 'always': 总是使用缓存返回;
  1123. * - 'none': 不开启,后续可手动开启/停止使用缓存返回; */
  1124. mode: 'weakNetwork' | 'always' | 'none'
  1125. /** 全局 origin */
  1126. origin: string
  1127. /** 当前缓存管理器状态
  1128. *
  1129. * 可选值:
  1130. * - 0: 不使用缓存返回;
  1131. * - 1: 使用缓存返回;
  1132. * - 2: 未知; */
  1133. state: 0 | 1 | 2
  1134. /** [Array.&lt;string&gt; CacheManager.addRules(Object rules)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.addRules.html)
  1135. *
  1136. * 需要基础库: `2.24.0`
  1137. *
  1138. * 在插件中使用:不支持
  1139. *
  1140. * 批量添加规则,规则写法可参考 [CacheManager.addRule](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.addRule.html)。 */
  1141. addRules(
  1142. /** 规则列表 */
  1143. rules: IAnyObject
  1144. ): string[]
  1145. /** [CacheManager.clearCaches()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.clearCaches.html)
  1146. *
  1147. * 需要基础库: `2.24.0`
  1148. *
  1149. * 在插件中使用:不支持
  1150. *
  1151. * 清空所有缓存。 */
  1152. clearCaches(): void
  1153. /** [CacheManager.clearRules()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.clearRules.html)
  1154. *
  1155. * 需要基础库: `2.24.0`
  1156. *
  1157. * 在插件中使用:不支持
  1158. *
  1159. * 清空所有规则,同时会删除对应规则下所有缓存。 */
  1160. clearRules(): void
  1161. /** [CacheManager.deleteCache(string id)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteCache.html)
  1162. *
  1163. * 需要基础库: `2.24.0`
  1164. *
  1165. * 在插件中使用:不支持
  1166. *
  1167. * 删除缓存。 */
  1168. deleteCache(
  1169. /** 缓存 id */
  1170. id: string
  1171. ): void
  1172. /** [CacheManager.deleteCaches(Array.&lt;string&gt; ids)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteCaches.html)
  1173. *
  1174. * 需要基础库: `2.24.0`
  1175. *
  1176. * 在插件中使用:不支持
  1177. *
  1178. * 批量删除缓存。 */
  1179. deleteCaches(
  1180. /** 缓存 id 列表 */
  1181. ids: string[]
  1182. ): void
  1183. /** [CacheManager.deleteRule(string id)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteRule.html)
  1184. *
  1185. * 需要基础库: `2.24.0`
  1186. *
  1187. * 在插件中使用:不支持
  1188. *
  1189. * 删除规则,同时会删除对应规则下所有缓存。 */
  1190. deleteRule(
  1191. /** 规则 id */
  1192. id: string
  1193. ): void
  1194. /** [CacheManager.deleteRules(Array.&lt;string&gt; ids)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteRules.html)
  1195. *
  1196. * 需要基础库: `2.24.0`
  1197. *
  1198. * 在插件中使用:不支持
  1199. *
  1200. * 批量删除规则,同时会删除对应规则下所有缓存。 */
  1201. deleteRules(
  1202. /** 规则 id 列表 */
  1203. ids: string[]
  1204. ): void
  1205. /** [CacheManager.off(string eventName, function handler)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.off.html)
  1206. *
  1207. * 需要基础库: `2.24.0`
  1208. *
  1209. * 在插件中使用:不支持
  1210. *
  1211. * 取消事件监听。 */
  1212. off(
  1213. /** 事件名 */
  1214. eventName: string,
  1215. /** 事件句柄 */
  1216. handler: (...args: any[]) => any
  1217. ): void
  1218. /** [CacheManager.on(string eventName, function handler)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.on.html)
  1219. *
  1220. * 需要基础库: `2.24.0`
  1221. *
  1222. * 在插件中使用:不支持
  1223. *
  1224. * 监听事件。
  1225. *
  1226. * ****
  1227. *
  1228. * 这里 request 事件会提供 request 事件对象,用于做后续的处理;在 request 事件中需要返回一个 promise,用来生成 wx.request 请求的返回内容。
  1229. *
  1230. * #### 示例代码
  1231. *
  1232. * ```js
  1233. async function handler(evt) {
  1234. // evt.url - 请求 url
  1235. // evt.data - 请求参数
  1236. // evt.method - 请求方法
  1237. // evt.request - 原始 request 方法,返回一个 promise
  1238. // if (evt.url === '/xxx') {
  1239. // // 如果有些请求仍然希望走到网络,则可以如下处理
  1240. // const res = await evt.request()
  1241. // // res 即为网络请求返回
  1242. // }
  1243. return new Promsie((resolve, reject) => {
  1244. // do sth
  1245. if (data) {
  1246. // 这里 resolve 的 data 就会作为 wx.request 的 success 回调结果返回
  1247. resolve(data)
  1248. } else {
  1249. // 这里 reject 的错误信息就会作为 wx.request 的 fail 回调结果返回
  1250. reject('no data')
  1251. }
  1252. })
  1253. }
  1254. cacheManager.on('request', handler)
  1255. ``` */
  1256. on(
  1257. /** 事件名
  1258. *
  1259. * 参数 eventName 可选值:
  1260. * - 'request': 发生 wx.request 请求,只在缓存管理器开启阶段会触发;
  1261. * - 'enterWeakNetwork': 进入弱网/离线状态;
  1262. * - 'exitWeakNetwork': 离开弱网/离线状态; */
  1263. eventName: 'request' | 'enterWeakNetwork' | 'exitWeakNetwork',
  1264. /** 事件句柄 */
  1265. handler: (...args: any[]) => any
  1266. ): void
  1267. /** [CacheManager.start()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.start.html)
  1268. *
  1269. * 需要基础库: `2.24.0`
  1270. *
  1271. * 在插件中使用:不支持
  1272. *
  1273. * 开启缓存,仅在 mode 为 none 时生效,调用后缓存管理器的 state 会置为 1。 */
  1274. start(): void
  1275. /** [CacheManager.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.stop.html)
  1276. *
  1277. * 需要基础库: `2.24.0`
  1278. *
  1279. * 在插件中使用:不支持
  1280. *
  1281. * 关闭缓存,仅在 mode 为 none 时生效,调用后缓存管理器的 state 会置为 0。 */
  1282. stop(): void
  1283. /** [Object CacheManager.match(Object evt)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.match.html)
  1284. *
  1285. * 需要基础库: `2.24.0`
  1286. *
  1287. * 在插件中使用:不支持
  1288. *
  1289. * 匹配命中的缓存规则,一般需要和 request 事件搭配使用。
  1290. *
  1291. * **示例代码**
  1292. *
  1293. * ```js
  1294. function handler(evt) {
  1295. const cache = cacheManager.match(evt)
  1296. // 若有重复监听,则取第一个 handler 返回的 promise
  1297. return new Promise((resolve, reject) => {
  1298. if (cache.data) {
  1299. resolve(cache.data)
  1300. } else {
  1301. reject('no cache')
  1302. }
  1303. })
  1304. }
  1305. cacheManager.on('request', handler)
  1306. ``` */
  1307. match(
  1308. /** request 事件对象 */
  1309. evt: IAnyObject
  1310. ): MatchCache
  1311. /** [string CacheManager.addRule(Object rule)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.addRule.html)
  1312. *
  1313. * 需要基础库: `2.24.0`
  1314. *
  1315. * 在插件中使用:不支持
  1316. *
  1317. * 添加规则。
  1318. *
  1319. * **规则说明**
  1320. *
  1321. * 支持的规则写法有字符串、正则和对象三种:
  1322. *
  1323. * ### 字符串写法
  1324. *
  1325. * 1. `addRule('/abc')`:纯 uri 串。
  1326. * 2. `addRule('GET /abc'):带方法的 uri 串,除了匹配 uri 外,还会匹配请求方法。如例子中必须是 GET 方法请求才会被匹配。
  1327. * 3. `addRule('/abc/:id'):带可变部分的 uri 串,id 可以是任意符合标准的字符串,表示这一段可以动态变化。比如 `/abc/123` 和 `/abc/321` 都会被匹配,而 `/abc/123/xxx` 因为多了一段,就不会被匹配。
  1328. * 4. `addRule('/abc?aa'):带 query 参数的 uri 串,包含 aa 参数,值可以为任意值。比如 `/abc?aa=haha` 会被匹配,但是 `/abc` 就不会被匹配,因为缺少规则中声明的 aa 参数;不过如果请求是 `/abc?aa=haha&bb=123`,虽然多带了 bb 参数,但是因为包含了 aa 参数,所以也可以被匹配。
  1329. * 5. `addRule('/abc?dd=haha'):带 query 参数的 uri 串,包含 dd 参数且值为 haha。比如 `/abc?dd=haha` 和 `/abc?dd=haha&bb=123` 会被匹配,而 `/abc?dd=123` 就不会被匹配,因为规则要求了 dd 参数的值。
  1330. *
  1331. * > 以上写法中的 uri 串如果只有 path 部分,则会取全局 origin 进行补全。比如全局 origin 是 `https://weixin.qq.com`,而规则是 `/abc`,则会补全为 `https://weixin.qq.com/abc`。因此在前面例子中 `addRule('/abc')` 和 `addRule('https://weixin.qq.com/abc')` 的写法效果一致。所以一般情况下如果需要匹配的请求 origin 和全局 origin 一致,则规则中可忽略不写 orign。
  1332. *
  1333. * ### 正则写法
  1334. *
  1335. * 1. `addRule(/\/(abc|cba)$/ig)`:直接正则匹配请求的 uri,同时会比对请求 origin 和全局 origin 是否一致。
  1336. * 2. `addRule(/^https:\/\/weixin.qq.com\/(abc|cba)$/ig)`:带有 orign 部分的正则表达式,则只匹配 uri,不再比对 origin。
  1337. *
  1338. * ### 对象写法
  1339. *
  1340. * 使用规则对象,可以更为详细的描述规则内容。(一般使用规则对象,是为了匹配请求参数)
  1341. *
  1342. * #### 规则对象:
  1343. *
  1344. * | 属性名 | 类型 | 默认值 | 备注 |
  1345. * |---|---|---|---|
  1346. * | id | string | | 规则 id,如果不填则会由基础库生成 |
  1347. * | method | string | | 请求方法,可选值 GET/POST/PATCH/PUT/DELETE,如果为空则表示前面提到的所有方法都能被匹配到 |
  1348. * | url | any | 必填 | uri 匹配规则,可参考规则字符串写法和正则写法 |
  1349. * | maxAge | number | 7 * 24 * 60 * 60 * 1000 | 缓存有效时间,单位为 ms,不填则默认取缓存管理器全局的缓存有效时间 |
  1350. * | dataSchema | Array\<DataRule\> | | 匹配请求参数 |
  1351. *
  1352. * 其中,dataSchema 用来匹配对象类型的请求参数(比如 wx.request 的 data),默认可以不填,即不做参数匹配。
  1353. *
  1354. * dataSchema 的类型是一个 DataRule 对象数组,一个 DataRule 对象描述一个参数,比如一个 wx.request 请求的 data 是 `{a: 123, b: 'haha', c: true}`,你想要用一条规则来匹配其中的 a 和 b 参数,如果 a 是数字且 b 是字符串就能命中该规则,那么就需要在 dataSchema 中补充两个 DataRule 对象,即 `[{name: 'a', schema: {type: 'number'}}, {name: 'b', schema: {type: 'string'}}]`。
  1355. *
  1356. * #### DataRule 对象:
  1357. *
  1358. * | 属性名 | 类型 | 默认值 | 备注 |
  1359. * |---|---|---|---|
  1360. * | name | string | | 需要匹配的参数名 |
  1361. * | schema | DataSchema/Array\<DataSchema\> | 需要匹配的参数模式,支持数组,表示该参数值有多种模式 |
  1362. *
  1363. * name 表示要匹配的参数名,schema 为 DataSchema 对象,用来描述该参数的类型和值。
  1364. *
  1365. * 一个 DataRule 对象也可以匹配可能拥有多种类型的参数,所以 schema 也支持为 DataSchema 对象数组。比如上述例子中,希望匹配的 a 参数必须是数值或者字符串,那么可以这么写:`{name: 'a', schema: [{type: 'number'}, {type: 'string'}]}`。
  1366. *
  1367. * #### DataSchema 对象:
  1368. *
  1369. * | 属性名 | 类型 | 默认值 | 备注 |
  1370. * |---|---|---|---|
  1371. * | type | string | | 需要匹配的 data 对象的参数类型,string、number、boolean、null、object、any(表示任意类型),同时支持数组模式(数组模式则在类型后面加 [],如 string[] 表示字符串数组) |
  1372. * | value | string/regexp/function/Array\<DataRule\> | | 需要匹配的 data 对象的参数值,当 type 为基本类型时,可以用 string/regexp 来匹配固定的值,也可以通过 function 来确定值是否匹配,如果传入的 type 是 object,那么表示需要嵌套匹配值是否正确,可以传入 Array<DataRule> |
  1373. *
  1374. * type 参数表示要匹配的参数类型,value 表示要匹配的参数值。其中 value 支持多种写法,不同写法有如下匹配方式:
  1375. *
  1376. * 1. 字符串写法:直接判值的字符串形式是否和给定字符串一样,比如 value 值为 `123`,就要求参数值必须为 123 才能与之匹配。
  1377. * 2. 正则写法:直接判值的字符串形式是否能被正则匹配,比如 value 值为 `/\d+/ig`,就要求参数值必须为数字,如果参数值为 `abc` 则不会被匹配。
  1378. * 3. 函数写法:在匹配时会调用用户传入的函数,交由用户判断是否匹配。
  1379. * 4. DataRule 数组写法:当参数类型为对象时,那么字符串写法和正则写法就无法使用,需要传入 DataRule 数组来进行匹配,即通过嵌套 DataRule 数组的方式来匹配嵌套的对象。
  1380. *
  1381. * ### 示例代码
  1382. *
  1383. * ```js
  1384. const ruleId = cacheManager.addRule({
  1385. id: 'haha-rule',
  1386. method: 'GET',
  1387. url: '/haha',
  1388. maxAge: 123455,
  1389. dataSchema: [
  1390. // data 字段的匹配,默认为空,表示不匹配
  1391. // 类型可以是:string、number、boolean、null、object、any(表示任意类型均可),以及这些类型的数组表示方式
  1392. {name: 'aaa', schema: {type: 'string'}}, // 类型为 string
  1393. {name: 'bbb', schema: [{type: 'number'}, {type: 'string'}]}, // 类型为 number, string
  1394. {name: 'ccc', schema: {type: 'string', value: 'abc'}}, // 值为 abc
  1395. {name: 'ddd', schema: {type: 'string', value: /(abc|cba)/ig}}, // 值符合该正则匹配,如果该值不是字符串类型,则会被尝试转成字符串后再进行比较
  1396. {name: 'ddd', schema: {type: 'string', value: val => val === '123'}}, // 传入函数来校验值
  1397. {name: 'eee', schema: {type: 'object', value: [{ // 类型为对象,则通过嵌套的方式来逐层校验
  1398. name: 'aaa', schema: {type: 'string'},
  1399. // ...
  1400. // 嵌套 dataSchema,同上面的方式一样来匹配嵌套的对象
  1401. }]}},
  1402. {name: 'fff', schema: {type: 'string[]'}}, // 类型为 string 数组
  1403. {name: 'ggg', schema: {type: 'any'}}, // 类型为任意类型
  1404. {name: 'hhh', schema: {type: 'any[]'}}, // 类型为任意类型的数组
  1405. }],
  1406. })
  1407. ```
  1408. *
  1409. * ### 补充说明
  1410. *
  1411. * 用户可以添加多条规则,每条规则都会去解析网络请求,然后判断是否命中规则。假设有多条规则命中,则取第一条命中的规则。
  1412. *
  1413. * ### 缓存覆盖
  1414. *
  1415. * 不同的网络请求也可能命中同一条规则,所以每条规则可能对应多个缓存。每条规则会有一个规则 id,每个缓存会有一个缓存 id,一个规则 id 可能对应多个缓存 id,而缓存管理器的缓存存储是基于缓存 id 标识的,如果两个不同的请求生成了同样的缓存 id,那么后发生的请求结果缓存会覆盖前者。因此使用时需要思考缓存的覆盖情况,目前缓存 id 生成方式如下:
  1416. *
  1417. * 1. 规则使用字符串写法:那么按 method + url + 规则中声明的 query 参数来生成缓存 id。
  1418. *
  1419. * > 需要注意的是这里不使用真实请求中的 query 参数来生成缓存 id,而是使用规则中匹配到的 query 来生成缓存 id。比如规则是 `/abc?aa=123`,请求是 GET 方法的 `/abc?aa=123&bb=123`,那么就会基于 `GET /abc?aa=123` 来生成缓存 id。而规则里没有声明 `bb=123`,所以 bb 参数不会被纳入缓存 id 的生成基准。
  1420. *
  1421. * 2. 规则使用正则写法:那么只按 method + url 生成缓存 id,不考虑 query 参数。
  1422. * 3. 规则使用对象写法:如果规则对象中的 url 是字符串写法,那么按 method + url + 规则中声明的 query 参数 + 规则中 dataSchema 声明的请求参数来生成缓存 id;如果规则对象中的 url 是正则写法,那么按 method + url + 规则中 dataSchema 声明的请求参数来生成缓存 id。
  1423. *
  1424. * > 生成缓存 id 时没有使用请求中完整的 query 参数或者请求参数来作为基准,是考虑到很多请求可能会带上 token 或时间戳等参数。因为此参数存在不确定性,会导致每次请求生成的缓存 id 都不同,进而导致缓存命中率下降,故采取规则中声明的 query 参数和 dataSchema 声明的请求参数来作为生成缓存 id 的基准。 */
  1425. addRule(
  1426. /** 规则 */
  1427. rule: IAnyObject
  1428. ): string
  1429. }
  1430. interface CameraContextSetZoomOption {
  1431. /** 缩放级别,范围[1, maxZoom]。zoom 可取小数,精确到小数后一位。maxZoom 可在 bindinitdone 返回值中获取。 */
  1432. zoom: number
  1433. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1434. complete?: SetZoomCompleteCallback
  1435. /** 接口调用失败的回调函数 */
  1436. fail?: SetZoomFailCallback
  1437. /** 接口调用成功的回调函数 */
  1438. success?: CameraContextSetZoomSuccessCallback
  1439. }
  1440. interface CameraContextStartRecordOption {
  1441. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1442. complete?: StartRecordCompleteCallback
  1443. /** 接口调用失败的回调函数 */
  1444. fail?: StartRecordFailCallback
  1445. /** 需要基础库: `2.22.0`
  1446. *
  1447. * 是否开启镜像 */
  1448. selfieMirror?: boolean
  1449. /** 接口调用成功的回调函数 */
  1450. success?: CameraContextStartRecordSuccessCallback
  1451. /** 需要基础库: `2.22.0`
  1452. *
  1453. * 录制时长上限,单位为秒,最长不能超过 5 分钟 */
  1454. timeout?: number
  1455. /** 超过录制时长上限时会结束录像并触发此回调,录像异常退出时也会触发此回调 */
  1456. timeoutCallback?: StartRecordTimeoutCallback
  1457. }
  1458. interface CameraContextStopRecordOption {
  1459. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1460. complete?: StopRecordCompleteCallback
  1461. /** 启动视频压缩,压缩效果同`chooseVideo` */
  1462. compressed?: boolean
  1463. /** 接口调用失败的回调函数 */
  1464. fail?: StopRecordFailCallback
  1465. /** 接口调用成功的回调函数 */
  1466. success?: CameraContextStopRecordSuccessCallback
  1467. }
  1468. interface CameraFrameListenerStartOption {
  1469. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  1470. complete?: StartCompleteCallback
  1471. /** 接口调用失败的回调函数 */
  1472. fail?: StartFailCallback
  1473. /** 接口调用成功的回调函数 */
  1474. success?: StartSuccessCallback
  1475. /** [Worker](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.html)
  1476. *
  1477. * 需要基础库: `2.25.1`
  1478. *
  1479. * 可选参数。如果需要在 iOS ExperimentalWorker 内监听摄像头帧数据,则需要传入对应 Worker 对象。详情 [Worker.getCameraFrameData](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.getCameraFrameData.html) */
  1480. worker?: Worker
  1481. }
  1482. /** 需要基础库: `2.7.0`
  1483. *
  1484. * Canvas 实例,可通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取。
  1485. *
  1486. * **示例代码**
  1487. *
  1488. * 2D Canvas 示例
  1489. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/SHfgCmmq7UcM)
  1490. *
  1491. * WebGL 示例
  1492. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/qEGUOqmf7T8z) */
  1493. interface Canvas {
  1494. /** 画布高度 */
  1495. height: number
  1496. /** 画布宽度 */
  1497. width: number
  1498. /** [Canvas.cancelAnimationFrame(number requestID)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.cancelAnimationFrame.html)
  1499. *
  1500. * 需要基础库: `2.7.0`
  1501. *
  1502. * 在插件中使用:支持
  1503. *
  1504. * 取消由 requestAnimationFrame 添加到计划中的动画帧请求。支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。 */
  1505. cancelAnimationFrame(requestID: number): void
  1506. /** [[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)
  1507. *
  1508. * 需要基础库: `2.9.0`
  1509. *
  1510. * 在插件中使用:支持
  1511. *
  1512. * 创建一个 ImageData 对象。仅支持在 2D Canvas 中使用。 */
  1513. createImageData(): ImageData
  1514. /** [[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)
  1515. *
  1516. * 需要基础库: `2.7.0`
  1517. *
  1518. * 在插件中使用:支持
  1519. *
  1520. * 创建一个图片对象。 支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。 */
  1521. createImage(): Image
  1522. /** [[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)
  1523. *
  1524. * 需要基础库: `2.11.0`
  1525. *
  1526. * 在插件中使用:支持
  1527. *
  1528. * 创建 Path2D 对象 */
  1529. createPath2D(
  1530. /** [Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) */
  1531. path: Path2D
  1532. ): Path2D
  1533. /** [[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)
  1534. *
  1535. * 需要基础库: `2.7.0`
  1536. *
  1537. * 在插件中使用:支持
  1538. *
  1539. * 该方法返回 Canvas 的绘图上下文
  1540. *
  1541. * ****
  1542. *
  1543. * 支持获取 2D 和 WebGL 绘图上下文 */
  1544. getContext(
  1545. /** 上下文类型
  1546. *
  1547. * 参数 contextType 可选值:
  1548. * - '2d': 2d 绘图上下文; */
  1549. contextType: '2d'
  1550. ): CanvasRenderingContext.CanvasRenderingContext2D
  1551. /** [[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)
  1552. *
  1553. * 需要基础库: `2.7.0`
  1554. *
  1555. * 在插件中使用:支持
  1556. *
  1557. * 该方法返回 Canvas 的绘图上下文
  1558. *
  1559. * ****
  1560. *
  1561. * 支持获取 2D 和 WebGL 绘图上下文 */
  1562. getContext(
  1563. /** 上下文类型
  1564. *
  1565. * 参数 contextType 可选值:
  1566. * - 'webgl': webgl 绘图上下文; */
  1567. contextType: 'webgl'
  1568. ): CanvasRenderingContext.WebGLRenderingContext
  1569. /** [[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)
  1570. *
  1571. * 需要基础库: `2.7.0`
  1572. *
  1573. * 在插件中使用:支持
  1574. *
  1575. * 该方法返回 Canvas 的绘图上下文
  1576. *
  1577. * ****
  1578. *
  1579. * 支持获取 2D 和 WebGL 绘图上下文 */
  1580. getContext(
  1581. /** 上下文类型
  1582. *
  1583. * 参数 contextType 可选值:
  1584. * - 'webgl2': webgl2 绘图上下文; */
  1585. contextType: 'webgl2'
  1586. ): CanvasRenderingContext.WebGL2RenderingContext
  1587. /** [number Canvas.requestAnimationFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.requestAnimationFrame.html)
  1588. *
  1589. * 需要基础库: `2.7.0`
  1590. *
  1591. * 在插件中使用:支持
  1592. *
  1593. * 在下次进行重绘时执行。 支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。 */
  1594. requestAnimationFrame(
  1595. /** 执行的 callback */
  1596. callback: (...args: any[]) => any
  1597. ): number
  1598. /** [string Canvas.toDataURL(string type, number encoderOptions)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.toDataURL.html)
  1599. *
  1600. * 需要基础库: `2.11.0`
  1601. *
  1602. * 在插件中使用:支持
  1603. *
  1604. * 返回一个包含图片展示的 data URI 。可以使用 type 参数其类型,默认为 PNG 格式。 */
  1605. toDataURL(
  1606. /** 图片格式,默认为 image/png */
  1607. type: string,
  1608. /** 在指定图片格式为 image/jpeg 或 image/webp的情况下,可以从 0 到 1 的区间内选择图片的质量。如果超出取值范围,将会使用默认值 0.92。其他参数会被忽略。 */
  1609. encoderOptions: number
  1610. ): string
  1611. }
  1612. /** @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  1613. *
  1614. * canvas 组件的绘图上下文。CanvasContext 是旧版的接口, 新版 Canvas 2D 接口与 Web 一致。 */
  1615. interface CanvasContext {
  1616. /** 需要基础库: `1.9.90`
  1617. *
  1618. * 填充颜色。用法同 [CanvasContext.setFillStyle()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html)。 */
  1619. fillStyle: string | CanvasGradient
  1620. /** 需要基础库: `1.9.90`
  1621. *
  1622. * 当前字体样式的属性。符合 [CSS font 语法](https://developer.mozilla.org/zh-CN/docs/Web/CSS/font) 的 DOMString 字符串,至少需要提供字体大小和字体族名。默认值为 10px sans-serif。 */
  1623. font: string
  1624. /** 全局画笔透明度。范围 0-1,0 表示完全透明,1 表示完全不透明。 */
  1625. globalAlpha: number
  1626. /** 需要基础库: `1.9.90`
  1627. *
  1628. * 在绘制新形状时应用的合成操作的类型。目前安卓版本只适用于 `fill` 填充块的合成,用于 `stroke` 线段的合成效果都是 `source-over`。
  1629. *
  1630. * 目前支持的操作有
  1631. * - 安卓:xor, source-over, source-atop, destination-out, lighter, overlay, darken, lighten, hard-light
  1632. * - 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 */
  1633. globalCompositeOperation: string
  1634. /** 需要基础库: `1.9.90`
  1635. *
  1636. * 线条的端点样式。用法同 [CanvasContext.setLineCap()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineCap.html)。 */
  1637. lineCap: string
  1638. /** 需要基础库: `1.9.90`
  1639. *
  1640. * 虚线偏移量,初始值为0 */
  1641. lineDashOffset: number
  1642. /** 需要基础库: `1.9.90`
  1643. *
  1644. * 线条的交点样式。用法同 [CanvasContext.setLineJoin()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html)。
  1645. *
  1646. * 可选值:
  1647. * - 'bevel': 斜角;
  1648. * - 'round': 圆角;
  1649. * - 'miter': 尖角; */
  1650. lineJoin: 'bevel' | 'round' | 'miter'
  1651. /** 需要基础库: `1.9.90`
  1652. *
  1653. * 线条的宽度。用法同 [CanvasContext.setLineWidth()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineWidth.html)。 */
  1654. lineWidth: number
  1655. /** 需要基础库: `1.9.90`
  1656. *
  1657. * 最大斜接长度。用法同 [CanvasContext.setMiterLimit()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setMiterLimit.html)。 */
  1658. miterLimit: number
  1659. /** 需要基础库: `1.9.90`
  1660. *
  1661. * 阴影的模糊级别 */
  1662. shadowBlur: number
  1663. /** 需要基础库: `1.9.90`
  1664. *
  1665. * 阴影的颜色 */
  1666. shadowColor: number
  1667. /** 需要基础库: `1.9.90`
  1668. *
  1669. * 阴影相对于形状在水平方向的偏移 */
  1670. shadowOffsetX: number
  1671. /** 需要基础库: `1.9.90`
  1672. *
  1673. * 阴影相对于形状在竖直方向的偏移 */
  1674. shadowOffsetY: number
  1675. /** 需要基础库: `1.9.90`
  1676. *
  1677. * 边框颜色。用法同 [CanvasContext.setStrokeStyle()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html)。 */
  1678. strokeStyle: string | CanvasGradient
  1679. /** [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)
  1680. *
  1681. * 在插件中使用:支持
  1682. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  1683. *
  1684. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  1685. *
  1686. * 创建一条弧线。
  1687. *
  1688. * - 创建一个圆可以指定起始弧度为 0,终止弧度为 2 * Math.PI。
  1689. * - 用 `stroke` 或者 `fill` 方法来在 `canvas` 中画弧线。
  1690. *
  1691. * **示例代码**
  1692. *
  1693. * ```javascript
  1694. const ctx = wx.createCanvasContext('myCanvas')
  1695. // Draw coordinates
  1696. ctx.arc(100, 75, 50, 0, 2 * Math.PI)
  1697. ctx.setFillStyle('#EEEEEE')
  1698. ctx.fill()
  1699. ctx.beginPath()
  1700. ctx.moveTo(40, 75)
  1701. ctx.lineTo(160, 75)
  1702. ctx.moveTo(100, 15)
  1703. ctx.lineTo(100, 135)
  1704. ctx.setStrokeStyle('#AAAAAA')
  1705. ctx.stroke()
  1706. ctx.setFontSize(12)
  1707. ctx.setFillStyle('black')
  1708. ctx.fillText('0', 165, 78)
  1709. ctx.fillText('0.5*PI', 83, 145)
  1710. ctx.fillText('1*PI', 15, 78)
  1711. ctx.fillText('1.5*PI', 83, 10)
  1712. // Draw points
  1713. ctx.beginPath()
  1714. ctx.arc(100, 75, 2, 0, 2 * Math.PI)
  1715. ctx.setFillStyle('lightgreen')
  1716. ctx.fill()
  1717. ctx.beginPath()
  1718. ctx.arc(100, 25, 2, 0, 2 * Math.PI)
  1719. ctx.setFillStyle('blue')
  1720. ctx.fill()
  1721. ctx.beginPath()
  1722. ctx.arc(150, 75, 2, 0, 2 * Math.PI)
  1723. ctx.setFillStyle('red')
  1724. ctx.fill()
  1725. // Draw arc
  1726. ctx.beginPath()
  1727. ctx.arc(100, 75, 50, 0, 1.5 * Math.PI)
  1728. ctx.setStrokeStyle('#333333')
  1729. ctx.stroke()
  1730. ctx.draw()
  1731. ```
  1732. *
  1733. * ![](@program/dev/image/canvas/arc.png)
  1734. *
  1735. * 针对 arc(100, 75, 50, 0, 1.5 * Math.PI)的三个关键坐标如下:
  1736. *
  1737. * - 绿色: 圆心 (100, 75)
  1738. * - 红色: 起始弧度 (0)
  1739. * - 蓝色: 终止弧度 (1.5 * Math.PI) */
  1740. arc(
  1741. /** 圆心的 x 坐标 */
  1742. x: number,
  1743. /** 圆心的 y 坐标 */
  1744. y: number,
  1745. /** 圆的半径 */
  1746. r: number,
  1747. /** 起始弧度,单位弧度(在3点钟方向) */
  1748. sAngle: number,
  1749. /** 终止弧度 */
  1750. eAngle: number,
  1751. /** 弧度的方向是否是逆时针 */
  1752. counterclockwise?: boolean
  1753. ): void
  1754. /** [CanvasContext.arcTo(number x1, number y1, number x2, number y2, number radius)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.arcTo.html)
  1755. *
  1756. * 需要基础库: `1.9.90`
  1757. *
  1758. * 在插件中使用:支持
  1759. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  1760. *
  1761. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  1762. *
  1763. * 根据控制点和半径绘制圆弧路径。 */
  1764. arcTo(
  1765. /** 第一个控制点的 x 轴坐标 */
  1766. x1: number,
  1767. /** 第一个控制点的 y 轴坐标 */
  1768. y1: number,
  1769. /** 第二个控制点的 x 轴坐标 */
  1770. x2: number,
  1771. /** 第二个控制点的 y 轴坐标 */
  1772. y2: number,
  1773. /** 圆弧的半径 */
  1774. radius: number
  1775. ): void
  1776. /** [CanvasContext.beginPath()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.beginPath.html)
  1777. *
  1778. * 在插件中使用:支持
  1779. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  1780. *
  1781. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  1782. *
  1783. * 开始创建一个路径。需要调用 `fill` 或者 `stroke` 才会使用路径进行填充或描边
  1784. *
  1785. * - 在最开始的时候相当于调用了一次 `beginPath`。
  1786. * - 同一个路径内的多次 `setFillStyle`、`setStrokeStyle`、`setLineWidth`等设置,以最后一次设置为准。
  1787. *
  1788. * **示例代码**
  1789. *
  1790. * ```javascript
  1791. const ctx = wx.createCanvasContext('myCanvas')
  1792. // begin path
  1793. ctx.rect(10, 10, 100, 30)
  1794. ctx.setFillStyle('yellow')
  1795. ctx.fill()
  1796. // begin another path
  1797. ctx.beginPath()
  1798. ctx.rect(10, 40, 100, 30)
  1799. // only fill this rect, not in current path
  1800. ctx.setFillStyle('blue')
  1801. ctx.fillRect(10, 70, 100, 30)
  1802. ctx.rect(10, 100, 100, 30)
  1803. // it will fill current path
  1804. ctx.setFillStyle('red')
  1805. ctx.fill()
  1806. ctx.draw()
  1807. ```
  1808. *
  1809. * ![](@program/dev/image/canvas/fill-path.png) */
  1810. beginPath(): void
  1811. /** [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)
  1812. *
  1813. * 在插件中使用:支持
  1814. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  1815. *
  1816. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  1817. *
  1818. * 创建三次方贝塞尔曲线路径。曲线的起始点为路径中前一个点。
  1819. *
  1820. * **示例代码**
  1821. *
  1822. * ```javascript
  1823. const ctx = wx.createCanvasContext('myCanvas')
  1824. // Draw points
  1825. ctx.beginPath()
  1826. ctx.arc(20, 20, 2, 0, 2 * Math.PI)
  1827. ctx.setFillStyle('red')
  1828. ctx.fill()
  1829. ctx.beginPath()
  1830. ctx.arc(200, 20, 2, 0, 2 * Math.PI)
  1831. ctx.setFillStyle('lightgreen')
  1832. ctx.fill()
  1833. ctx.beginPath()
  1834. ctx.arc(20, 100, 2, 0, 2 * Math.PI)
  1835. ctx.arc(200, 100, 2, 0, 2 * Math.PI)
  1836. ctx.setFillStyle('blue')
  1837. ctx.fill()
  1838. ctx.setFillStyle('black')
  1839. ctx.setFontSize(12)
  1840. // Draw guides
  1841. ctx.beginPath()
  1842. ctx.moveTo(20, 20)
  1843. ctx.lineTo(20, 100)
  1844. ctx.lineTo(150, 75)
  1845. ctx.moveTo(200, 20)
  1846. ctx.lineTo(200, 100)
  1847. ctx.lineTo(70, 75)
  1848. ctx.setStrokeStyle('#AAAAAA')
  1849. ctx.stroke()
  1850. // Draw quadratic curve
  1851. ctx.beginPath()
  1852. ctx.moveTo(20, 20)
  1853. ctx.bezierCurveTo(20, 100, 200, 100, 200, 20)
  1854. ctx.setStrokeStyle('black')
  1855. ctx.stroke()
  1856. ctx.draw()
  1857. ```
  1858. *
  1859. * ![](@program/dev/image/canvas/bezier-curve.png)
  1860. *
  1861. * 针对 moveTo(20, 20) bezierCurveTo(20, 100, 200, 100, 200, 20) 的三个关键坐标如下:
  1862. *
  1863. * - 红色:起始点(20, 20)
  1864. * - 蓝色:两个控制点(20, 100) (200, 100)
  1865. * - 绿色:终止点(200, 20) */
  1866. bezierCurveTo(
  1867. /** 第一个贝塞尔控制点的 x 坐标 */
  1868. cp1x: number,
  1869. /** 第一个贝塞尔控制点的 y 坐标 */
  1870. cp1y: number,
  1871. /** 第二个贝塞尔控制点的 x 坐标 */
  1872. cp2x: number,
  1873. /** 第二个贝塞尔控制点的 y 坐标 */
  1874. cp2y: number,
  1875. /** 结束点的 x 坐标 */
  1876. x: number,
  1877. /** 结束点的 y 坐标 */
  1878. y: number
  1879. ): void
  1880. /** [CanvasContext.clearRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.clearRect.html)
  1881. *
  1882. * 在插件中使用:支持
  1883. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  1884. *
  1885. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  1886. *
  1887. * 清除画布上在该矩形区域内的内容
  1888. *
  1889. * **示例代码**
  1890. *
  1891. * clearRect 并非画一个白色的矩形在地址区域,而是清空,为了有直观感受,对 canvas 加了一层背景色。
  1892. * ```html
  1893. * <canvas canvas-id="myCanvas" style="border: 1px solid; background: #123456;"/>
  1894. * ```
  1895. * ```javascript
  1896. const ctx = wx.createCanvasContext('myCanvas')
  1897. ctx.setFillStyle('red')
  1898. ctx.fillRect(0, 0, 150, 200)
  1899. ctx.setFillStyle('blue')
  1900. ctx.fillRect(150, 0, 150, 200)
  1901. ctx.clearRect(10, 10, 150, 75)
  1902. ctx.draw()
  1903. ```
  1904. * ![](@program/dev/image/canvas/clear-rect.png) */
  1905. clearRect(
  1906. /** 矩形路径左上角的横坐标 */
  1907. x: number,
  1908. /** 矩形路径左上角的纵坐标 */
  1909. y: number,
  1910. /** 矩形路径的宽度 */
  1911. width: number,
  1912. /** 矩形路径的高度 */
  1913. height: number
  1914. ): void
  1915. /** [CanvasContext.clip()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.clip.html)
  1916. *
  1917. * 需要基础库: `1.6.0`
  1918. *
  1919. * 在插件中使用:支持
  1920. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  1921. *
  1922. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  1923. *
  1924. * 从原始画布中剪切任意形状和尺寸。一旦剪切了某个区域,则所有之后的绘图都会被限制在被剪切的区域内(不能访问画布上的其他区域)。可以在使用 `clip` 方法前通过使用 `save` 方法对当前画布区域进行保存,并在以后的任意时间通过`restore`方法对其进行恢复。
  1925. *
  1926. * **示例代码**
  1927. *
  1928. * ```javascript
  1929. const ctx = wx.createCanvasContext('myCanvas')
  1930. wx.downloadFile({
  1931. url: 'http://is5.mzstatic.com/image/thumb/Purple128/v4/75/3b/90/753b907c-b7fb-5877-215a-759bd73691a4/source/50x50bb.jpg',
  1932. success: function(res) {
  1933. ctx.save()
  1934. ctx.beginPath()
  1935. ctx.arc(50, 50, 25, 0, 2*Math.PI)
  1936. ctx.clip()
  1937. ctx.drawImage(res.tempFilePath, 25, 25)
  1938. ctx.restore()
  1939. ctx.draw()
  1940. }
  1941. })
  1942. ```
  1943. * ![](@program/dev/image/canvas/clip.png) */
  1944. clip(): void
  1945. /** [CanvasContext.closePath()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.closePath.html)
  1946. *
  1947. * 在插件中使用:支持
  1948. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  1949. *
  1950. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  1951. *
  1952. * 关闭一个路径。会连接起点和终点。如果关闭路径后没有调用 `fill` 或者 `stroke` 并开启了新的路径,那之前的路径将不会被渲染。
  1953. *
  1954. * **示例代码**
  1955. *
  1956. * ```javascript
  1957. const ctx = wx.createCanvasContext('myCanvas')
  1958. ctx.moveTo(10, 10)
  1959. ctx.lineTo(100, 10)
  1960. ctx.lineTo(100, 100)
  1961. ctx.closePath()
  1962. ctx.stroke()
  1963. ctx.draw()
  1964. ```
  1965. * ![](@program/dev/image/canvas/close-line.png)
  1966. *
  1967. * ```javascript
  1968. const ctx = wx.createCanvasContext('myCanvas')
  1969. // begin path
  1970. ctx.rect(10, 10, 100, 30)
  1971. ctx.closePath()
  1972. // begin another path
  1973. ctx.beginPath()
  1974. ctx.rect(10, 40, 100, 30)
  1975. // only fill this rect, not in current path
  1976. ctx.setFillStyle('blue')
  1977. ctx.fillRect(10, 70, 100, 30)
  1978. ctx.rect(10, 100, 100, 30)
  1979. // it will fill current path
  1980. ctx.setFillStyle('red')
  1981. ctx.fill()
  1982. ctx.draw()
  1983. ```
  1984. *
  1985. * ![](@program/dev/image/canvas/close-path.png) */
  1986. closePath(): void
  1987. /** [CanvasContext.createPattern(string image, string repetition)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.createPattern.html)
  1988. *
  1989. * 需要基础库: `1.9.90`
  1990. *
  1991. * 在插件中使用:支持
  1992. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  1993. *
  1994. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  1995. *
  1996. * 对指定的图像创建模式的方法,可在指定的方向上重复元图像 */
  1997. createPattern(
  1998. /** 重复的图像源,支持代码包路径和本地临时路径 (本地路径) */
  1999. image: string,
  2000. /** 如何重复图像
  2001. *
  2002. * 参数 repetition 可选值:
  2003. * - 'repeat': 水平竖直方向都重复;
  2004. * - 'repeat-x': 水平方向重复;
  2005. * - 'repeat-y': 竖直方向重复;
  2006. * - 'no-repeat': 不重复; */
  2007. repetition: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat'
  2008. ): void
  2009. /** [CanvasContext.draw(boolean reserve, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.draw.html)
  2010. *
  2011. * 在插件中使用:支持
  2012. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2013. *
  2014. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2015. *
  2016. * 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。
  2017. *
  2018. * **示例代码**
  2019. *
  2020. * 第二次 draw() reserve 为 true。所以保留了上一次的绘制结果,在上下文设置的 fillStyle 'red' 也变成了默认的 'black'。
  2021. *
  2022. * ```javascript
  2023. const ctx = wx.createCanvasContext('myCanvas')
  2024. ctx.setFillStyle('red')
  2025. ctx.fillRect(10, 10, 150, 100)
  2026. ctx.draw()
  2027. ctx.fillRect(50, 50, 150, 100)
  2028. ctx.draw(true)
  2029. ```
  2030. * ![](@program/dev/image/canvas/reserve.png)
  2031. *
  2032. * **示例代码**
  2033. *
  2034. * 第二次 draw() reserve 为 false。所以没有保留了上一次的绘制结果和在上下文设置的 fillStyle 'red'。
  2035. *
  2036. * ```javascript
  2037. const ctx = wx.createCanvasContext('myCanvas')
  2038. ctx.setFillStyle('red')
  2039. ctx.fillRect(10, 10, 150, 100)
  2040. ctx.draw()
  2041. ctx.fillRect(50, 50, 150, 100)
  2042. ctx.draw()
  2043. ```
  2044. * ![](@program/dev/image/canvas/un-reserve.png) */
  2045. draw(
  2046. /** 本次绘制是否接着上一次绘制。即 reserve 参数为 false,则在本次调用绘制之前 native 层会先清空画布再继续绘制;若 reserve 参数为 true,则保留当前画布上的内容,本次调用 drawCanvas 绘制的内容覆盖在上面,默认 false。 */
  2047. reserve?: boolean,
  2048. /** 绘制完成后执行的回调函数 */
  2049. callback?: (...args: any[]) => any
  2050. ): void
  2051. /** [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)
  2052. *
  2053. * 在插件中使用:支持
  2054. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2055. *
  2056. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2057. *
  2058. * 绘制图像到画布
  2059. *
  2060. * **示例代码**
  2061. *
  2062. * 有三个版本的写法:
  2063. *
  2064. * - drawImage(imageResource, dx, dy)
  2065. * - drawImage(imageResource, dx, dy, dWidth, dHeight)
  2066. * - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持
  2067. *
  2068. * ```javascript
  2069. const ctx = wx.createCanvasContext('myCanvas')
  2070. wx.chooseImage({
  2071. success: function(res){
  2072. ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
  2073. ctx.draw()
  2074. }
  2075. })
  2076. ```
  2077. * ![](@program/dev/image/canvas/draw-image.png) */
  2078. drawImage(
  2079. /** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */
  2080. imageResource: string,
  2081. /** imageResource的左上角在目标 canvas 上 x 轴的位置 */
  2082. dx: number,
  2083. /** imageResource的左上角在目标 canvas 上 y 轴的位置 */
  2084. dy: number
  2085. ): void
  2086. /** [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)
  2087. *
  2088. * 在插件中使用:支持
  2089. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2090. *
  2091. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2092. *
  2093. * 绘制图像到画布
  2094. *
  2095. * **示例代码**
  2096. *
  2097. * 有三个版本的写法:
  2098. *
  2099. * - drawImage(imageResource, dx, dy)
  2100. * - drawImage(imageResource, dx, dy, dWidth, dHeight)
  2101. * - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持
  2102. *
  2103. * ```javascript
  2104. const ctx = wx.createCanvasContext('myCanvas')
  2105. wx.chooseImage({
  2106. success: function(res){
  2107. ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
  2108. ctx.draw()
  2109. }
  2110. })
  2111. ```
  2112. * ![](@program/dev/image/canvas/draw-image.png) */
  2113. drawImage(
  2114. /** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */
  2115. imageResource: string,
  2116. /** imageResource的左上角在目标 canvas 上 x 轴的位置 */
  2117. dx: number,
  2118. /** imageResource的左上角在目标 canvas 上 y 轴的位置 */
  2119. dy: number,
  2120. /** 在目标画布上绘制imageResource的宽度,允许对绘制的imageResource进行缩放 */
  2121. dWidth: number,
  2122. /** 在目标画布上绘制imageResource的高度,允许对绘制的imageResource进行缩放 */
  2123. dHeight: number
  2124. ): void
  2125. /** [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)
  2126. *
  2127. * 在插件中使用:支持
  2128. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2129. *
  2130. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2131. *
  2132. * 绘制图像到画布
  2133. *
  2134. * **示例代码**
  2135. *
  2136. * 有三个版本的写法:
  2137. *
  2138. * - drawImage(imageResource, dx, dy)
  2139. * - drawImage(imageResource, dx, dy, dWidth, dHeight)
  2140. * - drawImage(imageResource, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) 从 1.9.0 起支持
  2141. *
  2142. * ```javascript
  2143. const ctx = wx.createCanvasContext('myCanvas')
  2144. wx.chooseImage({
  2145. success: function(res){
  2146. ctx.drawImage(res.tempFilePaths[0], 0, 0, 150, 100)
  2147. ctx.draw()
  2148. }
  2149. })
  2150. ```
  2151. * ![](@program/dev/image/canvas/draw-image.png) */
  2152. drawImage(
  2153. /** 所要绘制的图片资源(网络图片要通过 getImageInfo / downloadFile 先下载) */
  2154. imageResource: string,
  2155. /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的左上角 x 坐标 */
  2156. sx: number,
  2157. /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的左上角 y 坐标 */
  2158. sy: number,
  2159. /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的宽度 */
  2160. sWidth: number,
  2161. /** 需要绘制到画布中的,imageResource的矩形(裁剪)选择框的高度 */
  2162. sHeight: number,
  2163. /** imageResource的左上角在目标 canvas 上 x 轴的位置 */
  2164. dx: number,
  2165. /** imageResource的左上角在目标 canvas 上 y 轴的位置 */
  2166. dy: number,
  2167. /** 在目标画布上绘制imageResource的宽度,允许对绘制的imageResource进行缩放 */
  2168. dWidth: number,
  2169. /** 在目标画布上绘制imageResource的高度,允许对绘制的imageResource进行缩放 */
  2170. dHeight: number
  2171. ): void
  2172. /** [CanvasContext.fill()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fill.html)
  2173. *
  2174. * 在插件中使用:支持
  2175. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2176. *
  2177. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2178. *
  2179. * 对当前路径中的内容进行填充。默认的填充色为黑色。
  2180. *
  2181. * **示例代码**
  2182. *
  2183. * 如果当前路径没有闭合,fill() 方法会将起点和终点进行连接,然后填充。
  2184. *
  2185. * ```javascript
  2186. const ctx = wx.createCanvasContext('myCanvas')
  2187. ctx.moveTo(10, 10)
  2188. ctx.lineTo(100, 10)
  2189. ctx.lineTo(100, 100)
  2190. ctx.fill()
  2191. ctx.draw()
  2192. ```
  2193. *
  2194. * fill() 填充的的路径是从 beginPath() 开始计算,但是不会将 fillRect() 包含进去。
  2195. *
  2196. * ![](@program/dev/image/canvas/fill-line.png)
  2197. *
  2198. * ```javascript
  2199. const ctx = wx.createCanvasContext('myCanvas')
  2200. // begin path
  2201. ctx.rect(10, 10, 100, 30)
  2202. ctx.setFillStyle('yellow')
  2203. ctx.fill()
  2204. // begin another path
  2205. ctx.beginPath()
  2206. ctx.rect(10, 40, 100, 30)
  2207. // only fill this rect, not in current path
  2208. ctx.setFillStyle('blue')
  2209. ctx.fillRect(10, 70, 100, 30)
  2210. ctx.rect(10, 100, 100, 30)
  2211. // it will fill current path
  2212. ctx.setFillStyle('red')
  2213. ctx.fill()
  2214. ctx.draw()
  2215. ```
  2216. *
  2217. * ![](@program/dev/image/canvas/fill-path.png) */
  2218. fill(): void
  2219. /** [CanvasContext.fillRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fillRect.html)
  2220. *
  2221. * 在插件中使用:支持
  2222. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2223. *
  2224. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2225. *
  2226. * 填充一个矩形。用 [`setFillStyle`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFillStyle.html) 设置矩形的填充色,如果没设置默认是黑色。
  2227. *
  2228. * **示例代码**
  2229. *
  2230. * ```javascript
  2231. const ctx = wx.createCanvasContext('myCanvas')
  2232. ctx.setFillStyle('red')
  2233. ctx.fillRect(10, 10, 150, 75)
  2234. ctx.draw()
  2235. ```
  2236. * ![](@program/dev/image/canvas/fill-rect.png) */
  2237. fillRect(
  2238. /** 矩形路径左上角的横坐标 */
  2239. x: number,
  2240. /** 矩形路径左上角的纵坐标 */
  2241. y: number,
  2242. /** 矩形路径的宽度 */
  2243. width: number,
  2244. /** 矩形路径的高度 */
  2245. height: number
  2246. ): void
  2247. /** [CanvasContext.fillText(string text, number x, number y, number maxWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.fillText.html)
  2248. *
  2249. * 在插件中使用:支持
  2250. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2251. *
  2252. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2253. *
  2254. * 在画布上绘制被填充的文本
  2255. *
  2256. * **示例代码**
  2257. *
  2258. * ```javascript
  2259. const ctx = wx.createCanvasContext('myCanvas')
  2260. ctx.setFontSize(20)
  2261. ctx.fillText('Hello', 20, 20)
  2262. ctx.fillText('MINA', 100, 100)
  2263. ctx.draw()
  2264. ```
  2265. * ![](@program/dev/image/canvas/text.png) */
  2266. fillText(
  2267. /** 在画布上输出的文本 */
  2268. text: string,
  2269. /** 绘制文本的左上角 x 坐标位置 */
  2270. x: number,
  2271. /** 绘制文本的左上角 y 坐标位置 */
  2272. y: number,
  2273. /** 需要绘制的最大宽度,可选 */
  2274. maxWidth?: number
  2275. ): void
  2276. /** [CanvasContext.lineTo(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.lineTo.html)
  2277. *
  2278. * 在插件中使用:支持
  2279. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2280. *
  2281. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2282. *
  2283. * 增加一个新点,然后创建一条从上次指定点到目标点的线。用 `stroke` 方法来画线条
  2284. *
  2285. * **示例代码**
  2286. *
  2287. * ```javascript
  2288. const ctx = wx.createCanvasContext('myCanvas')
  2289. ctx.moveTo(10, 10)
  2290. ctx.rect(10, 10, 100, 50)
  2291. ctx.lineTo(110, 60)
  2292. ctx.stroke()
  2293. ctx.draw()
  2294. ```
  2295. * ![](@program/dev/image/canvas/line-to.png) */
  2296. lineTo(
  2297. /** 目标位置的 x 坐标 */
  2298. x: number,
  2299. /** 目标位置的 y 坐标 */
  2300. y: number
  2301. ): void
  2302. /** [CanvasContext.moveTo(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.moveTo.html)
  2303. *
  2304. * 在插件中使用:支持
  2305. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2306. *
  2307. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2308. *
  2309. * 把路径移动到画布中的指定点,不创建线条。用 `stroke` 方法来画线条
  2310. *
  2311. * **示例代码**
  2312. *
  2313. * ```javascript
  2314. const ctx = wx.createCanvasContext('myCanvas')
  2315. ctx.moveTo(10, 10)
  2316. ctx.lineTo(100, 10)
  2317. ctx.moveTo(10, 50)
  2318. ctx.lineTo(100, 50)
  2319. ctx.stroke()
  2320. ctx.draw()
  2321. ```
  2322. * ![](@program/dev/image/canvas/move-to.png) */
  2323. moveTo(
  2324. /** 目标位置的 x 坐标 */
  2325. x: number,
  2326. /** 目标位置的 y 坐标 */
  2327. y: number
  2328. ): void
  2329. /** [CanvasContext.quadraticCurveTo(number cpx, number cpy, number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.quadraticCurveTo.html)
  2330. *
  2331. * 在插件中使用:支持
  2332. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2333. *
  2334. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2335. *
  2336. * 创建二次贝塞尔曲线路径。曲线的起始点为路径中前一个点。
  2337. *
  2338. * **示例代码**
  2339. *
  2340. * ```javascript
  2341. const ctx = wx.createCanvasContext('myCanvas')
  2342. // Draw points
  2343. ctx.beginPath()
  2344. ctx.arc(20, 20, 2, 0, 2 * Math.PI)
  2345. ctx.setFillStyle('red')
  2346. ctx.fill()
  2347. ctx.beginPath()
  2348. ctx.arc(200, 20, 2, 0, 2 * Math.PI)
  2349. ctx.setFillStyle('lightgreen')
  2350. ctx.fill()
  2351. ctx.beginPath()
  2352. ctx.arc(20, 100, 2, 0, 2 * Math.PI)
  2353. ctx.setFillStyle('blue')
  2354. ctx.fill()
  2355. ctx.setFillStyle('black')
  2356. ctx.setFontSize(12)
  2357. // Draw guides
  2358. ctx.beginPath()
  2359. ctx.moveTo(20, 20)
  2360. ctx.lineTo(20, 100)
  2361. ctx.lineTo(200, 20)
  2362. ctx.setStrokeStyle('#AAAAAA')
  2363. ctx.stroke()
  2364. // Draw quadratic curve
  2365. ctx.beginPath()
  2366. ctx.moveTo(20, 20)
  2367. ctx.quadraticCurveTo(20, 100, 200, 20)
  2368. ctx.setStrokeStyle('black')
  2369. ctx.stroke()
  2370. ctx.draw()
  2371. ```
  2372. *
  2373. * ![](@program/dev/image/canvas/quadratic-curve-to.png)
  2374. *
  2375. * 针对 moveTo(20, 20) quadraticCurveTo(20, 100, 200, 20) 的三个关键坐标如下:
  2376. *
  2377. * - 红色:起始点(20, 20)
  2378. * - 蓝色:控制点(20, 100)
  2379. * - 绿色:终止点(200, 20) */
  2380. quadraticCurveTo(
  2381. /** 贝塞尔控制点的 x 坐标 */
  2382. cpx: number,
  2383. /** 贝塞尔控制点的 y 坐标 */
  2384. cpy: number,
  2385. /** 结束点的 x 坐标 */
  2386. x: number,
  2387. /** 结束点的 y 坐标 */
  2388. y: number
  2389. ): void
  2390. /** [CanvasContext.rect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.rect.html)
  2391. *
  2392. * 在插件中使用:支持
  2393. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2394. *
  2395. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2396. *
  2397. * 创建一个矩形路径。需要用 [`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` 中
  2398. *
  2399. * **示例代码**
  2400. *
  2401. * ```javascript
  2402. const ctx = wx.createCanvasContext('myCanvas')
  2403. ctx.rect(10, 10, 150, 75)
  2404. ctx.setFillStyle('red')
  2405. ctx.fill()
  2406. ctx.draw()
  2407. ```
  2408. * ![](@program/dev/image/canvas/fill-rect.png) */
  2409. rect(
  2410. /** 矩形路径左上角的横坐标 */
  2411. x: number,
  2412. /** 矩形路径左上角的纵坐标 */
  2413. y: number,
  2414. /** 矩形路径的宽度 */
  2415. width: number,
  2416. /** 矩形路径的高度 */
  2417. height: number
  2418. ): void
  2419. /** [CanvasContext.restore()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.restore.html)
  2420. *
  2421. * 在插件中使用:支持
  2422. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2423. *
  2424. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2425. *
  2426. * 恢复之前保存的绘图上下文。
  2427. *
  2428. * **示例代码**
  2429. *
  2430. * ```javascript
  2431. const ctx = wx.createCanvasContext('myCanvas')
  2432. // save the default fill style
  2433. ctx.save()
  2434. ctx.setFillStyle('red')
  2435. ctx.fillRect(10, 10, 150, 100)
  2436. // restore to the previous saved state
  2437. ctx.restore()
  2438. ctx.fillRect(50, 50, 150, 100)
  2439. ctx.draw()
  2440. ```
  2441. * ![](@program/dev/image/canvas/save-restore.png) */
  2442. restore(): void
  2443. /** [CanvasContext.rotate(number rotate)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.rotate.html)
  2444. *
  2445. * 在插件中使用:支持
  2446. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2447. *
  2448. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2449. *
  2450. * 以原点为中心顺时针旋转当前坐标轴。多次调用旋转的角度会叠加。原点可以用 `translate` 方法修改。
  2451. *
  2452. * **示例代码**
  2453. *
  2454. * ```javascript
  2455. const ctx = wx.createCanvasContext('myCanvas')
  2456. ctx.strokeRect(100, 10, 150, 100)
  2457. ctx.rotate(20 * Math.PI / 180)
  2458. ctx.strokeRect(100, 10, 150, 100)
  2459. ctx.rotate(20 * Math.PI / 180)
  2460. ctx.strokeRect(100, 10, 150, 100)
  2461. ctx.draw()
  2462. ```
  2463. * ![](@program/dev/image/canvas/rotate.png) */
  2464. rotate(
  2465. /** 旋转角度,以弧度计 degrees * Math.PI/180;degrees 范围为 0-360 */
  2466. rotate: number
  2467. ): void
  2468. /** [CanvasContext.save()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.save.html)
  2469. *
  2470. * 在插件中使用:支持
  2471. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2472. *
  2473. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2474. *
  2475. * 保存绘图上下文。
  2476. *
  2477. * **示例代码**
  2478. *
  2479. * ```javascript
  2480. const ctx = wx.createCanvasContext('myCanvas')
  2481. // save the default fill style
  2482. ctx.save()
  2483. ctx.setFillStyle('red')
  2484. ctx.fillRect(10, 10, 150, 100)
  2485. // restore to the previous saved state
  2486. ctx.restore()
  2487. ctx.fillRect(50, 50, 150, 100)
  2488. ctx.draw()
  2489. ```
  2490. * ![](@program/dev/image/canvas/save-restore.png) */
  2491. save(): void
  2492. /** [CanvasContext.scale(number scaleWidth, number scaleHeight)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.scale.html)
  2493. *
  2494. * 在插件中使用:支持
  2495. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2496. *
  2497. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2498. *
  2499. * 在调用后,之后创建的路径其横纵坐标会被缩放。多次调用倍数会相乘。
  2500. *
  2501. * **示例代码**
  2502. *
  2503. * ```javascript
  2504. const ctx = wx.createCanvasContext('myCanvas')
  2505. ctx.strokeRect(10, 10, 25, 15)
  2506. ctx.scale(2, 2)
  2507. ctx.strokeRect(10, 10, 25, 15)
  2508. ctx.scale(2, 2)
  2509. ctx.strokeRect(10, 10, 25, 15)
  2510. ctx.draw()
  2511. ```
  2512. * ![](@program/dev/image/canvas/scale.png) */
  2513. scale(
  2514. /** 横坐标缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%) */
  2515. scaleWidth: number,
  2516. /** 纵坐标轴缩放的倍数 (1 = 100%,0.5 = 50%,2 = 200%) */
  2517. scaleHeight: number
  2518. ): void
  2519. /** [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)
  2520. *
  2521. * 在插件中使用:支持
  2522. * @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) 替换
  2523. *
  2524. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2525. *
  2526. * 设置填充色。
  2527. *
  2528. * **代码示例**
  2529. *
  2530. * ```js
  2531. const ctx = wx.createCanvasContext('myCanvas')
  2532. ctx.setFillStyle('red')
  2533. ctx.fillRect(10, 10, 150, 75)
  2534. ctx.draw()
  2535. ```
  2536. * ![](@program/dev/image/canvas/fill-rect.png) */
  2537. setFillStyle(
  2538. /** 填充的颜色,默认颜色为 black。 */
  2539. color: string | CanvasGradient
  2540. ): void
  2541. /** [CanvasContext.setFontSize(number fontSize)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setFontSize.html)
  2542. *
  2543. * 在插件中使用:支持
  2544. * @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) 替换
  2545. *
  2546. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2547. *
  2548. * 设置字体的字号
  2549. *
  2550. * **示例代码**
  2551. *
  2552. * ```javascript
  2553. const ctx = wx.createCanvasContext('myCanvas')
  2554. ctx.setFontSize(20)
  2555. ctx.fillText('20', 20, 20)
  2556. ctx.setFontSize(30)
  2557. ctx.fillText('30', 40, 40)
  2558. ctx.setFontSize(40)
  2559. ctx.fillText('40', 60, 60)
  2560. ctx.setFontSize(50)
  2561. ctx.fillText('50', 90, 90)
  2562. ctx.draw()
  2563. ```
  2564. * ![](@program/dev/image/canvas/font-size.png) */
  2565. setFontSize(
  2566. /** 字体的字号 */
  2567. fontSize: number
  2568. ): void
  2569. /** [CanvasContext.setGlobalAlpha(number alpha)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setGlobalAlpha.html)
  2570. *
  2571. * 在插件中使用:支持
  2572. * @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) 替换
  2573. *
  2574. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2575. *
  2576. * 设置全局画笔透明度。
  2577. *
  2578. * **示例代码**
  2579. *
  2580. * ```javascript
  2581. const ctx = wx.createCanvasContext('myCanvas')
  2582. ctx.setFillStyle('red')
  2583. ctx.fillRect(10, 10, 150, 100)
  2584. ctx.setGlobalAlpha(0.2)
  2585. ctx.setFillStyle('blue')
  2586. ctx.fillRect(50, 50, 150, 100)
  2587. ctx.setFillStyle('yellow')
  2588. ctx.fillRect(100, 100, 150, 100)
  2589. ctx.draw()
  2590. ```
  2591. * ![](@program/dev/image/canvas/global-alpha.png) */
  2592. setGlobalAlpha(
  2593. /** 透明度。范围 0-1,0 表示完全透明,1 表示完全不透明。 */
  2594. alpha: number
  2595. ): void
  2596. /** [CanvasContext.setLineCap(string lineCap)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineCap.html)
  2597. *
  2598. * 在插件中使用:支持
  2599. * @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) 替换
  2600. *
  2601. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2602. *
  2603. * 设置线条的端点样式
  2604. *
  2605. * **示例代码**
  2606. *
  2607. * ```javascript
  2608. const ctx = wx.createCanvasContext('myCanvas')
  2609. ctx.beginPath()
  2610. ctx.moveTo(10, 10)
  2611. ctx.lineTo(150, 10)
  2612. ctx.stroke()
  2613. ctx.beginPath()
  2614. ctx.setLineCap('butt')
  2615. ctx.setLineWidth(10)
  2616. ctx.moveTo(10, 30)
  2617. ctx.lineTo(150, 30)
  2618. ctx.stroke()
  2619. ctx.beginPath()
  2620. ctx.setLineCap('round')
  2621. ctx.setLineWidth(10)
  2622. ctx.moveTo(10, 50)
  2623. ctx.lineTo(150, 50)
  2624. ctx.stroke()
  2625. ctx.beginPath()
  2626. ctx.setLineCap('square')
  2627. ctx.setLineWidth(10)
  2628. ctx.moveTo(10, 70)
  2629. ctx.lineTo(150, 70)
  2630. ctx.stroke()
  2631. ctx.draw()
  2632. ```
  2633. * ![](@program/dev/image/canvas/line-cap.png) */
  2634. setLineCap(
  2635. /** 线条的结束端点样式
  2636. *
  2637. * 参数 lineCap 可选值:
  2638. * - 'butt': 向线条的每个末端添加平直的边缘。;
  2639. * - 'round': 向线条的每个末端添加圆形线帽。;
  2640. * - 'square': 向线条的每个末端添加正方形线帽。; */
  2641. lineCap: 'butt' | 'round' | 'square'
  2642. ): void
  2643. /** [CanvasContext.setLineDash(Array.&lt;number&gt; pattern, number offset)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineDash.html)
  2644. *
  2645. * 需要基础库: `1.6.0`
  2646. *
  2647. * 在插件中使用:支持
  2648. * @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) 替换
  2649. *
  2650. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2651. *
  2652. * 设置虚线样式。
  2653. *
  2654. * **示例代码**
  2655. *
  2656. * ```javascript
  2657. const ctx = wx.createCanvasContext('myCanvas')
  2658. ctx.setLineDash([10, 20], 5);
  2659. ctx.beginPath();
  2660. ctx.moveTo(0,100);
  2661. ctx.lineTo(400, 100);
  2662. ctx.stroke();
  2663. ctx.draw()
  2664. ```
  2665. * ![](@program/dev/image/canvas/set-line-dash.png) */
  2666. setLineDash(
  2667. /** 一组描述交替绘制线段和间距(坐标空间单位)长度的数字 */
  2668. pattern: number[],
  2669. /** 虚线偏移量 */
  2670. offset: number
  2671. ): void
  2672. /** [CanvasContext.setLineJoin(string lineJoin)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html)
  2673. *
  2674. * 在插件中使用:支持
  2675. * @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) 替换
  2676. *
  2677. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2678. *
  2679. * 设置线条的交点样式
  2680. *
  2681. * **示例代码**
  2682. *
  2683. * ```javascript
  2684. const ctx = wx.createCanvasContext('myCanvas')
  2685. ctx.beginPath()
  2686. ctx.moveTo(10, 10)
  2687. ctx.lineTo(100, 50)
  2688. ctx.lineTo(10, 90)
  2689. ctx.stroke()
  2690. ctx.beginPath()
  2691. ctx.setLineJoin('bevel')
  2692. ctx.setLineWidth(10)
  2693. ctx.moveTo(50, 10)
  2694. ctx.lineTo(140, 50)
  2695. ctx.lineTo(50, 90)
  2696. ctx.stroke()
  2697. ctx.beginPath()
  2698. ctx.setLineJoin('round')
  2699. ctx.setLineWidth(10)
  2700. ctx.moveTo(90, 10)
  2701. ctx.lineTo(180, 50)
  2702. ctx.lineTo(90, 90)
  2703. ctx.stroke()
  2704. ctx.beginPath()
  2705. ctx.setLineJoin('miter')
  2706. ctx.setLineWidth(10)
  2707. ctx.moveTo(130, 10)
  2708. ctx.lineTo(220, 50)
  2709. ctx.lineTo(130, 90)
  2710. ctx.stroke()
  2711. ctx.draw()
  2712. ```
  2713. * ![](@program/dev/image/canvas/line-join.png) */
  2714. setLineJoin(
  2715. /** 线条的结束交点样式
  2716. *
  2717. * 参数 lineJoin 可选值:
  2718. * - 'bevel': 斜角;
  2719. * - 'round': 圆角;
  2720. * - 'miter': 尖角; */
  2721. lineJoin: 'bevel' | 'round' | 'miter'
  2722. ): void
  2723. /** [CanvasContext.setLineWidth(number lineWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineWidth.html)
  2724. *
  2725. * 在插件中使用:支持
  2726. * @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) 替换
  2727. *
  2728. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2729. *
  2730. * 设置线条的宽度
  2731. *
  2732. * **示例代码**
  2733. *
  2734. * ```javascript
  2735. const ctx = wx.createCanvasContext('myCanvas')
  2736. ctx.beginPath()
  2737. ctx.moveTo(10, 10)
  2738. ctx.lineTo(150, 10)
  2739. ctx.stroke()
  2740. ctx.beginPath()
  2741. ctx.setLineWidth(5)
  2742. ctx.moveTo(10, 30)
  2743. ctx.lineTo(150, 30)
  2744. ctx.stroke()
  2745. ctx.beginPath()
  2746. ctx.setLineWidth(10)
  2747. ctx.moveTo(10, 50)
  2748. ctx.lineTo(150, 50)
  2749. ctx.stroke()
  2750. ctx.beginPath()
  2751. ctx.setLineWidth(15)
  2752. ctx.moveTo(10, 70)
  2753. ctx.lineTo(150, 70)
  2754. ctx.stroke()
  2755. ctx.draw()
  2756. ```
  2757. *
  2758. * ![](@program/dev/image/canvas/line-width.png) */
  2759. setLineWidth(
  2760. /** 线条的宽度,单位px */
  2761. lineWidth: number
  2762. ): void
  2763. /** [CanvasContext.setMiterLimit(number miterLimit)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setMiterLimit.html)
  2764. *
  2765. * 在插件中使用:支持
  2766. * @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) 替换
  2767. *
  2768. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2769. *
  2770. * 设置最大斜接长度。斜接长度指的是在两条线交汇处内角和外角之间的距离。当 [CanvasContext.setLineJoin()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setLineJoin.html) 为 miter 时才有效。超过最大倾斜长度的,连接处将以 lineJoin 为 bevel 来显示。
  2771. *
  2772. * **示例代码**
  2773. *
  2774. * ```javascript
  2775. const ctx = wx.createCanvasContext('myCanvas')
  2776. ctx.beginPath()
  2777. ctx.setLineWidth(10)
  2778. ctx.setLineJoin('miter')
  2779. ctx.setMiterLimit(1)
  2780. ctx.moveTo(10, 10)
  2781. ctx.lineTo(100, 50)
  2782. ctx.lineTo(10, 90)
  2783. ctx.stroke()
  2784. ctx.beginPath()
  2785. ctx.setLineWidth(10)
  2786. ctx.setLineJoin('miter')
  2787. ctx.setMiterLimit(2)
  2788. ctx.moveTo(50, 10)
  2789. ctx.lineTo(140, 50)
  2790. ctx.lineTo(50, 90)
  2791. ctx.stroke()
  2792. ctx.beginPath()
  2793. ctx.setLineWidth(10)
  2794. ctx.setLineJoin('miter')
  2795. ctx.setMiterLimit(3)
  2796. ctx.moveTo(90, 10)
  2797. ctx.lineTo(180, 50)
  2798. ctx.lineTo(90, 90)
  2799. ctx.stroke()
  2800. ctx.beginPath()
  2801. ctx.setLineWidth(10)
  2802. ctx.setLineJoin('miter')
  2803. ctx.setMiterLimit(4)
  2804. ctx.moveTo(130, 10)
  2805. ctx.lineTo(220, 50)
  2806. ctx.lineTo(130, 90)
  2807. ctx.stroke()
  2808. ctx.draw()
  2809. ```
  2810. * ![](@program/dev/image/canvas/miter-limit.png) */
  2811. setMiterLimit(
  2812. /** 最大斜接长度 */
  2813. miterLimit: number
  2814. ): void
  2815. /** [CanvasContext.setShadow(number offsetX, number offsetY, number blur, string color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setShadow.html)
  2816. *
  2817. * 在插件中使用:支持
  2818. * @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) 替换
  2819. *
  2820. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2821. *
  2822. * 设定阴影样式。
  2823. *
  2824. * **示例代码**
  2825. *
  2826. * ```javascript
  2827. const ctx = wx.createCanvasContext('myCanvas')
  2828. ctx.setFillStyle('red')
  2829. ctx.setShadow(10, 50, 50, 'blue')
  2830. ctx.fillRect(10, 10, 150, 75)
  2831. ctx.draw()
  2832. ```
  2833. * ![](@program/dev/image/canvas/shadow.png) */
  2834. setShadow(
  2835. /** 阴影相对于形状在水平方向的偏移,默认值为 0。 */
  2836. offsetX: number,
  2837. /** 阴影相对于形状在竖直方向的偏移,默认值为 0。 */
  2838. offsetY: number,
  2839. /** 阴影的模糊级别,数值越大越模糊。范围 0- 100。,默认值为 0。 */
  2840. blur: number,
  2841. /** 阴影的颜色。默认值为 black。 */
  2842. color: string
  2843. ): void
  2844. /** [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)
  2845. *
  2846. * 在插件中使用:支持
  2847. * @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) 替换
  2848. *
  2849. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2850. *
  2851. * 设置描边颜色。
  2852. *
  2853. * **代码示例**
  2854. *
  2855. * ```js
  2856. const ctx = wx.createCanvasContext('myCanvas')
  2857. ctx.setStrokeStyle('red')
  2858. ctx.strokeRect(10, 10, 150, 75)
  2859. ctx.draw()
  2860. ```
  2861. * ![](@program/dev/image/canvas/stroke-rect.png) */
  2862. setStrokeStyle(
  2863. /** 描边的颜色,默认颜色为 black。 */
  2864. color: string | CanvasGradient
  2865. ): void
  2866. /** [CanvasContext.setTextAlign(string align)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextAlign.html)
  2867. *
  2868. * 需要基础库: `1.1.0`
  2869. *
  2870. * 在插件中使用:支持
  2871. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2872. *
  2873. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2874. *
  2875. * 设置文字的对齐
  2876. *
  2877. * **示例代码**
  2878. *
  2879. * ```javascript
  2880. const ctx = wx.createCanvasContext('myCanvas')
  2881. ctx.setStrokeStyle('red')
  2882. ctx.moveTo(150, 20)
  2883. ctx.lineTo(150, 170)
  2884. ctx.stroke()
  2885. ctx.setFontSize(15)
  2886. ctx.setTextAlign('left')
  2887. ctx.fillText('textAlign=left', 150, 60)
  2888. ctx.setTextAlign('center')
  2889. ctx.fillText('textAlign=center', 150, 80)
  2890. ctx.setTextAlign('right')
  2891. ctx.fillText('textAlign=right', 150, 100)
  2892. ctx.draw()
  2893. ```
  2894. *
  2895. * ![](@program/dev/image/canvas/set-text-align.png) */
  2896. setTextAlign(
  2897. /** 文字的对齐方式
  2898. *
  2899. * 参数 align 可选值:
  2900. * - 'left': 左对齐;
  2901. * - 'center': 居中对齐;
  2902. * - 'right': 右对齐; */
  2903. align: 'left' | 'center' | 'right'
  2904. ): void
  2905. /** [CanvasContext.setTextBaseline(string textBaseline)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextBaseline.html)
  2906. *
  2907. * 需要基础库: `1.4.0`
  2908. *
  2909. * 在插件中使用:支持
  2910. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2911. *
  2912. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2913. *
  2914. * 设置文字的竖直对齐
  2915. *
  2916. * **示例代码**
  2917. *
  2918. * ```javascript
  2919. const ctx = wx.createCanvasContext('myCanvas')
  2920. ctx.setStrokeStyle('red')
  2921. ctx.moveTo(5, 75)
  2922. ctx.lineTo(295, 75)
  2923. ctx.stroke()
  2924. ctx.setFontSize(20)
  2925. ctx.setTextBaseline('top')
  2926. ctx.fillText('top', 5, 75)
  2927. ctx.setTextBaseline('middle')
  2928. ctx.fillText('middle', 50, 75)
  2929. ctx.setTextBaseline('bottom')
  2930. ctx.fillText('bottom', 120, 75)
  2931. ctx.setTextBaseline('normal')
  2932. ctx.fillText('normal', 200, 75)
  2933. ctx.draw()
  2934. ```
  2935. * ![](@program/dev/image/canvas/set-text-baseline.png) */
  2936. setTextBaseline(
  2937. /** 文字的竖直对齐方式
  2938. *
  2939. * 参数 textBaseline 可选值:
  2940. * - 'top': 顶部对齐;
  2941. * - 'bottom': 底部对齐;
  2942. * - 'middle': 居中对齐;
  2943. * - 'normal': ; */
  2944. textBaseline: 'top' | 'bottom' | 'middle' | 'normal'
  2945. ): void
  2946. /** [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)
  2947. *
  2948. * 需要基础库: `1.9.90`
  2949. *
  2950. * 在插件中使用:支持
  2951. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2952. *
  2953. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2954. *
  2955. * 使用矩阵重新设置(覆盖)当前变换的方法 */
  2956. setTransform(
  2957. /** 水平缩放 */
  2958. scaleX: number,
  2959. /** 水平倾斜 */
  2960. skewX: number,
  2961. /** 垂直倾斜 */
  2962. skewY: number,
  2963. /** 垂直缩放 */
  2964. scaleY: number,
  2965. /** 水平移动 */
  2966. translateX: number,
  2967. /** 垂直移动 */
  2968. translateY: number
  2969. ): void
  2970. /** [CanvasContext.stroke()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.stroke.html)
  2971. *
  2972. * 在插件中使用:支持
  2973. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  2974. *
  2975. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  2976. *
  2977. * 画出当前路径的边框。默认颜色色为黑色。
  2978. *
  2979. * **示例代码**
  2980. *
  2981. * ```javascript
  2982. const ctx = wx.createCanvasContext('myCanvas')
  2983. ctx.moveTo(10, 10)
  2984. ctx.lineTo(100, 10)
  2985. ctx.lineTo(100, 100)
  2986. ctx.stroke()
  2987. ctx.draw()
  2988. ```
  2989. * ![](@program/dev/image/canvas/stroke-line.png)
  2990. *
  2991. * stroke() 描绘的的路径是从 beginPath() 开始计算,但是不会将 strokeRect() 包含进去。
  2992. *
  2993. * ```javascript
  2994. const ctx = wx.createCanvasContext('myCanvas')
  2995. // begin path
  2996. ctx.rect(10, 10, 100, 30)
  2997. ctx.setStrokeStyle('yellow')
  2998. ctx.stroke()
  2999. // begin another path
  3000. ctx.beginPath()
  3001. ctx.rect(10, 40, 100, 30)
  3002. // only stoke this rect, not in current path
  3003. ctx.setStrokeStyle('blue')
  3004. ctx.strokeRect(10, 70, 100, 30)
  3005. ctx.rect(10, 100, 100, 30)
  3006. // it will stroke current path
  3007. ctx.setStrokeStyle('red')
  3008. ctx.stroke()
  3009. ctx.draw()
  3010. ```
  3011. *
  3012. * ![](@program/dev/image/canvas/stroke-path.png) */
  3013. stroke(): void
  3014. /** [CanvasContext.strokeRect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.strokeRect.html)
  3015. *
  3016. * 在插件中使用:支持
  3017. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  3018. *
  3019. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  3020. *
  3021. * 画一个矩形(非填充)。 用 [`setStrokeStyle`](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setStrokeStyle.html) 设置矩形线条的颜色,如果没设置默认是黑色。
  3022. *
  3023. * **示例代码**
  3024. *
  3025. * ```javascript
  3026. const ctx = wx.createCanvasContext('myCanvas')
  3027. ctx.setStrokeStyle('red')
  3028. ctx.strokeRect(10, 10, 150, 75)
  3029. ctx.draw()
  3030. ```
  3031. * ![](@program/dev/image/canvas/stroke-rect.png) */
  3032. strokeRect(
  3033. /** 矩形路径左上角的横坐标 */
  3034. x: number,
  3035. /** 矩形路径左上角的纵坐标 */
  3036. y: number,
  3037. /** 矩形路径的宽度 */
  3038. width: number,
  3039. /** 矩形路径的高度 */
  3040. height: number
  3041. ): void
  3042. /** [CanvasContext.strokeText(string text, number x, number y, number maxWidth)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.strokeText.html)
  3043. *
  3044. * 需要基础库: `1.9.90`
  3045. *
  3046. * 在插件中使用:支持
  3047. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  3048. *
  3049. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  3050. *
  3051. * 给定的 (x, y) 位置绘制文本描边的方法 */
  3052. strokeText(
  3053. /** 要绘制的文本 */
  3054. text: string,
  3055. /** 文本起始点的 x 轴坐标 */
  3056. x: number,
  3057. /** 文本起始点的 y 轴坐标 */
  3058. y: number,
  3059. /** 需要绘制的最大宽度,可选 */
  3060. maxWidth?: number
  3061. ): void
  3062. /** [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)
  3063. *
  3064. * 需要基础库: `1.9.90`
  3065. *
  3066. * 在插件中使用:支持
  3067. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  3068. *
  3069. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  3070. *
  3071. * 使用矩阵多次叠加当前变换的方法 */
  3072. transform(
  3073. /** 水平缩放 */
  3074. scaleX: number,
  3075. /** 水平倾斜 */
  3076. skewX: number,
  3077. /** 垂直倾斜 */
  3078. skewY: number,
  3079. /** 垂直缩放 */
  3080. scaleY: number,
  3081. /** 水平移动 */
  3082. translateX: number,
  3083. /** 垂直移动 */
  3084. translateY: number
  3085. ): void
  3086. /** [CanvasContext.translate(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.translate.html)
  3087. *
  3088. * 在插件中使用:支持
  3089. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  3090. *
  3091. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  3092. *
  3093. * 对当前坐标系的原点 (0, 0) 进行变换。默认的坐标系原点为页面左上角。
  3094. *
  3095. * **示例代码**
  3096. *
  3097. * ```javascript
  3098. const ctx = wx.createCanvasContext('myCanvas')
  3099. ctx.strokeRect(10, 10, 150, 100)
  3100. ctx.translate(20, 20)
  3101. ctx.strokeRect(10, 10, 150, 100)
  3102. ctx.translate(20, 20)
  3103. ctx.strokeRect(10, 10, 150, 100)
  3104. ctx.draw()
  3105. ```
  3106. *
  3107. * ![](@program/dev/image/canvas/translate.png) */
  3108. translate(
  3109. /** 水平坐标平移量 */
  3110. x: number,
  3111. /** 竖直坐标平移量 */
  3112. y: number
  3113. ): void
  3114. /** [Object CanvasContext.measureText(string text)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.measureText.html)
  3115. *
  3116. * 需要基础库: `1.9.90`
  3117. *
  3118. * 在插件中使用:支持
  3119. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  3120. *
  3121. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  3122. *
  3123. * 测量文本尺寸信息。目前仅返回文本宽度。同步接口。 */
  3124. measureText(
  3125. /** 要测量的文本 */
  3126. text: string
  3127. ): TextMetrics
  3128. /** [[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)
  3129. *
  3130. * 在插件中使用:支持
  3131. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  3132. *
  3133. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  3134. *
  3135. * 创建一个圆形的渐变颜色。起点在圆心,终点在圆环。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html) 来指定渐变点,至少要两个。
  3136. *
  3137. * **示例代码**
  3138. *
  3139. * ```javascript
  3140. const ctx = wx.createCanvasContext('myCanvas')
  3141. // Create circular gradient
  3142. const grd = ctx.createCircularGradient(75, 50, 50)
  3143. grd.addColorStop(0, 'red')
  3144. grd.addColorStop(1, 'white')
  3145. // Fill with gradient
  3146. ctx.setFillStyle(grd)
  3147. ctx.fillRect(10, 10, 150, 80)
  3148. ctx.draw()
  3149. ```
  3150. * ![](@program/dev/image/canvas/circular-gradient.png) */
  3151. createCircularGradient(
  3152. /** 圆心的 x 坐标 */
  3153. x: number,
  3154. /** 圆心的 y 坐标 */
  3155. y: number,
  3156. /** 圆的半径 */
  3157. r: number
  3158. ): CanvasGradient
  3159. /** [[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)
  3160. *
  3161. * 在插件中使用:支持
  3162. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  3163. *
  3164. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  3165. *
  3166. * 创建一个线性的渐变颜色。返回的`CanvasGradient`对象需要使用 [CanvasGradient.addColorStop()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html) 来指定渐变点,至少要两个。
  3167. *
  3168. * **示例代码**
  3169. *
  3170. * ```javascript
  3171. const ctx = wx.createCanvasContext('myCanvas')
  3172. // Create linear gradient
  3173. const grd = ctx.createLinearGradient(0, 0, 200, 0)
  3174. grd.addColorStop(0, 'red')
  3175. grd.addColorStop(1, 'white')
  3176. // Fill with gradient
  3177. ctx.setFillStyle(grd)
  3178. ctx.fillRect(10, 10, 150, 80)
  3179. ctx.draw()
  3180. ```
  3181. * ![](@program/dev/image/canvas/linear-gradient.png) */
  3182. createLinearGradient(
  3183. /** 起点的 x 坐标 */
  3184. x0: number,
  3185. /** 起点的 y 坐标 */
  3186. y0: number,
  3187. /** 终点的 x 坐标 */
  3188. x1: number,
  3189. /** 终点的 y 坐标 */
  3190. y1: number
  3191. ): CanvasGradient
  3192. }
  3193. interface CanvasGetImageDataOption {
  3194. /** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件的 `canvas-id` 属性。 */
  3195. canvasId: string
  3196. /** 将要被提取的图像数据矩形区域的高度 */
  3197. height: number
  3198. /** 将要被提取的图像数据矩形区域的宽度 */
  3199. width: number
  3200. /** 将要被提取的图像数据矩形区域的左上角横坐标 */
  3201. x: number
  3202. /** 将要被提取的图像数据矩形区域的左上角纵坐标 */
  3203. y: number
  3204. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3205. complete?: CanvasGetImageDataCompleteCallback
  3206. /** 接口调用失败的回调函数 */
  3207. fail?: CanvasGetImageDataFailCallback
  3208. /** 接口调用成功的回调函数 */
  3209. success?: CanvasGetImageDataSuccessCallback
  3210. }
  3211. interface CanvasGetImageDataSuccessCallbackResult {
  3212. /** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */
  3213. data: Uint8ClampedArray
  3214. /** 图像数据矩形的高度 */
  3215. height: number
  3216. /** 图像数据矩形的宽度 */
  3217. width: number
  3218. errMsg: string
  3219. }
  3220. interface CanvasPutImageDataOption {
  3221. /** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件的 canvas-id 属性。 */
  3222. canvasId: string
  3223. /** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */
  3224. data: Uint8ClampedArray
  3225. /** 源图像数据矩形区域的高度 */
  3226. height: number
  3227. /** 源图像数据矩形区域的宽度 */
  3228. width: number
  3229. /** 源图像数据在目标画布中的位置偏移量(x 轴方向的偏移量) */
  3230. x: number
  3231. /** 源图像数据在目标画布中的位置偏移量(y 轴方向的偏移量) */
  3232. y: number
  3233. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3234. complete?: CanvasPutImageDataCompleteCallback
  3235. /** 接口调用失败的回调函数 */
  3236. fail?: CanvasPutImageDataFailCallback
  3237. /** 接口调用成功的回调函数 */
  3238. success?: CanvasPutImageDataSuccessCallback
  3239. }
  3240. interface CanvasToTempFilePathOption {
  3241. /** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件实例 (canvas type="2d" 时使用该属性)。 */
  3242. canvas?: IAnyObject
  3243. /** 画布标识,传入 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件的 canvas-id */
  3244. canvasId?: string
  3245. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3246. complete?: CanvasToTempFilePathCompleteCallback
  3247. /** 需要基础库: `1.2.0`
  3248. *
  3249. * 输出的图片的高度 */
  3250. destHeight?: number
  3251. /** 需要基础库: `1.2.0`
  3252. *
  3253. * 输出的图片的宽度 */
  3254. destWidth?: number
  3255. /** 接口调用失败的回调函数 */
  3256. fail?: CanvasToTempFilePathFailCallback
  3257. /** 需要基础库: `1.7.0`
  3258. *
  3259. * 目标文件的类型
  3260. *
  3261. * 可选值:
  3262. * - 'jpg': jpg 图片;
  3263. * - 'png': png 图片; */
  3264. fileType?: 'jpg' | 'png'
  3265. /** 需要基础库: `1.2.0`
  3266. *
  3267. * 指定的画布区域的高度 */
  3268. height?: number
  3269. /** 需要基础库: `1.7.0`
  3270. *
  3271. * 图片的质量,目前仅对 jpg 有效。取值范围为 (0, 1],不在范围内时当作 1.0 处理。 */
  3272. quality?: number
  3273. /** 接口调用成功的回调函数 */
  3274. success?: CanvasToTempFilePathSuccessCallback
  3275. /** 需要基础库: `1.2.0`
  3276. *
  3277. * 指定的画布区域的宽度 */
  3278. width?: number
  3279. /** 需要基础库: `1.2.0`
  3280. *
  3281. * 指定的画布区域的左上角横坐标 */
  3282. x?: number
  3283. /** 需要基础库: `1.2.0`
  3284. *
  3285. * 指定的画布区域的左上角纵坐标 */
  3286. y?: number
  3287. }
  3288. interface CanvasToTempFilePathSuccessCallbackResult {
  3289. /** 生成文件的临时路径 (本地路径) */
  3290. tempFilePath: string
  3291. errMsg: string
  3292. }
  3293. /** characteristics列表 */
  3294. interface Characteristic {
  3295. /** characteristic 的 UUID */
  3296. uuid: string
  3297. /** 描述符数据 */
  3298. descriptors?: CharacteristicDescriptor[]
  3299. /** 特征权限 */
  3300. permission?: CharacteristicPermission
  3301. /** 特征支持的操作 */
  3302. properties?: CharacteristicProperties
  3303. /** 特征对应的二进制值 */
  3304. value?: ArrayBuffer
  3305. }
  3306. /** 描述符数据 */
  3307. interface CharacteristicDescriptor {
  3308. /** Descriptor 的 UUID */
  3309. uuid: string
  3310. /** 描述符的权限 */
  3311. permission?: DescriptorPermission
  3312. /** 描述符数据 */
  3313. value?: ArrayBuffer
  3314. }
  3315. /** 特征权限 */
  3316. interface CharacteristicPermission {
  3317. /** 加密读请求 */
  3318. readEncryptionRequired?: boolean
  3319. /** 可读 */
  3320. readable?: boolean
  3321. /** 加密写请求 */
  3322. writeEncryptionRequired?: boolean
  3323. /** 可写 */
  3324. writeable?: boolean
  3325. }
  3326. /** 特征支持的操作 */
  3327. interface CharacteristicProperties {
  3328. /** 回包 */
  3329. indicate?: boolean
  3330. /** 订阅 */
  3331. notify?: boolean
  3332. /** 读 */
  3333. read?: boolean
  3334. /** 写 */
  3335. write?: boolean
  3336. /** 无回复写 */
  3337. writeNoResponse?: boolean
  3338. }
  3339. interface CheckIsAddedToMyMiniProgramOption {
  3340. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3341. complete?: CheckIsAddedToMyMiniProgramCompleteCallback
  3342. /** 接口调用失败的回调函数 */
  3343. fail?: CheckIsAddedToMyMiniProgramFailCallback
  3344. /** 接口调用成功的回调函数 */
  3345. success?: CheckIsAddedToMyMiniProgramSuccessCallback
  3346. }
  3347. interface CheckIsAddedToMyMiniProgramSuccessCallbackResult {
  3348. /** 是否被添加至 「我的小程序」 */
  3349. added: boolean
  3350. errMsg: string
  3351. }
  3352. interface CheckIsOpenAccessibilityOption {
  3353. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3354. complete?: CheckIsOpenAccessibilityCompleteCallback
  3355. /** 接口调用失败的回调函数 */
  3356. fail?: CheckIsOpenAccessibilityFailCallback
  3357. /** 接口调用成功的回调函数 */
  3358. success?: CheckIsOpenAccessibilitySuccessCallback
  3359. }
  3360. interface CheckIsOpenAccessibilitySuccessCallbackOption {
  3361. /** iOS 上开启辅助功能旁白,安卓开启 talkback 时返回 true */
  3362. open: boolean
  3363. errMsg: string
  3364. }
  3365. interface CheckIsSoterEnrolledInDeviceOption {
  3366. /** 认证方式
  3367. *
  3368. * 可选值:
  3369. * - 'fingerPrint': 指纹识别;
  3370. * - 'facial': 人脸识别;
  3371. * - 'speech': 声纹识别(暂未支持); */
  3372. checkAuthMode: 'fingerPrint' | 'facial' | 'speech'
  3373. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3374. complete?: CheckIsSoterEnrolledInDeviceCompleteCallback
  3375. /** 接口调用失败的回调函数 */
  3376. fail?: CheckIsSoterEnrolledInDeviceFailCallback
  3377. /** 接口调用成功的回调函数 */
  3378. success?: CheckIsSoterEnrolledInDeviceSuccessCallback
  3379. }
  3380. interface CheckIsSoterEnrolledInDeviceSuccessCallbackResult {
  3381. /** 错误信息 */
  3382. errMsg: string
  3383. /** 是否已录入信息 */
  3384. isEnrolled: boolean
  3385. }
  3386. interface CheckIsSupportSoterAuthenticationOption {
  3387. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3388. complete?: CheckIsSupportSoterAuthenticationCompleteCallback
  3389. /** 接口调用失败的回调函数 */
  3390. fail?: CheckIsSupportSoterAuthenticationFailCallback
  3391. /** 接口调用成功的回调函数 */
  3392. success?: CheckIsSupportSoterAuthenticationSuccessCallback
  3393. }
  3394. interface CheckIsSupportSoterAuthenticationSuccessCallbackResult {
  3395. /** 该设备支持的可被SOTER识别的生物识别方式
  3396. *
  3397. * 可选值:
  3398. * - 'fingerPrint': 指纹识别;
  3399. * - 'facial': 人脸识别;
  3400. * - 'speech': 声纹识别(暂未支持); */
  3401. supportMode: Array<'fingerPrint' | 'facial' | 'speech'>
  3402. errMsg: string
  3403. }
  3404. interface CheckSessionOption {
  3405. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3406. complete?: CheckSessionCompleteCallback
  3407. /** 接口调用失败的回调函数 */
  3408. fail?: CheckSessionFailCallback
  3409. /** 接口调用成功的回调函数 */
  3410. success?: CheckSessionSuccessCallback
  3411. }
  3412. interface ChooseAddressOption {
  3413. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3414. complete?: ChooseAddressCompleteCallback
  3415. /** 接口调用失败的回调函数 */
  3416. fail?: ChooseAddressFailCallback
  3417. /** 接口调用成功的回调函数 */
  3418. success?: ChooseAddressSuccessCallback
  3419. }
  3420. interface ChooseAddressSuccessCallbackResult {
  3421. /** 国标收货地址第二级地址 */
  3422. cityName: string
  3423. /** 国标收货地址第三级地址 */
  3424. countyName: string
  3425. /** 详细收货地址信息(包括街道地址) */
  3426. detailInfo: string
  3427. /** 新选择器详细收货地址信息 */
  3428. detailInfoNew: string
  3429. /** 错误信息 */
  3430. errMsg: string
  3431. /** 收货地址国家码 */
  3432. nationalCode: string
  3433. /** 邮编 */
  3434. postalCode: string
  3435. /** 国标收货地址第一级地址 */
  3436. provinceName: string
  3437. /** 国标收货地址第四级地址 */
  3438. streetName: string
  3439. /** 收货人手机号码 */
  3440. telNumber: string
  3441. /** 收货人姓名 */
  3442. userName: string
  3443. }
  3444. interface ChooseContactOption {
  3445. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3446. complete?: ChooseContactCompleteCallback
  3447. /** 接口调用失败的回调函数 */
  3448. fail?: ChooseContactFailCallback
  3449. /** 接口调用成功的回调函数 */
  3450. success?: ChooseContactSuccessCallback
  3451. }
  3452. interface ChooseContactSuccessCallbackOption {
  3453. /** 联系人姓名 */
  3454. displayName: string
  3455. /** 手机号 */
  3456. phoneNumber: string
  3457. /** 选定联系人的所有手机号(部分 Android 系统只能选联系人而不能选特定手机号) */
  3458. phoneNumberList: string
  3459. errMsg: string
  3460. }
  3461. /** 返回选择的文件的本地临时文件对象数组 */
  3462. interface ChooseFile {
  3463. /** 选择的文件名称 */
  3464. name: string
  3465. /** 本地临时文件路径 (本地路径) */
  3466. path: string
  3467. /** 本地临时文件大小,单位 B */
  3468. size: number
  3469. /** 选择的文件的会话发送时间,Unix时间戳,工具暂不支持此属性 */
  3470. time: number
  3471. /** 选择的文件类型
  3472. *
  3473. * 可选值:
  3474. * - 'video': 选择了视频文件;
  3475. * - 'image': 选择了图片文件;
  3476. * - 'file': 选择了除图片和视频的文件; */
  3477. type: 'video' | 'image' | 'file'
  3478. }
  3479. interface ChooseImageOption {
  3480. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3481. complete?: ChooseImageCompleteCallback
  3482. /** 最多可以选择的图片张数 */
  3483. count?: number
  3484. /** 接口调用失败的回调函数 */
  3485. fail?: ChooseImageFailCallback
  3486. /** 所选的图片的尺寸
  3487. *
  3488. * 可选值:
  3489. * - 'original': 原图;
  3490. * - 'compressed': 压缩图; */
  3491. sizeType?: Array<'original' | 'compressed'>
  3492. /** 选择图片的来源
  3493. *
  3494. * 可选值:
  3495. * - 'album': 从相册选图;
  3496. * - 'camera': 使用相机; */
  3497. sourceType?: Array<'album' | 'camera'>
  3498. /** 接口调用成功的回调函数 */
  3499. success?: ChooseImageSuccessCallback
  3500. }
  3501. interface ChooseImageSuccessCallbackResult {
  3502. /** 图片的本地临时文件路径列表 (本地路径) */
  3503. tempFilePaths: string[]
  3504. /** 需要基础库: `1.2.0`
  3505. *
  3506. * 图片的本地临时文件列表 */
  3507. tempFiles: ImageFile[]
  3508. errMsg: string
  3509. }
  3510. interface ChooseInvoiceOption {
  3511. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3512. complete?: ChooseInvoiceCompleteCallback
  3513. /** 接口调用失败的回调函数 */
  3514. fail?: ChooseInvoiceFailCallback
  3515. /** 接口调用成功的回调函数 */
  3516. success?: ChooseInvoiceSuccessCallback
  3517. }
  3518. interface ChooseInvoiceSuccessCallbackResult {
  3519. /** 用户选中的发票信息,格式为一个 JSON 字符串,包含三个字段: card_id:所选发票卡券的 cardId,encrypt_code:所选发票卡券的加密 code,报销方可以通过 cardId 和 encryptCode 获得报销发票的信息,app_id: 发票方的 appId。 */
  3520. invoiceInfo: string
  3521. errMsg: string
  3522. }
  3523. interface ChooseInvoiceTitleOption {
  3524. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3525. complete?: ChooseInvoiceTitleCompleteCallback
  3526. /** 接口调用失败的回调函数 */
  3527. fail?: ChooseInvoiceTitleFailCallback
  3528. /** 接口调用成功的回调函数 */
  3529. success?: ChooseInvoiceTitleSuccessCallback
  3530. }
  3531. interface ChooseInvoiceTitleSuccessCallbackResult {
  3532. /** 银行账号 */
  3533. bankAccount: string
  3534. /** 银行名称 */
  3535. bankName: string
  3536. /** 单位地址 */
  3537. companyAddress: string
  3538. /** 错误信息 */
  3539. errMsg: string
  3540. /** 抬头税号 */
  3541. taxNumber: string
  3542. /** 手机号码 */
  3543. telephone: string
  3544. /** 抬头名称 */
  3545. title: string
  3546. /** 抬头类型
  3547. *
  3548. * 可选值:
  3549. * - 0: 单位;
  3550. * - 1: 个人; */
  3551. type: 0 | 1
  3552. }
  3553. interface ChooseLicensePlateOption {
  3554. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3555. complete?: ChooseLicensePlateCompleteCallback
  3556. /** 接口调用失败的回调函数 */
  3557. fail?: ChooseLicensePlateFailCallback
  3558. /** 接口调用成功的回调函数 */
  3559. success?: ChooseLicensePlateSuccessCallback
  3560. }
  3561. interface ChooseLicensePlateSuccessCallbackResult {
  3562. /** 用户选择的车牌号 */
  3563. plateNumber: string
  3564. errMsg: string
  3565. }
  3566. interface ChooseLocationOption {
  3567. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3568. complete?: ChooseLocationCompleteCallback
  3569. /** 接口调用失败的回调函数 */
  3570. fail?: ChooseLocationFailCallback
  3571. /** 需要基础库: `2.9.0`
  3572. *
  3573. * 目标地纬度 */
  3574. latitude?: number
  3575. /** 需要基础库: `2.9.0`
  3576. *
  3577. * 目标地经度 */
  3578. longitude?: number
  3579. /** 接口调用成功的回调函数 */
  3580. success?: ChooseLocationSuccessCallback
  3581. }
  3582. interface ChooseLocationSuccessCallbackResult {
  3583. /** 详细地址 */
  3584. address: string
  3585. /** 纬度,浮点数,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */
  3586. latitude: number
  3587. /** 经度,浮点数,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */
  3588. longitude: number
  3589. /** 位置名称 */
  3590. name: string
  3591. errMsg: string
  3592. }
  3593. interface ChooseMediaOption {
  3594. /** 仅在 sourceType 为 camera 时生效,使用前置或后置摄像头
  3595. *
  3596. * 可选值:
  3597. * - 'back': 使用后置摄像头;
  3598. * - 'front': 使用前置摄像头; */
  3599. camera?: 'back' | 'front'
  3600. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3601. complete?: ChooseMediaCompleteCallback
  3602. /** 最多可以选择的文件个数,基础库2.25.0前,最多可支持9个文件,2.25.0及以后最多可支持20个文件 */
  3603. count?: number
  3604. /** 接口调用失败的回调函数 */
  3605. fail?: ChooseMediaFailCallback
  3606. /** 拍摄视频最长拍摄时间,单位秒。时间范围为 3s 至 60s 之间。不限制相册。 */
  3607. maxDuration?: number
  3608. /** 文件类型
  3609. *
  3610. * 可选值:
  3611. * - 'image': 只能拍摄图片或从相册选择图片;
  3612. * - 'video': 只能拍摄视频或从相册选择视频;
  3613. * - 'mix': 可同时选择图片和视频; */
  3614. mediaType?: Array<'image' | 'video' | 'mix'>
  3615. /** 是否压缩所选文件,基础库2.25.0前仅对 mediaType 为 image 时有效,2.25.0及以后对全量 mediaType 有效 */
  3616. sizeType?: string[]
  3617. /** 图片和视频选择的来源
  3618. *
  3619. * 可选值:
  3620. * - 'album': 从相册选择;
  3621. * - 'camera': 使用相机拍摄; */
  3622. sourceType?: Array<'album' | 'camera'>
  3623. /** 接口调用成功的回调函数 */
  3624. success?: ChooseMediaSuccessCallback
  3625. }
  3626. interface ChooseMediaSuccessCallbackResult {
  3627. /** 本地临时文件列表 */
  3628. tempFiles: MediaFile[]
  3629. /** 文件类型,有效值有 image 、video、mix */
  3630. type: string
  3631. errMsg: string
  3632. }
  3633. interface ChooseMessageFileOption {
  3634. /** 最多可以选择的文件个数,可以 0~100 */
  3635. count: number
  3636. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3637. complete?: ChooseMessageFileCompleteCallback
  3638. /** 需要基础库: `2.6.0`
  3639. *
  3640. * 根据文件拓展名过滤,仅 type==file 时有效。每一项都不能是空字符串。默认不过滤。 */
  3641. extension?: string[]
  3642. /** 接口调用失败的回调函数 */
  3643. fail?: ChooseMessageFileFailCallback
  3644. /** 接口调用成功的回调函数 */
  3645. success?: ChooseMessageFileSuccessCallback
  3646. /** 所选的文件的类型
  3647. *
  3648. * 可选值:
  3649. * - 'all': 从所有文件选择;
  3650. * - 'video': 只能选择视频文件;
  3651. * - 'image': 只能选择图片文件;
  3652. * - 'file': 可以选择除了图片和视频之外的其它的文件; */
  3653. type?: 'all' | 'video' | 'image' | 'file'
  3654. }
  3655. interface ChooseMessageFileSuccessCallbackResult {
  3656. /** 返回选择的文件的本地临时文件对象数组 */
  3657. tempFiles: ChooseFile[]
  3658. errMsg: string
  3659. }
  3660. interface ChoosePoiOption {
  3661. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3662. complete?: ChoosePoiCompleteCallback
  3663. /** 接口调用失败的回调函数 */
  3664. fail?: ChoosePoiFailCallback
  3665. /** 接口调用成功的回调函数 */
  3666. success?: ChoosePoiSuccessCallback
  3667. }
  3668. interface ChoosePoiSuccessCallbackResult {
  3669. /** 详细地址 */
  3670. address: string
  3671. /** 城市名称 */
  3672. city: number
  3673. /** 纬度,浮点数,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系(即将废弃) */
  3674. latitude: number
  3675. /** 经度,浮点数,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系(即将废弃) */
  3676. longitude: number
  3677. /** 位置名称 */
  3678. name: string
  3679. /** 选择城市时,值为 1,选择精确位置时,值为 2 */
  3680. type: number
  3681. errMsg: string
  3682. }
  3683. interface ChooseVideoOption {
  3684. /** 默认拉起的是前置或者后置摄像头。部分 Android 手机下由于系统 ROM 不支持无法生效
  3685. *
  3686. * 可选值:
  3687. * - 'back': 默认拉起后置摄像头;
  3688. * - 'front': 默认拉起前置摄像头; */
  3689. camera?: 'back' | 'front'
  3690. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3691. complete?: ChooseVideoCompleteCallback
  3692. /** 需要基础库: `1.6.0`
  3693. *
  3694. * 是否压缩所选择的视频文件 */
  3695. compressed?: boolean
  3696. /** 接口调用失败的回调函数 */
  3697. fail?: ChooseVideoFailCallback
  3698. /** 拍摄视频最长拍摄时间,单位秒 */
  3699. maxDuration?: number
  3700. /** 视频选择的来源
  3701. *
  3702. * 可选值:
  3703. * - 'album': 从相册选择视频;
  3704. * - 'camera': 使用相机拍摄视频; */
  3705. sourceType?: Array<'album' | 'camera'>
  3706. /** 接口调用成功的回调函数 */
  3707. success?: ChooseVideoSuccessCallback
  3708. }
  3709. interface ChooseVideoSuccessCallbackResult {
  3710. /** 选定视频的时间长度 */
  3711. duration: number
  3712. /** 返回选定视频的高度 */
  3713. height: number
  3714. /** 选定视频的数据量大小 */
  3715. size: number
  3716. /** 选定视频的临时文件路径 (本地路径) */
  3717. tempFilePath: string
  3718. /** 返回选定视频的宽度 */
  3719. width: number
  3720. errMsg: string
  3721. }
  3722. interface ClearFiltersOption {
  3723. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3724. complete?: ClearFiltersCompleteCallback
  3725. /** 接口调用失败的回调函数 */
  3726. fail?: ClearFiltersFailCallback
  3727. /** 接口调用成功的回调函数 */
  3728. success?: ClearFiltersSuccessCallback
  3729. }
  3730. interface ClearMakeupsOption {
  3731. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3732. complete?: ClearMakeupsCompleteCallback
  3733. /** 接口调用失败的回调函数 */
  3734. fail?: ClearMakeupsFailCallback
  3735. /** 接口调用成功的回调函数 */
  3736. success?: ClearMakeupsSuccessCallback
  3737. }
  3738. interface ClearOption {
  3739. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3740. complete?: ClearCompleteCallback
  3741. /** 接口调用失败的回调函数 */
  3742. fail?: ClearFailCallback
  3743. /** 接口调用成功的回调函数 */
  3744. success?: ClearSuccessCallback
  3745. }
  3746. interface ClearStickersOption {
  3747. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3748. complete?: ClearStickersCompleteCallback
  3749. /** 接口调用失败的回调函数 */
  3750. fail?: ClearStickersFailCallback
  3751. /** 接口调用成功的回调函数 */
  3752. success?: ClearStickersSuccessCallback
  3753. }
  3754. interface ClearStorageOption {
  3755. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3756. complete?: ClearStorageCompleteCallback
  3757. /** 接口调用失败的回调函数 */
  3758. fail?: ClearStorageFailCallback
  3759. /** 接口调用成功的回调函数 */
  3760. success?: ClearStorageSuccessCallback
  3761. }
  3762. /** 菜单按钮的布局位置信息 */
  3763. interface ClientRect {
  3764. /** 下边界坐标,单位:px */
  3765. bottom: number
  3766. /** 高度,单位:px */
  3767. height: number
  3768. /** 左边界坐标,单位:px */
  3769. left: number
  3770. /** 右边界坐标,单位:px */
  3771. right: number
  3772. /** 上边界坐标,单位:px */
  3773. top: number
  3774. /** 宽度,单位:px */
  3775. width: number
  3776. }
  3777. interface CloseBLEConnectionOption {
  3778. /** 蓝牙设备 id */
  3779. deviceId: string
  3780. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3781. complete?: CloseBLEConnectionCompleteCallback
  3782. /** 接口调用失败的回调函数 */
  3783. fail?: CloseBLEConnectionFailCallback
  3784. /** 接口调用成功的回调函数 */
  3785. success?: CloseBLEConnectionSuccessCallback
  3786. }
  3787. interface CloseBluetoothAdapterOption {
  3788. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3789. complete?: CloseBluetoothAdapterCompleteCallback
  3790. /** 接口调用失败的回调函数 */
  3791. fail?: CloseBluetoothAdapterFailCallback
  3792. /** 接口调用成功的回调函数 */
  3793. success?: CloseBluetoothAdapterSuccessCallback
  3794. }
  3795. interface CloseSocketOption {
  3796. /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */
  3797. code?: number
  3798. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3799. complete?: CloseSocketCompleteCallback
  3800. /** 接口调用失败的回调函数 */
  3801. fail?: CloseSocketFailCallback
  3802. /** 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于 123 字节的 UTF-8 文本(不是字符)。 */
  3803. reason?: string
  3804. /** 接口调用成功的回调函数 */
  3805. success?: CloseSocketSuccessCallback
  3806. }
  3807. interface CloseSyncOption {
  3808. /** 需要被关闭的文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  3809. fd: string
  3810. }
  3811. /** 颜色。可以用以下几种方式来表示 canvas 中使用的颜色:
  3812. *
  3813. * - RGB 颜色: 如 `'rgb(255, 0, 0)'`
  3814. * - RGBA 颜色:如 `'rgba(255, 0, 0, 0.3)'`
  3815. * - 16 进制颜色: 如 `'#FF0000'`
  3816. * - 预定义的颜色: 如 `'red'`
  3817. *
  3818. * 其中预定义颜色有以下148个:
  3819. * *注意**: Color Name 大小写不敏感
  3820. *
  3821. * | Color Name | HEX |
  3822. * | -------------------- | ------- |
  3823. * | AliceBlue | #F0F8FF |
  3824. * | AntiqueWhite | #FAEBD7 |
  3825. * | Aqua | #00FFFF |
  3826. * | Aquamarine | #7FFFD4 |
  3827. * | Azure | #F0FFFF |
  3828. * | Beige | #F5F5DC |
  3829. * | Bisque | #FFE4C4 |
  3830. * | Black | #000000 |
  3831. * | BlanchedAlmond | #FFEBCD |
  3832. * | Blue | #0000FF |
  3833. * | BlueViolet | #8A2BE2 |
  3834. * | Brown | #A52A2A |
  3835. * | BurlyWood | #DEB887 |
  3836. * | CadetBlue | #5F9EA0 |
  3837. * | Chartreuse | #7FFF00 |
  3838. * | Chocolate | #D2691E |
  3839. * | Coral | #FF7F50 |
  3840. * | CornflowerBlue | #6495ED |
  3841. * | Cornsilk | #FFF8DC |
  3842. * | Crimson | #DC143C |
  3843. * | Cyan | #00FFFF |
  3844. * | DarkBlue | #00008B |
  3845. * | DarkCyan | #008B8B |
  3846. * | DarkGoldenRod | #B8860B |
  3847. * | DarkGray | #A9A9A9 |
  3848. * | DarkGrey | #A9A9A9 |
  3849. * | DarkGreen | #006400 |
  3850. * | DarkKhaki | #BDB76B |
  3851. * | DarkMagenta | #8B008B |
  3852. * | DarkOliveGreen | #556B2F |
  3853. * | DarkOrange | #FF8C00 |
  3854. * | DarkOrchid | #9932CC |
  3855. * | DarkRed | #8B0000 |
  3856. * | DarkSalmon | #E9967A |
  3857. * | DarkSeaGreen | #8FBC8F |
  3858. * | DarkSlateBlue | #483D8B |
  3859. * | DarkSlateGray | #2F4F4F |
  3860. * | DarkSlateGrey | #2F4F4F |
  3861. * | DarkTurquoise | #00CED1 |
  3862. * | DarkViolet | #9400D3 |
  3863. * | DeepPink | #FF1493 |
  3864. * | DeepSkyBlue | #00BFFF |
  3865. * | DimGray | #696969 |
  3866. * | DimGrey | #696969 |
  3867. * | DodgerBlue | #1E90FF |
  3868. * | FireBrick | #B22222 |
  3869. * | FloralWhite | #FFFAF0 |
  3870. * | ForestGreen | #228B22 |
  3871. * | Fuchsia | #FF00FF |
  3872. * | Gainsboro | #DCDCDC |
  3873. * | GhostWhite | #F8F8FF |
  3874. * | Gold | #FFD700 |
  3875. * | GoldenRod | #DAA520 |
  3876. * | Gray | #808080 |
  3877. * | Grey | #808080 |
  3878. * | Green | #008000 |
  3879. * | GreenYellow | #ADFF2F |
  3880. * | HoneyDew | #F0FFF0 |
  3881. * | HotPink | #FF69B4 |
  3882. * | IndianRed | #CD5C5C |
  3883. * | Indigo | #4B0082 |
  3884. * | Ivory | #FFFFF0 |
  3885. * | Khaki | #F0E68C |
  3886. * | Lavender | #E6E6FA |
  3887. * | LavenderBlush | #FFF0F5 |
  3888. * | LawnGreen | #7CFC00 |
  3889. * | LemonChiffon | #FFFACD |
  3890. * | LightBlue | #ADD8E6 |
  3891. * | LightCoral | #F08080 |
  3892. * | LightCyan | #E0FFFF |
  3893. * | LightGoldenRodYellow | #FAFAD2 |
  3894. * | LightGray | #D3D3D3 |
  3895. * | LightGrey | #D3D3D3 |
  3896. * | LightGreen | #90EE90 |
  3897. * | LightPink | #FFB6C1 |
  3898. * | LightSalmon | #FFA07A |
  3899. * | LightSeaGreen | #20B2AA |
  3900. * | LightSkyBlue | #87CEFA |
  3901. * | LightSlateGray | #778899 |
  3902. * | LightSlateGrey | #778899 |
  3903. * | LightSteelBlue | #B0C4DE |
  3904. * | LightYellow | #FFFFE0 |
  3905. * | Lime | #00FF00 |
  3906. * | LimeGreen | #32CD32 |
  3907. * | Linen | #FAF0E6 |
  3908. * | Magenta | #FF00FF |
  3909. * | Maroon | #800000 |
  3910. * | MediumAquaMarine | #66CDAA |
  3911. * | MediumBlue | #0000CD |
  3912. * | MediumOrchid | #BA55D3 |
  3913. * | MediumPurple | #9370DB |
  3914. * | MediumSeaGreen | #3CB371 |
  3915. * | MediumSlateBlue | #7B68EE |
  3916. * | MediumSpringGreen | #00FA9A |
  3917. * | MediumTurquoise | #48D1CC |
  3918. * | MediumVioletRed | #C71585 |
  3919. * | MidnightBlue | #191970 |
  3920. * | MintCream | #F5FFFA |
  3921. * | MistyRose | #FFE4E1 |
  3922. * | Moccasin | #FFE4B5 |
  3923. * | NavajoWhite | #FFDEAD |
  3924. * | Navy | #000080 |
  3925. * | OldLace | #FDF5E6 |
  3926. * | Olive | #808000 |
  3927. * | OliveDrab | #6B8E23 |
  3928. * | Orange | #FFA500 |
  3929. * | OrangeRed | #FF4500 |
  3930. * | Orchid | #DA70D6 |
  3931. * | PaleGoldenRod | #EEE8AA |
  3932. * | PaleGreen | #98FB98 |
  3933. * | PaleTurquoise | #AFEEEE |
  3934. * | PaleVioletRed | #DB7093 |
  3935. * | PapayaWhip | #FFEFD5 |
  3936. * | PeachPuff | #FFDAB9 |
  3937. * | Peru | #CD853F |
  3938. * | Pink | #FFC0CB |
  3939. * | Plum | #DDA0DD |
  3940. * | PowderBlue | #B0E0E6 |
  3941. * | Purple | #800080 |
  3942. * | RebeccaPurple | #663399 |
  3943. * | Red | #FF0000 |
  3944. * | RosyBrown | #BC8F8F |
  3945. * | RoyalBlue | #4169E1 |
  3946. * | SaddleBrown | #8B4513 |
  3947. * | Salmon | #FA8072 |
  3948. * | SandyBrown | #F4A460 |
  3949. * | SeaGreen | #2E8B57 |
  3950. * | SeaShell | #FFF5EE |
  3951. * | Sienna | #A0522D |
  3952. * | Silver | #C0C0C0 |
  3953. * | SkyBlue | #87CEEB |
  3954. * | SlateBlue | #6A5ACD |
  3955. * | SlateGray | #708090 |
  3956. * | SlateGrey | #708090 |
  3957. * | Snow | #FFFAFA |
  3958. * | SpringGreen | #00FF7F |
  3959. * | SteelBlue | #4682B4 |
  3960. * | Tan | #D2B48C |
  3961. * | Teal | #008080 |
  3962. * | Thistle | #D8BFD8 |
  3963. * | Tomato | #FF6347 |
  3964. * | Turquoise | #40E0D0 |
  3965. * | Violet | #EE82EE |
  3966. * | Wheat | #F5DEB3 |
  3967. * | White | #FFFFFF |
  3968. * | WhiteSmoke | #F5F5F5 |
  3969. * | Yellow | #FFFF00 |
  3970. * | YellowGreen | #9ACD32 | */
  3971. interface Color {}
  3972. interface CompressImageOption {
  3973. /** 图片路径,图片的路径,支持本地路径、代码包路径 */
  3974. src: string
  3975. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  3976. complete?: CompressImageCompleteCallback
  3977. /** 需要基础库: `2.26.0`
  3978. *
  3979. * 压缩后图片的高度,单位为px,若不填写则默认以compressedWidth为准等比缩放 */
  3980. compressedHeight?: number
  3981. /** 需要基础库: `2.26.0`
  3982. *
  3983. * 压缩后图片的宽度,单位为px,若不填写则默认以compressedHeight为准等比缩放。 */
  3984. compressedWidth?: number
  3985. /** 接口调用失败的回调函数 */
  3986. fail?: CompressImageFailCallback
  3987. /** 压缩质量,范围0~100,数值越小,质量越低,压缩率越高(仅对jpg有效)。 */
  3988. quality?: number
  3989. /** 接口调用成功的回调函数 */
  3990. success?: CompressImageSuccessCallback
  3991. }
  3992. interface CompressImageSuccessCallbackResult {
  3993. /** 压缩后图片的临时文件路径 (本地路径) */
  3994. tempFilePath: string
  3995. errMsg: string
  3996. }
  3997. interface CompressVideoOption {
  3998. /** 码率,单位 kbps */
  3999. bitrate: number
  4000. /** 帧率 */
  4001. fps: number
  4002. /** 相对于原视频的分辨率比例,取值范围(0, 1] */
  4003. resolution: number
  4004. /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */
  4005. src: string
  4006. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4007. complete?: CompressVideoCompleteCallback
  4008. /** 接口调用失败的回调函数 */
  4009. fail?: CompressVideoFailCallback
  4010. /** 压缩质量
  4011. *
  4012. * 可选值:
  4013. * - 'low': 低;
  4014. * - 'medium': 中;
  4015. * - 'high': 高; */
  4016. quality?: 'low' | 'medium' | 'high'
  4017. /** 接口调用成功的回调函数 */
  4018. success?: CompressVideoSuccessCallback
  4019. }
  4020. interface CompressVideoSuccessCallbackResult {
  4021. /** 压缩后的大小,单位 kB */
  4022. size: string
  4023. /** 压缩后的临时文件地址 */
  4024. tempFilePath: string
  4025. errMsg: string
  4026. }
  4027. interface ConnectSocketOption {
  4028. /** 开发者服务器 wss 接口地址 */
  4029. url: string
  4030. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4031. complete?: ConnectSocketCompleteCallback
  4032. /** 接口调用失败的回调函数 */
  4033. fail?: ConnectSocketFailCallback
  4034. /** 需要基础库: `2.29.0`
  4035. *
  4036. * 强制使用蜂窝网络发送请求 */
  4037. forceCellularNetwork?: boolean
  4038. /** HTTP Header,Header 中不能设置 Referer */
  4039. header?: IAnyObject
  4040. /** 需要基础库: `2.8.0`
  4041. *
  4042. * 是否开启压缩扩展 */
  4043. perMessageDeflate?: boolean
  4044. /** 需要基础库: `1.4.0`
  4045. *
  4046. * 子协议数组 */
  4047. protocols?: string[]
  4048. /** 接口调用成功的回调函数 */
  4049. success?: ConnectSocketSuccessCallback
  4050. /** 需要基础库: `2.4.0`
  4051. *
  4052. * 建立 TCP 连接的时候的 TCP_NODELAY 设置 */
  4053. tcpNoDelay?: boolean
  4054. /** 需要基础库: `2.10.0`
  4055. *
  4056. * 超时时间,单位为毫秒 */
  4057. timeout?: number
  4058. }
  4059. interface ConnectWifiOption {
  4060. /** Wi-Fi 设备 SSID */
  4061. SSID: string
  4062. /** Wi-Fi 设备密码 */
  4063. password: string
  4064. /** Wi-Fi 设备 BSSID */
  4065. BSSID?: string
  4066. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4067. complete?: ConnectWifiCompleteCallback
  4068. /** 接口调用失败的回调函数 */
  4069. fail?: ConnectWifiFailCallback
  4070. /** 需要基础库: `2.12.0`
  4071. *
  4072. * 跳转到系统设置页进行连接 */
  4073. maunal?: boolean
  4074. /** 需要基础库: `2.22.0`
  4075. *
  4076. * 是否需要返回部分 Wi-Fi 信息,仅安卓生效 */
  4077. partialInfo?: boolean
  4078. /** 接口调用成功的回调函数 */
  4079. success?: ConnectWifiSuccessCallback
  4080. }
  4081. /** 一个字典对象,它指定是否应该禁用规范化(默认启用规范化) */
  4082. interface Constraints {
  4083. /** 如果指定为true则禁用标准化,默认为false */
  4084. disableNormalization?: boolean
  4085. }
  4086. interface ContextCallbackResult {
  4087. /** 节点对应的 Context 对象 */
  4088. context: IAnyObject
  4089. }
  4090. interface CopyFileOption {
  4091. /** 目标文件路径,支持本地路径 */
  4092. destPath: string
  4093. /** 源文件路径,支持本地路径 */
  4094. srcPath: string
  4095. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4096. complete?: CopyFileCompleteCallback
  4097. /** 接口调用失败的回调函数 */
  4098. fail?: CopyFileFailCallback
  4099. /** 接口调用成功的回调函数 */
  4100. success?: CopyFileSuccessCallback
  4101. }
  4102. interface CreateBLEConnectionOption {
  4103. /** 蓝牙设备 id */
  4104. deviceId: string
  4105. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4106. complete?: CreateBLEConnectionCompleteCallback
  4107. /** 接口调用失败的回调函数 */
  4108. fail?: CreateBLEConnectionFailCallback
  4109. /** 接口调用成功的回调函数 */
  4110. success?: CreateBLEConnectionSuccessCallback
  4111. /** 超时时间,单位 ms,不填表示不会超时 */
  4112. timeout?: number
  4113. }
  4114. interface CreateBLEPeripheralServerOption {
  4115. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4116. complete?: CreateBLEPeripheralServerCompleteCallback
  4117. /** 接口调用失败的回调函数 */
  4118. fail?: CreateBLEPeripheralServerFailCallback
  4119. /** 接口调用成功的回调函数 */
  4120. success?: CreateBLEPeripheralServerSuccessCallback
  4121. }
  4122. interface CreateBLEPeripheralServerSuccessCallbackResult {
  4123. /** [BLEPeripheralServer](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.html)
  4124. *
  4125. * 外围设备的服务端。 */
  4126. server: BLEPeripheralServer
  4127. errMsg: string
  4128. }
  4129. interface CreateCacheManagerOption {
  4130. /** 额外的缓存处理 */
  4131. extra?: ExtraOption
  4132. /** 全局缓存有效时间,单位为毫秒,默认为 7 天,最长不超过 30 天 */
  4133. maxAge?: number
  4134. /** 缓存模式
  4135. *
  4136. * 可选值:
  4137. * - 'weakNetwork': 弱网/离线使用缓存返回;
  4138. * - 'always': 总是使用缓存返回;
  4139. * - 'none': 不开启,后续可手动开启/停止使用缓存返回; */
  4140. mode?: 'weakNetwork' | 'always' | 'none'
  4141. /** 全局 origin */
  4142. origin?: string
  4143. }
  4144. interface CreateInferenceSessionOption {
  4145. /** 模型文件路径,目前只执行后缀为.onnx格式(支持代码包路径,和本地文件系统路径) */
  4146. model: string
  4147. /** 是否使用NPU推理,仅对IOS有效 */
  4148. allowNPU?: boolean
  4149. /** 是否生成量化模型推理 */
  4150. allowQuantize?: boolean
  4151. /** 推理精度,有效值为 0 - 4。一般来说,使用的precesionLevel等级越低,推理速度越快,但可能会损失精度。推荐开发者在开发时,在效果满足需求时优先使用更低精度以提高推理速度,节约能耗。
  4152. *
  4153. * 可选值:
  4154. * - 0: 使用fp16 存储浮点,fp16计算,Winograd 算法也采取fp16 计算,开启近似math计算;
  4155. * - 1: 使用fp16 存储浮点,fp16计算,禁用 Winograd 算法,开启近似math计算;
  4156. * - 2: 使用fp16 存储浮点,fp32计算,开启 Winograd,开启近似math计算;
  4157. * - 3: 使用fp32 存储浮点,fp32计算,开启 Winograd,开启近似math计算;
  4158. * - 4: 使用fp32 存储浮点,fp32计算,开启 Winograd,关闭近似math计算; */
  4159. precesionLevel?: 0 | 1 | 2 | 3 | 4
  4160. /** 输入典型分辨率 */
  4161. typicalShape?: IAnyObject
  4162. }
  4163. interface CreateInnerAudioContextOption {
  4164. /** 需要基础库: `2.19.0`
  4165. *
  4166. * 是否使用 WebAudio 作为底层音频驱动,默认关闭。对于短音频、播放频繁的音频建议开启此选项,开启后将获得更优的性能表现。由于开启此选项后也会带来一定的内存增长,因此对于长音频建议关闭此选项。 */
  4167. useWebAudioImplement?: boolean
  4168. }
  4169. /** 选项 */
  4170. interface CreateIntersectionObserverOption {
  4171. /** 初始的相交比例,如果调用时检测到的相交比例与这个值不相等且达到阈值,则会触发一次监听器的回调函数。 */
  4172. initialRatio?: number
  4173. /** 需要基础库: `2.0.0`
  4174. *
  4175. * 是否同时观测多个目标节点(而非一个),如果设为 true ,observe 的 targetSelector 将选中多个节点(注意:同时选中过多节点将影响渲染性能) */
  4176. observeAll?: boolean
  4177. /** 一个数值数组,包含所有阈值。 */
  4178. thresholds?: number[]
  4179. }
  4180. interface CreateInterstitialAdOption {
  4181. /** 广告单元 id */
  4182. adUnitId: string
  4183. }
  4184. interface CreateMediaRecorderOption {
  4185. /** 指定录制的时长(s),到达自动停止。最大 7200,最小 5 */
  4186. duration?: number
  4187. /** 视频 fps */
  4188. fps?: number
  4189. /** 视频关键帧间隔 */
  4190. gop?: number
  4191. /** 画布录制高度 */
  4192. height?: number
  4193. /** 视频比特率(kbps),最小值 600,最大值 3000 */
  4194. videoBitsPerSecond?: number
  4195. /** 画布录制宽度 */
  4196. width?: number
  4197. }
  4198. interface CreateOffscreenCanvasOption {
  4199. /** 在自定义组件下,当前组件实例的 this */
  4200. compInst?: Component.TrivialInstance | Page.TrivialInstance
  4201. /** 画布高度 */
  4202. height?: number
  4203. /** 创建的离屏 canvas 类型
  4204. *
  4205. * 可选值:
  4206. * - 'webgl': webgl类型上下文;
  4207. * - '2d': 2d类型上下文; */
  4208. type?: 'webgl' | '2d'
  4209. /** 画布宽度 */
  4210. width?: number
  4211. }
  4212. interface CreateRewardedVideoAdOption {
  4213. /** 广告单元 id */
  4214. adUnitId: string
  4215. /** 需要基础库: `2.8.0`
  4216. *
  4217. * 是否启用多例模式,默认为false */
  4218. multiton?: boolean
  4219. }
  4220. /** 可选参数 */
  4221. interface CreateWorkerOption {
  4222. /** 需要基础库: `2.13.0`
  4223. *
  4224. * 是否使用实验worker。在iOS下,实验worker的JS运行效率比非实验worker提升数倍,如需在worker内进行重度计算的建议开启此选项。同时,实验worker存在极小概率会在系统资源紧张时被系统回收,因此建议配合 worker.onProcessKilled 事件使用,在worker被回收后可重新创建一个。 */
  4225. useExperimentalWorker?: boolean
  4226. }
  4227. interface CropImageOption {
  4228. /** 裁剪比例
  4229. *
  4230. * 可选值:
  4231. * - '16:9': 宽高比为16比9;
  4232. * - '9:16': 宽高比为9比16;
  4233. * - '4:3': 宽高比为4比3;
  4234. * - '3:4': 宽高比为3比4;
  4235. * - '5:4': 宽高比为5比4;
  4236. * - '4:5': 宽高比为4比5;
  4237. * - '1:1': 宽高比为1比1; */
  4238. cropScale: '16:9' | '9:16' | '4:3' | '3:4' | '5:4' | '4:5' | '1:1'
  4239. /** 图片路径,图片的路径,支持本地路径、代码包路径 */
  4240. src: string
  4241. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4242. complete?: CropImageCompleteCallback
  4243. /** 接口调用失败的回调函数 */
  4244. fail?: CropImageFailCallback
  4245. /** 接口调用成功的回调函数 */
  4246. success?: CropImageSuccessCallback
  4247. }
  4248. interface CropImageSuccessCallbackResult {
  4249. /** 编辑后图片的临时文件路径 (本地路径) */
  4250. tempFilePath: string
  4251. errMsg: string
  4252. }
  4253. interface CurrentState {
  4254. /** 当前缓存中的日志条数 */
  4255. logCount: number
  4256. /** 当前缓存中最大可存日志条数 */
  4257. maxLogCount: number
  4258. /** 当前缓存最大可用空间,以字节为单位 */
  4259. maxSize: number
  4260. /** 当前缓存中已使用空间,以字节为单位 */
  4261. size: number
  4262. }
  4263. /** 自定义路由动画配置 */
  4264. interface CustomRouteConfig {
  4265. /** 遮罩层背景色,支持 `rgba()` 和 `#RRGGBBAA` 写法 */
  4266. barrierColor: string
  4267. /** 点击遮罩层返回上一页 */
  4268. barrierDismissible: boolean
  4269. /** 无障碍语义 */
  4270. barrierLabel: string
  4271. /** 是否与前一个页面联动,决定前一个页 `secondaryAnimation` 是否生效 */
  4272. canTransitionFrom: boolean
  4273. /** 是否与下一个页面联动,决定当前页 `secondaryAnimation` 是否生效 */
  4274. canTransitionTo: boolean
  4275. /** 是否保持前一个页面状态 */
  4276. maintainState: boolean
  4277. /** 下一个页面推入后,不显示前一个页面 */
  4278. opaque: boolean
  4279. /** 页面推出动画时长,单位 ms */
  4280. reverseTransitionDuration: number
  4281. /** 页面推入动画时长,单位 ms */
  4282. transitionDuration: number
  4283. }
  4284. /** 自定义路由上下文对象 */
  4285. interface CustomRouteContext {
  4286. /** 返回上一级,效果同 `wx.navigateBack`,仅可用于 `worklet` 函数内 */
  4287. didPop: (...args: any[]) => any
  4288. /** 动画控制器,影响推入页面的进入和退出过渡效果 */
  4289. primaryAnimation: SharedValue<number>
  4290. /** 动画控制器状态 */
  4291. primaryAnimationStatus: SharedValue<number>
  4292. /** 动画控制器,影响栈顶页面的推出过渡效果 */
  4293. secondaryAnimation: SharedValue<number>
  4294. /** 动画控制器状态 */
  4295. secondaryAnimationStatus: SharedValue<number>
  4296. /** 手势开始控制路由,与共享元素动画有关 */
  4297. startUserGesture: (...args: any[]) => any
  4298. /** 手势不再控制路由,与 `startUserGesture` 成对调用 */
  4299. stopUserGesture: (...args: any[]) => any
  4300. /** 当前路由进度由手势控制 */
  4301. userGestureInProgress: SharedValue<number>
  4302. }
  4303. /** 弹幕内容 */
  4304. interface Danmu {
  4305. /** 弹幕文字 */
  4306. text: string
  4307. /** 弹幕颜色 */
  4308. color?: string
  4309. }
  4310. /** 动画配置 */
  4311. interface DecayOption {
  4312. /** 边界值,长度为 2 的数组 */
  4313. clamp?: any[]
  4314. /** 衰减速率 */
  4315. deceleration?: number
  4316. /** 初速度 */
  4317. velocity?: number
  4318. }
  4319. /** 需要基础库: `3.0.0`
  4320. *
  4321. * 深度识别配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/depth.html)。 */
  4322. interface DepthTrack {
  4323. /** 需要基础库: `3.0.0`
  4324. *
  4325. * 深度识别模式
  4326. *
  4327. * 可选值:
  4328. * - 1: 通过摄像头实时检测;
  4329. * - 2: 静态图片检测; */
  4330. mode: 1 | 2
  4331. }
  4332. /** 可选的字体描述符 */
  4333. interface DescOption {
  4334. /** 字体样式,可选值为 normal / italic / oblique */
  4335. style?: string
  4336. /** 设置小型大写字母的字体显示文本,可选值为 normal / small-caps / inherit */
  4337. variant?: string
  4338. /** 字体粗细,可选值为 normal / bold / 100 / 200../ 900 */
  4339. weight?: string
  4340. }
  4341. /** 描述符的权限 */
  4342. interface DescriptorPermission {
  4343. /** 读 */
  4344. read?: boolean
  4345. /** 写 */
  4346. write?: boolean
  4347. }
  4348. /** 指定 marker 移动到的目标点 */
  4349. interface DestinationOption {
  4350. /** 纬度 */
  4351. latitude: number
  4352. /** 经度 */
  4353. longitude: number
  4354. }
  4355. interface DetectBodyOption {
  4356. /** 人脸图像像素点数据,每四项表示一个像素点的 RGBA */
  4357. frameBuffer: ArrayBuffer
  4358. /** 图像高度 */
  4359. height: number
  4360. /** 图像宽度 */
  4361. width: number
  4362. /** 评分阈值。正常情况传入 0.8 即可。 */
  4363. scoreThreshold?: number
  4364. /** 图像源类型。正常情况传入 1 即可。当输入的图片是来自一个连续视频的每一帧图像时,sourceType 传入 0 会得到更优的效果
  4365. *
  4366. * 可选值:
  4367. * - 1: 表示输入的图片是随机的图片;
  4368. * - 0: 表示输入的图片是来自一个连续视频的每一帧图像; */
  4369. sourceType?: 1 | 0
  4370. }
  4371. interface DetectDepthOption {
  4372. /** 需要识别深度的图像像素点数据,每四项表示一个像素点的 RGBA */
  4373. frameBuffer: ArrayBuffer
  4374. /** 图像高度 */
  4375. height: number
  4376. /** 图像宽度 */
  4377. width: number
  4378. }
  4379. interface DetectFaceOption {
  4380. /** 人脸图像像素点数据,每四项表示一个像素点的 RGBA */
  4381. frameBuffer: ArrayBuffer
  4382. /** 图像高度 */
  4383. height: number
  4384. /** 图像宽度 */
  4385. width: number
  4386. /** 算法模型类型。正常情况传入 1 即可。0、1、2 分别表示小、中、大模型,模型越大识别准确率越高,但资源占用也越高。建议根据用户设备性能进行选择。
  4387. *
  4388. * 可选值:
  4389. * - 0: 小模型;
  4390. * - 1: 中模型;
  4391. * - 2: 大模型; */
  4392. modelModel?: 0 | 1 | 2
  4393. /** 评分阈值。正常情况传入 0.8 即可。 */
  4394. scoreThreshold?: number
  4395. /** 图像源类型。正常情况传入 1 即可。当输入的图片是来自一个连续视频的每一帧图像时,sourceType 传入 0 会得到更优的效果
  4396. *
  4397. * 可选值:
  4398. * - 1: 表示输入的图片是随机的图片;
  4399. * - 0: 表示输入的图片是来自一个连续视频的每一帧图像; */
  4400. sourceType?: 1 | 0
  4401. }
  4402. interface DetectHandOption {
  4403. /** 人脸图像像素点数据,每四项表示一个像素点的 RGBA */
  4404. frameBuffer: ArrayBuffer
  4405. /** 图像高度 */
  4406. height: number
  4407. /** 图像宽度 */
  4408. width: number
  4409. /** 算法检测模式
  4410. *
  4411. * 可选值:
  4412. * - 0: 检测模式,输出框和点;
  4413. * - 1: 手势模式,输出框和手势分类;
  4414. * - 2: 结合0和1模式,输出框、点、手势分类; */
  4415. algoMode?: 0 | 1 | 2
  4416. /** 评分阈值。正常情况传入 0.8 即可。 */
  4417. scoreThreshold?: number
  4418. }
  4419. interface DeviceInfo {
  4420. /** 应用(微信APP)二进制接口类型(仅 Android 支持) */
  4421. abi: string
  4422. /** 设备性能等级(仅 Android 支持)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) */
  4423. benchmarkLevel: number
  4424. /** 设备品牌 */
  4425. brand: string
  4426. /** 需要基础库: `2.29.0`
  4427. *
  4428. * 设备 CPU 型号(仅 Android 支持)(Tips: GPU 型号可通过 WebGLRenderingContext.getExtension('WEBGL_debug_renderer_info') 来获取) */
  4429. cpuType: string
  4430. /** 需要基础库: `2.25.1`
  4431. *
  4432. * 设备二进制接口类型(仅 Android 支持) */
  4433. deviceAbi: string
  4434. /** 需要基础库: `2.30.0`
  4435. *
  4436. * 设备内存大小,单位为 MB */
  4437. memorySize: string
  4438. /** 设备型号。新机型刚推出一段时间会显示unknown,微信会尽快进行适配。 */
  4439. model: string
  4440. /** 客户端平台 */
  4441. platform: string
  4442. /** 操作系统及版本 */
  4443. system: string
  4444. }
  4445. interface DeviceVoIPInfo {
  4446. /** 需要基础库: `2.30.4`
  4447. *
  4448. * 设备组的唯一标识 id(仅设备组时) */
  4449. group_id: string
  4450. /** 设备型号 id。通过微信公众平台注册设备获得。(仅单台设备时) */
  4451. model_id: string
  4452. /** 设备唯一序列号。(仅单台设备时) */
  4453. sn: string
  4454. /** 设备(组)授权状态。0:未授权;1:已授权 */
  4455. status: number
  4456. }
  4457. interface DisableAlertBeforeUnloadOption {
  4458. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4459. complete?: DisableAlertBeforeUnloadCompleteCallback
  4460. /** 接口调用失败的回调函数 */
  4461. fail?: DisableAlertBeforeUnloadFailCallback
  4462. /** 接口调用成功的回调函数 */
  4463. success?: DisableAlertBeforeUnloadSuccessCallback
  4464. }
  4465. interface DownloadFileOption {
  4466. /** 下载资源的 url */
  4467. url: string
  4468. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4469. complete?: DownloadFileCompleteCallback
  4470. /** 接口调用失败的回调函数 */
  4471. fail?: DownloadFileFailCallback
  4472. /** 需要基础库: `1.8.0`
  4473. *
  4474. * 指定文件下载后存储的路径 (本地路径) */
  4475. filePath?: string
  4476. /** HTTP 请求的 Header,Header 中不能设置 Referer */
  4477. header?: IAnyObject
  4478. /** 接口调用成功的回调函数 */
  4479. success?: DownloadFileSuccessCallback
  4480. /** 需要基础库: `2.10.0`
  4481. *
  4482. * 超时时间,单位为毫秒,默认值为 60000 即一分钟。 */
  4483. timeout?: number
  4484. }
  4485. interface DownloadFileSuccessCallbackResult {
  4486. /** 用户文件路径 (本地路径)。传入 filePath 时会返回,跟传入的 filePath 一致 */
  4487. filePath: string
  4488. /** 需要基础库: `2.10.4`
  4489. *
  4490. * 网络请求过程中一些调试信息,[查看详细说明](https://developers.weixin.qq.com/miniprogram/dev/framework/performance/network.html) */
  4491. profile: RequestProfile
  4492. /** 开发者服务器返回的 HTTP 状态码 */
  4493. statusCode: number
  4494. /** 临时文件路径 (本地路径)。没传入 filePath 指定文件存储路径时会返回,下载后的文件会存储到一个临时文件 */
  4495. tempFilePath: string
  4496. errMsg: string
  4497. }
  4498. interface DownloadTaskOnHeadersReceivedListenerResult {
  4499. /** 开发者服务器返回的 HTTP Response Header */
  4500. header: IAnyObject
  4501. }
  4502. interface DownloadTaskOnProgressUpdateListenerResult {
  4503. /** 下载进度百分比 */
  4504. progress: number
  4505. /** 预期需要下载的数据总长度,单位 Bytes */
  4506. totalBytesExpectedToWrite: number
  4507. /** 已经下载的数据长度,单位 Bytes */
  4508. totalBytesWritten: number
  4509. }
  4510. interface DraggableSheetContextScrollToOption {
  4511. /** 是否启用滚动动画 */
  4512. animated?: boolean
  4513. /** 滚动动画时长(ms) */
  4514. duration?: number
  4515. /** 缓动函数 */
  4516. easingFunction?: string
  4517. /** 绝对目标位置 */
  4518. pixels?: number
  4519. /** 相对目标位置 */
  4520. size?: number
  4521. }
  4522. interface EditImageOption {
  4523. /** 图片路径,图片的路径,支持本地路径、代码包路径 */
  4524. src: string
  4525. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4526. complete?: EditImageCompleteCallback
  4527. /** 接口调用失败的回调函数 */
  4528. fail?: EditImageFailCallback
  4529. /** 接口调用成功的回调函数 */
  4530. success?: EditImageSuccessCallback
  4531. }
  4532. interface EnableAlertBeforeUnloadOption {
  4533. /** 询问对话框内容 */
  4534. message: string
  4535. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4536. complete?: EnableAlertBeforeUnloadCompleteCallback
  4537. /** 接口调用失败的回调函数 */
  4538. fail?: EnableAlertBeforeUnloadFailCallback
  4539. /** 接口调用成功的回调函数 */
  4540. success?: EnableAlertBeforeUnloadSuccessCallback
  4541. }
  4542. /** 文件读取结果。res.entries 是一个对象,key是文件路径,value是一个对象 FileItem ,表示该文件的读取结果。每个 FileItem 包含 data (文件内容) 和 errMsg (错误信息) 属性。 */
  4543. interface EntriesResult {
  4544. /** 文件路径 */
  4545. [path: string]: ZipFileItem
  4546. }
  4547. /** 要读取的压缩包内的文件列表(当传入"all" 时表示读取压缩包内所有文件) */
  4548. interface EntryItem {
  4549. /** 压缩包内文件路径 */
  4550. path: string
  4551. /** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
  4552. *
  4553. * 可选值:
  4554. * - 'ascii': ;
  4555. * - 'base64': ;
  4556. * - 'binary': ;
  4557. * - 'hex': ;
  4558. * - 'ucs2': 以小端序读取;
  4559. * - 'ucs-2': 以小端序读取;
  4560. * - 'utf16le': 以小端序读取;
  4561. * - 'utf-16le': 以小端序读取;
  4562. * - 'utf-8': ;
  4563. * - 'utf8': ;
  4564. * - 'latin1': ; */
  4565. encoding?:
  4566. | 'ascii'
  4567. | 'base64'
  4568. | 'binary'
  4569. | 'hex'
  4570. | 'ucs2'
  4571. | 'ucs-2'
  4572. | 'utf16le'
  4573. | 'utf-16le'
  4574. | 'utf-8'
  4575. | 'utf8'
  4576. | 'latin1'
  4577. /** 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */
  4578. length?: number
  4579. /** 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */
  4580. position?: number
  4581. }
  4582. /** 要擦除的线段数组。详见 [polyline 属性](https://developers.weixin.qq.com/miniprogram/dev/component/map.html#polyline)。 */
  4583. interface EraseLineOptions {
  4584. /** 线段的 id。 */
  4585. id: number
  4586. /** 指定线段的某一段,线段起点 index 为 0 */
  4587. index: number
  4588. /** 指定线段某一段中的点 */
  4589. point: MapPostion
  4590. /** 为 true 时擦除,false 时置灰 */
  4591. clear?: boolean
  4592. }
  4593. interface EraseLinesOption {
  4594. /** 要擦除的线段数组。详见 [polyline 属性](https://developers.weixin.qq.com/miniprogram/dev/component/map.html#polyline)。 */
  4595. lines: EraseLineOptions[]
  4596. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4597. complete?: EraseLinesCompleteCallback
  4598. /** 接口调用失败的回调函数 */
  4599. fail?: EraseLinesFailCallback
  4600. /** 接口调用成功的回调函数 */
  4601. success?: EraseLinesSuccessCallback
  4602. }
  4603. /** 错误 */
  4604. interface Error {
  4605. /** 错误 */
  4606. message: string
  4607. /** 错误调用堆栈 */
  4608. stack: string
  4609. }
  4610. /** 本次请求底层失败信息,所有失败信息均符合Errno错误码 */
  4611. interface ExceptionReason {
  4612. /** 错误原因 */
  4613. errMsg: string
  4614. /** 错误码 */
  4615. errno: string
  4616. }
  4617. interface ExecuteVisualLayerCommandOption {
  4618. /** 图层指令 */
  4619. command: string
  4620. /** 可视化图层id */
  4621. layerId: string
  4622. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4623. complete?: ExecuteVisualLayerCommandCompleteCallback
  4624. /** 接口调用失败的回调函数 */
  4625. fail?: ExecuteVisualLayerCommandFailCallback
  4626. /** 接口调用成功的回调函数 */
  4627. success?: ExecuteVisualLayerCommandSuccessCallback
  4628. }
  4629. interface ExecuteVisualLayerCommandSuccessCallbackResult {
  4630. /** SDK 返回的 JSON 数据 */
  4631. data: string
  4632. /** 调用结果 */
  4633. errMsg: string
  4634. }
  4635. interface ExitCastingOption {
  4636. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4637. complete?: ExitCastingCompleteCallback
  4638. /** 接口调用失败的回调函数 */
  4639. fail?: ExitCastingFailCallback
  4640. /** 接口调用成功的回调函数 */
  4641. success?: ExitCastingSuccessCallback
  4642. }
  4643. interface ExitFullScreenOption {
  4644. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4645. complete?: ExitFullScreenCompleteCallback
  4646. /** 接口调用失败的回调函数 */
  4647. fail?: ExitFullScreenFailCallback
  4648. /** 接口调用成功的回调函数 */
  4649. success?: ExitFullScreenSuccessCallback
  4650. }
  4651. interface ExitMiniProgramOption {
  4652. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4653. complete?: ExitMiniProgramCompleteCallback
  4654. /** 接口调用失败的回调函数 */
  4655. fail?: ExitMiniProgramFailCallback
  4656. /** 接口调用成功的回调函数 */
  4657. success?: ExitMiniProgramSuccessCallback
  4658. }
  4659. interface ExitPictureInPictureOption {
  4660. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4661. complete?: ExitPictureInPictureCompleteCallback
  4662. /** 接口调用失败的回调函数 */
  4663. fail?: ExitPictureInPictureFailCallback
  4664. /** 接口调用成功的回调函数 */
  4665. success?: ExitPictureInPictureSuccessCallback
  4666. }
  4667. interface ExitVoIPChatOption {
  4668. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4669. complete?: ExitVoIPChatCompleteCallback
  4670. /** 接口调用失败的回调函数 */
  4671. fail?: ExitVoIPChatFailCallback
  4672. /** 接口调用成功的回调函数 */
  4673. success?: ExitVoIPChatSuccessCallback
  4674. }
  4675. /** 客服信息 */
  4676. interface ExtInfoOption {
  4677. /** 客服链接 */
  4678. url: string
  4679. }
  4680. /** 额外的缓存处理 */
  4681. interface ExtraOption {
  4682. /** 需要缓存的 wx api 接口,不传则表示支持缓存的接口全都做缓存处理。返回的如果是缓存数据,开发者可通过 fromCache 标记区分
  4683. *
  4684. * 可选值:
  4685. * - 'wx.login': ;
  4686. * - 'wx.checkSession': ;
  4687. * - 'wx.getSetting': ; */
  4688. apiList?: Array<'wx.login' | 'wx.checkSession' | 'wx.getSetting'>
  4689. }
  4690. interface ExtractDataSourceOption {
  4691. /** 视频源地址,只支持本地文件 */
  4692. source: string
  4693. }
  4694. /** 人脸角度信息,取值范围 [-1, 1],数值越接近 0 表示越正对摄像头 */
  4695. interface FaceAngel {
  4696. /** 仰俯角(点头) */
  4697. pitch: number
  4698. /** 翻滚角(左右倾) */
  4699. roll: number
  4700. /** 偏航角(摇头) */
  4701. yaw: number
  4702. }
  4703. /** 人脸置信度,取值范围 [0, 1],数值越大置信度越高(遮挡越少) */
  4704. interface FaceConf {
  4705. /** 整体可信度 */
  4706. global: number
  4707. /** 左眼可信度 */
  4708. leftEye: number
  4709. /** 嘴巴可信度 */
  4710. mouth: number
  4711. /** 鼻子可信度 */
  4712. nose: number
  4713. /** 右眼可信度 */
  4714. rightEye: number
  4715. }
  4716. interface FaceDetectOption {
  4717. /** 图像像素点数据,每四项表示一个像素点的 RGBA */
  4718. frameBuffer: ArrayBuffer
  4719. /** 图像高度 */
  4720. height: number
  4721. /** 图像宽度 */
  4722. width: number
  4723. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4724. complete?: FaceDetectCompleteCallback
  4725. /** 是否返回当前图像的人脸角度信息 */
  4726. enableAngle?: boolean
  4727. /** 是否返回当前图像的人脸的置信度(可表示器官遮挡情况) */
  4728. enableConf?: boolean
  4729. /** 是否返回多张人脸的信息 */
  4730. enableMultiFace?: boolean
  4731. /** 是否返回当前图像的人脸(106 个点) */
  4732. enablePoint?: boolean
  4733. /** 接口调用失败的回调函数 */
  4734. fail?: FaceDetectFailCallback
  4735. /** 接口调用成功的回调函数 */
  4736. success?: FaceDetectSuccessCallback
  4737. }
  4738. interface FaceDetectSuccessCallbackResult {
  4739. /** 人脸角度信息,取值范围 [-1, 1],数值越接近 0 表示越正对摄像头 */
  4740. angleArray: FaceAngel
  4741. /** 人脸置信度,取值范围 [0, 1],数值越大置信度越高(遮挡越少) */
  4742. confArray: FaceConf
  4743. /** 脸部方框数值,对象包含 height, width, originX, originY 四个属性 (origin 为方框左上角坐标) */
  4744. detectRect: IAnyObject
  4745. /** 多人模式(enableMultiFace)下的人脸信息,每个对象包含上述其它属性 */
  4746. faceInfo: IAnyObject[]
  4747. /** 标记人脸轮廓的 106 个点位置数组,数组每个对象包含 x 和 y */
  4748. pointArray: IAnyObject[]
  4749. /** 脸部中心点横坐标,检测不到人脸则为 -1 */
  4750. x: number
  4751. /** 脸部中心点纵坐标,检测不到人脸则为 -1 */
  4752. y: number
  4753. errMsg: string
  4754. }
  4755. /** 需要基础库: `2.25.0`
  4756. *
  4757. * 人脸检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/face.html)。安卓微信8.0.25开始支持,iOS微信8.0.24开始支持。 */
  4758. interface FaceTrack {
  4759. /** 需要基础库: `2.25.0`
  4760. *
  4761. * 人脸检测模式
  4762. *
  4763. * 可选值:
  4764. * - 1: 通过摄像头实时检测;
  4765. * - 2: 静态图片检测; */
  4766. mode: 1 | 2
  4767. }
  4768. interface Fields {
  4769. /** 需要基础库: `2.1.0`
  4770. *
  4771. * 指定样式名列表,返回节点对应样式名的当前值 */
  4772. computedStyle?: string[]
  4773. /** 需要基础库: `2.4.2`
  4774. *
  4775. * 是否返回节点对应的 Context 对象 */
  4776. context?: boolean
  4777. /** 是否返回节点 dataset */
  4778. dataset?: boolean
  4779. /** 是否返回节点 id */
  4780. id?: boolean
  4781. /** 是否返回节点 mark */
  4782. mark?: boolean
  4783. /** 需要基础库: `2.7.0`
  4784. *
  4785. * 是否返回节点对应的 Node 实例 */
  4786. node?: boolean
  4787. /** 指定属性名列表,返回节点对应属性名的当前属性值(只能获得组件文档中标注的常规属性值,id class style 和事件绑定的属性值不可获取) */
  4788. properties?: string[]
  4789. /** 是否返回节点布局位置(`left` `right` `top` `bottom`) */
  4790. rect?: boolean
  4791. /** 否 是否返回节点的 `scrollLeft` `scrollTop`,节点必须是 `scroll-view` 或者 `viewport` */
  4792. scrollOffset?: boolean
  4793. /** 是否返回节点尺寸(`width` `height`) */
  4794. size?: boolean
  4795. }
  4796. /** 文件数组 */
  4797. interface FileItem {
  4798. /** 文件保存时的时间戳,从1970/01/01 08:00:00 到当前时间的秒数 */
  4799. createTime: number
  4800. /** 文件路径 (本地路径) */
  4801. filePath: string
  4802. /** 本地文件大小,以字节为单位 */
  4803. size: number
  4804. }
  4805. /** 每个 FileStats 对象包含 path 和 Stats */
  4806. interface FileStats {
  4807. /** 文件/目录路径 */
  4808. path: string
  4809. /** [Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)
  4810. *
  4811. * Stats 对象,即描述文件状态的对象 */
  4812. stats: Stats
  4813. }
  4814. interface FileSystemManagerCloseOption {
  4815. /** 需要被关闭的文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  4816. fd: string
  4817. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4818. complete?: FileSystemManagerCloseCompleteCallback
  4819. /** 接口调用失败的回调函数 */
  4820. fail?: FileSystemManagerCloseFailCallback
  4821. /** 接口调用成功的回调函数 */
  4822. success?: FileSystemManagerCloseSuccessCallback
  4823. }
  4824. /** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */
  4825. interface ForwardMaterials {
  4826. /** 文件名 */
  4827. name: string
  4828. /** 文件路径(如果是webview则是url) */
  4829. path: string
  4830. /** 文件大小 */
  4831. size: number
  4832. /** 文件的mimetype类型 */
  4833. type: string
  4834. }
  4835. /** 视频帧数据,若取不到则返回 null。当缓冲区为空的时候可能暂停取不到数据。 */
  4836. interface FrameDataOptions {
  4837. /** 帧数据 */
  4838. data: ArrayBuffer
  4839. /** 帧数据高度 */
  4840. height: number
  4841. /** 帧原始 dts */
  4842. pkDts: number
  4843. /** 帧原始 pts */
  4844. pkPts: number
  4845. /** 帧数据宽度 */
  4846. width: number
  4847. }
  4848. interface FromScreenLocationOption {
  4849. /** x 坐标值 */
  4850. x: number
  4851. /** y 坐标值 */
  4852. y: number
  4853. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4854. complete?: FromScreenLocationCompleteCallback
  4855. /** 接口调用失败的回调函数 */
  4856. fail?: FromScreenLocationFailCallback
  4857. /** 接口调用成功的回调函数 */
  4858. success?: FromScreenLocationSuccessCallback
  4859. }
  4860. interface FstatOption {
  4861. /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  4862. fd: string
  4863. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4864. complete?: FstatCompleteCallback
  4865. /** 接口调用失败的回调函数 */
  4866. fail?: FstatFailCallback
  4867. /** 接口调用成功的回调函数 */
  4868. success?: FstatSuccessCallback
  4869. }
  4870. interface FstatSuccessCallbackResult {
  4871. /** [Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)
  4872. *
  4873. * Stats 对象,包含了文件的状态信息 */
  4874. stats: Stats
  4875. errMsg: string
  4876. }
  4877. interface FstatSyncOption {
  4878. /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  4879. fd: string
  4880. }
  4881. interface FtruncateOption {
  4882. /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  4883. fd: string
  4884. /** 截断位置,默认0。如果 length 小于文件长度(单位:字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,则会对其进行扩展,并且扩展部分将填充空字节('\0') */
  4885. length: number
  4886. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4887. complete?: FtruncateCompleteCallback
  4888. /** 接口调用失败的回调函数 */
  4889. fail?: FtruncateFailCallback
  4890. /** 接口调用成功的回调函数 */
  4891. success?: FtruncateSuccessCallback
  4892. }
  4893. interface FtruncateSyncOption {
  4894. /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  4895. fd: string
  4896. /** 截断位置,默认0。如果 length 小于文件长度(单位:字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,则会对其进行扩展,并且扩展部分将填充空字节('\0') */
  4897. length: number
  4898. }
  4899. interface GeneralCallbackResult {
  4900. /** 错误信息 */
  4901. errMsg: string
  4902. }
  4903. interface GetAtqaOption {
  4904. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4905. complete?: GetAtqaCompleteCallback
  4906. /** 接口调用失败的回调函数 */
  4907. fail?: GetAtqaFailCallback
  4908. /** 接口调用成功的回调函数 */
  4909. success?: GetAtqaSuccessCallback
  4910. }
  4911. interface GetAtqaSuccessCallbackResult {
  4912. /** 返回 ATQA/SENS_RES 数据 */
  4913. atqa: ArrayBuffer
  4914. errMsg: string
  4915. }
  4916. interface GetAvailableAudioSourcesOption {
  4917. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4918. complete?: GetAvailableAudioSourcesCompleteCallback
  4919. /** 接口调用失败的回调函数 */
  4920. fail?: GetAvailableAudioSourcesFailCallback
  4921. /** 接口调用成功的回调函数 */
  4922. success?: GetAvailableAudioSourcesSuccessCallback
  4923. }
  4924. interface GetAvailableAudioSourcesSuccessCallbackResult {
  4925. /** 支持的音频输入源列表,可在 [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
  4926. *
  4927. * 可选值:
  4928. * - 'auto': 自动设置,默认使用手机麦克风,插上耳麦后自动切换使用耳机麦克风,所有平台适用;
  4929. * - 'buildInMic': 手机麦克风,仅限 iOS;
  4930. * - 'headsetMic': 耳机麦克风,仅限 iOS;
  4931. * - 'mic': 麦克风(没插耳麦时是手机麦克风,插耳麦时是耳机麦克风),仅限 Android;
  4932. * - 'camcorder': 同 mic,适用于录制音视频内容,仅限 Android;
  4933. * - 'voice_communication': 同 mic,适用于实时沟通,仅限 Android;
  4934. * - 'voice_recognition': 同 mic,适用于语音识别,仅限 Android; */
  4935. audioSources: Array<
  4936. | 'auto'
  4937. | 'buildInMic'
  4938. | 'headsetMic'
  4939. | 'mic'
  4940. | 'camcorder'
  4941. | 'voice_communication'
  4942. | 'voice_recognition'
  4943. >
  4944. errMsg: string
  4945. }
  4946. interface GetBLEDeviceCharacteristicsOption {
  4947. /** 蓝牙设备 id。需要已经通过 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 建立连接 */
  4948. deviceId: string
  4949. /** 蓝牙服务 UUID。需要先调用 [wx.getBLEDeviceServices](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceServices.html) 获取 */
  4950. serviceId: string
  4951. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4952. complete?: GetBLEDeviceCharacteristicsCompleteCallback
  4953. /** 接口调用失败的回调函数 */
  4954. fail?: GetBLEDeviceCharacteristicsFailCallback
  4955. /** 接口调用成功的回调函数 */
  4956. success?: GetBLEDeviceCharacteristicsSuccessCallback
  4957. }
  4958. interface GetBLEDeviceCharacteristicsSuccessCallbackResult {
  4959. /** 设备特征列表 */
  4960. characteristics: BLECharacteristic[]
  4961. errMsg: string
  4962. }
  4963. interface GetBLEDeviceRSSIOption {
  4964. /** 蓝牙设备 id */
  4965. deviceId: string
  4966. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4967. complete?: GetBLEDeviceRSSICompleteCallback
  4968. /** 接口调用失败的回调函数 */
  4969. fail?: GetBLEDeviceRSSIFailCallback
  4970. /** 接口调用成功的回调函数 */
  4971. success?: GetBLEDeviceRSSISuccessCallback
  4972. }
  4973. interface GetBLEDeviceRSSISuccessCallbackResult {
  4974. /** 信号强度,单位 dBm */
  4975. RSSI: number
  4976. errMsg: string
  4977. }
  4978. interface GetBLEDeviceServicesOption {
  4979. /** 蓝牙设备 id。需要已经通过 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 建立连接 */
  4980. deviceId: string
  4981. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4982. complete?: GetBLEDeviceServicesCompleteCallback
  4983. /** 接口调用失败的回调函数 */
  4984. fail?: GetBLEDeviceServicesFailCallback
  4985. /** 接口调用成功的回调函数 */
  4986. success?: GetBLEDeviceServicesSuccessCallback
  4987. }
  4988. interface GetBLEDeviceServicesSuccessCallbackResult {
  4989. /** 设备服务列表 */
  4990. services: BLEService[]
  4991. errMsg: string
  4992. }
  4993. interface GetBLEMTUOption {
  4994. /** 蓝牙设备 id */
  4995. deviceId: string
  4996. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  4997. complete?: GetBLEMTUCompleteCallback
  4998. /** 接口调用失败的回调函数 */
  4999. fail?: GetBLEMTUFailCallback
  5000. /** 接口调用成功的回调函数 */
  5001. success?: GetBLEMTUSuccessCallback
  5002. /** 写模式 (iOS 特有参数)
  5003. *
  5004. * 可选值:
  5005. * - 'write': 有回复写;
  5006. * - 'writeNoResponse': 无回复写; */
  5007. writeType?: 'write' | 'writeNoResponse'
  5008. }
  5009. interface GetBLEMTUSuccessCallbackResult {
  5010. /** 最大传输单元 */
  5011. mtu: number
  5012. errMsg: string
  5013. }
  5014. interface GetBackgroundAudioPlayerStateOption {
  5015. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5016. complete?: GetBackgroundAudioPlayerStateCompleteCallback
  5017. /** 接口调用失败的回调函数 */
  5018. fail?: GetBackgroundAudioPlayerStateFailCallback
  5019. /** 接口调用成功的回调函数 */
  5020. success?: GetBackgroundAudioPlayerStateSuccessCallback
  5021. }
  5022. interface GetBackgroundAudioPlayerStateSuccessCallbackResult {
  5023. /** 选定音频的播放位置(单位:s),只有在音乐播放中时返回 */
  5024. currentPosition: number
  5025. /** 歌曲数据链接,只有在音乐播放中时返回 */
  5026. dataUrl: string
  5027. /** 音频的下载进度百分比,只有在音乐播放中时返回 */
  5028. downloadPercent: number
  5029. /** 选定音频的长度(单位:s),只有在音乐播放中时返回 */
  5030. duration: number
  5031. /** 播放状态
  5032. *
  5033. * 可选值:
  5034. * - 0: 暂停中;
  5035. * - 1: 播放中;
  5036. * - 2: 没有音乐播放; */
  5037. status: 0 | 1 | 2
  5038. errMsg: string
  5039. }
  5040. interface GetBackgroundFetchDataOption {
  5041. /** 缓存数据类别,取值为 periodic 或 pre */
  5042. fetchType: string
  5043. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5044. complete?: GetBackgroundFetchDataCompleteCallback
  5045. /** 接口调用失败的回调函数 */
  5046. fail?: GetBackgroundFetchDataFailCallback
  5047. /** 接口调用成功的回调函数 */
  5048. success?: GetBackgroundFetchDataSuccessCallback
  5049. }
  5050. interface GetBackgroundFetchDataSuccessCallbackResult {
  5051. /** 缓存数据 */
  5052. fetchedData: string
  5053. /** 小程序页面路径 */
  5054. path: string
  5055. /** 传给页面的 query 参数 */
  5056. query: string
  5057. /** 进入小程序的场景值 */
  5058. scene: number
  5059. /** 客户端拿到缓存数据的时间戳 ms。(iOS 时间戳存在异常,8.0.27 修复) */
  5060. timeStamp: number
  5061. errMsg: string
  5062. }
  5063. interface GetBackgroundFetchTokenOption {
  5064. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5065. complete?: GetBackgroundFetchTokenCompleteCallback
  5066. /** 接口调用失败的回调函数 */
  5067. fail?: GetBackgroundFetchTokenFailCallback
  5068. /** 接口调用成功的回调函数 */
  5069. success?: GetBackgroundFetchTokenSuccessCallback
  5070. }
  5071. interface GetBackgroundFetchTokenSuccessCallbackResult {
  5072. /** 接口调用结果 */
  5073. errMsg: string
  5074. /** 自定义的登录态 */
  5075. token: string
  5076. }
  5077. interface GetBatteryInfoOption {
  5078. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5079. complete?: GetBatteryInfoCompleteCallback
  5080. /** 接口调用失败的回调函数 */
  5081. fail?: GetBatteryInfoFailCallback
  5082. /** 接口调用成功的回调函数 */
  5083. success?: GetBatteryInfoSuccessCallback
  5084. }
  5085. interface GetBatteryInfoSuccessCallbackResult {
  5086. /** 是否正在充电中 */
  5087. isCharging: boolean
  5088. /** 设备电量,范围 1 - 100 */
  5089. level: number
  5090. errMsg: string
  5091. }
  5092. interface GetBatteryInfoSyncResult {
  5093. /** 是否正在充电中 */
  5094. isCharging: boolean
  5095. /** 设备电量,范围 1 - 100 */
  5096. level: number
  5097. }
  5098. interface GetBeaconsOption {
  5099. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5100. complete?: GetBeaconsCompleteCallback
  5101. /** 接口调用失败的回调函数 */
  5102. fail?: GetBeaconsFailCallback
  5103. /** 接口调用成功的回调函数 */
  5104. success?: GetBeaconsSuccessCallback
  5105. }
  5106. interface GetBeaconsSuccessCallbackResult {
  5107. /** Beacon 设备列表 */
  5108. beacons: BeaconInfo[]
  5109. errMsg: string
  5110. }
  5111. interface GetBluetoothAdapterStateOption {
  5112. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5113. complete?: GetBluetoothAdapterStateCompleteCallback
  5114. /** 接口调用失败的回调函数 */
  5115. fail?: GetBluetoothAdapterStateFailCallback
  5116. /** 接口调用成功的回调函数 */
  5117. success?: GetBluetoothAdapterStateSuccessCallback
  5118. }
  5119. interface GetBluetoothAdapterStateSuccessCallbackResult {
  5120. /** 蓝牙适配器是否可用 */
  5121. available: boolean
  5122. /** 是否正在搜索设备 */
  5123. discovering: boolean
  5124. errMsg: string
  5125. }
  5126. interface GetBluetoothDevicesOption {
  5127. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5128. complete?: GetBluetoothDevicesCompleteCallback
  5129. /** 接口调用失败的回调函数 */
  5130. fail?: GetBluetoothDevicesFailCallback
  5131. /** 接口调用成功的回调函数 */
  5132. success?: GetBluetoothDevicesSuccessCallback
  5133. }
  5134. interface GetBluetoothDevicesSuccessCallbackResult {
  5135. /** UUID 对应的已连接设备列表 */
  5136. devices: BlueToothDevice[]
  5137. errMsg: string
  5138. }
  5139. interface GetCenterLocationOption {
  5140. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5141. complete?: GetCenterLocationCompleteCallback
  5142. /** 接口调用失败的回调函数 */
  5143. fail?: GetCenterLocationFailCallback
  5144. /** 图标路径,支持网络路径、本地路径、代码包路径 */
  5145. iconPath?: string
  5146. /** 接口调用成功的回调函数 */
  5147. success?: GetCenterLocationSuccessCallback
  5148. }
  5149. interface GetCenterLocationSuccessCallbackResult {
  5150. /** 纬度 */
  5151. latitude: number
  5152. /** 经度 */
  5153. longitude: number
  5154. errMsg: string
  5155. }
  5156. interface GetChannelsLiveInfoOption {
  5157. /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
  5158. finderUserName: string
  5159. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5160. complete?: GetChannelsLiveInfoCompleteCallback
  5161. /** 需要基础库: `2.29.0`
  5162. *
  5163. * 结束时间,筛选指定时间段的直播。若上传了startTime,未上传endTime,则endTime默认取当前时间 */
  5164. endTime?: number
  5165. /** 接口调用失败的回调函数 */
  5166. fail?: GetChannelsLiveInfoFailCallback
  5167. /** 需要基础库: `2.29.0`
  5168. *
  5169. * 起始时间,筛选指定时间段的直播。若上传了endTime,未上传startTime,则startTime默认为0 */
  5170. startTime?: number
  5171. /** 接口调用成功的回调函数 */
  5172. success?: GetChannelsLiveInfoSuccessCallback
  5173. }
  5174. interface GetChannelsLiveInfoSuccessCallbackResult {
  5175. /** 直播主题 */
  5176. description: string
  5177. /** 直播 feedId */
  5178. feedId: string
  5179. /** 视频号头像 */
  5180. headUrl: string
  5181. /** 视频号昵称 */
  5182. nickname: string
  5183. /** 直播 nonceId */
  5184. nonceId: string
  5185. /** 需要基础库: `2.29.0`
  5186. *
  5187. * 除最近的一条直播外,其他的直播列表(注意:每次最多返回按时间戳增序排列的15个直播信息,其中时间最近的那个直播会在接口其他的返回参数中展示,其余的直播会在该字段中展示)。 */
  5188. otherInfos: any[]
  5189. /** 需要基础库: `2.29.0`
  5190. *
  5191. * 直播回放状态
  5192. *
  5193. * 可选值:
  5194. * - 0: 未生成;
  5195. * - 1: 已生成;
  5196. * - 3: 生成中;
  5197. * - 6: 已过期; */
  5198. replayStatus: 0 | 1 | 3 | 6
  5199. /** 直播状态
  5200. *
  5201. * 可选值:
  5202. * - 2: 直播中;
  5203. * - 3: 直播结束; */
  5204. status: 2 | 3
  5205. errMsg: string
  5206. }
  5207. interface GetChannelsLiveNoticeInfoOption {
  5208. /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
  5209. finderUserName: string
  5210. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5211. complete?: GetChannelsLiveNoticeInfoCompleteCallback
  5212. /** 接口调用失败的回调函数 */
  5213. fail?: GetChannelsLiveNoticeInfoFailCallback
  5214. /** 接口调用成功的回调函数 */
  5215. success?: GetChannelsLiveNoticeInfoSuccessCallback
  5216. }
  5217. interface GetChannelsLiveNoticeInfoSuccessCallbackResult {
  5218. /** 直播封面 */
  5219. headUrl: string
  5220. /** 视频号昵称 */
  5221. nickname: string
  5222. /** 预告 id */
  5223. noticeId: string
  5224. /** 需要基础库: `2.24.6`
  5225. *
  5226. * 除最近的一条预告信息外,其他的预告信息列表(注意:每次最多返回按时间戳增序排列的15个预告信息,其中时间最近的那个预告信息会在接口其他的返回参数中展示,其余的预告信息会在该字段中展示)。 */
  5227. otherInfos: any[]
  5228. /** 是否可预约 */
  5229. reservable: boolean
  5230. /** 开始时间 */
  5231. startTime: string
  5232. /** 预告状态:0可用 1取消 2已用 */
  5233. status: number
  5234. errMsg: string
  5235. }
  5236. interface GetChannelsShareKeyOption {
  5237. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5238. complete?: GetChannelsShareKeyCompleteCallback
  5239. /** 接口调用失败的回调函数 */
  5240. fail?: GetChannelsShareKeyFailCallback
  5241. /** 接口调用成功的回调函数 */
  5242. success?: GetChannelsShareKeySuccessCallback
  5243. }
  5244. interface GetChannelsShareKeySuccessCallbackResult {
  5245. /** 推广员 */
  5246. promoter: PromoterResult
  5247. /** 分享者 openid */
  5248. sharerOpenId: string
  5249. errMsg: string
  5250. }
  5251. interface GetClipboardDataOption {
  5252. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5253. complete?: GetClipboardDataCompleteCallback
  5254. /** 接口调用失败的回调函数 */
  5255. fail?: GetClipboardDataFailCallback
  5256. /** 接口调用成功的回调函数 */
  5257. success?: GetClipboardDataSuccessCallback
  5258. }
  5259. interface GetClipboardDataSuccessCallbackOption {
  5260. /** 剪贴板的内容 */
  5261. data: string
  5262. errMsg: string
  5263. }
  5264. interface GetCommonConfigOption {
  5265. /** 0:通用配置模式 1:实验模式, 参数与返回结果的使用等效于接口[wx.getExptInfoSync](https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.getExptInfoSync.html) */
  5266. mode: number
  5267. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5268. complete?: GetCommonConfigCompleteCallback
  5269. /** 接口调用失败的回调函数 */
  5270. fail?: GetCommonConfigFailCallback
  5271. /** 需要获取的数据指标的对象数组,每个string的格式约定:配置类型_分表key */
  5272. keys?: string[]
  5273. /** 接口调用成功的回调函数 */
  5274. success?: GetCommonConfigSuccessCallback
  5275. }
  5276. interface GetCommonConfigSuccessCallbackResult {
  5277. /** 根据conf_type来确定conf内容,conf_type为1时conf是一个json数组, 类似"[{xxx},{xxx}]", 每一项对应表类型每一行配置内容, 其中conf_type为2时conf是一个json对象,类似"{xxxx}" */
  5278. conf: string
  5279. /** 配置类型, 1-表类型 2-kv类型 */
  5280. conf_type: number
  5281. /** 错误码 */
  5282. errcode: number
  5283. /** 错误信息 */
  5284. errmsg: string
  5285. /** 过期时间,单位秒. 0表示当次有效 */
  5286. expire_sec: number
  5287. errMsg: string
  5288. }
  5289. interface GetConnectedBluetoothDevicesOption {
  5290. /** 蓝牙设备主服务的 UUID 列表(支持 16/32/128 位 UUID) */
  5291. services: string[]
  5292. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5293. complete?: GetConnectedBluetoothDevicesCompleteCallback
  5294. /** 接口调用失败的回调函数 */
  5295. fail?: GetConnectedBluetoothDevicesFailCallback
  5296. /** 接口调用成功的回调函数 */
  5297. success?: GetConnectedBluetoothDevicesSuccessCallback
  5298. }
  5299. interface GetConnectedBluetoothDevicesSuccessCallbackResult {
  5300. /** 搜索到的设备列表 */
  5301. devices: BluetoothDeviceInfo[]
  5302. errMsg: string
  5303. }
  5304. interface GetConnectedWifiOption {
  5305. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5306. complete?: GetConnectedWifiCompleteCallback
  5307. /** 接口调用失败的回调函数 */
  5308. fail?: GetConnectedWifiFailCallback
  5309. /** 需要基础库: `2.22.0`
  5310. *
  5311. * 是否需要返回部分 Wi-Fi 信息 */
  5312. partialInfo?: boolean
  5313. /** 接口调用成功的回调函数 */
  5314. success?: GetConnectedWifiSuccessCallback
  5315. }
  5316. interface GetConnectedWifiSuccessCallbackResult {
  5317. /** [WifiInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/WifiInfo.html)
  5318. *
  5319. * Wi-Fi 信息 */
  5320. wifi: WifiInfo
  5321. errMsg: string
  5322. }
  5323. interface GetContentsOption {
  5324. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5325. complete?: GetContentsCompleteCallback
  5326. /** 接口调用失败的回调函数 */
  5327. fail?: GetContentsFailCallback
  5328. /** 接口调用成功的回调函数 */
  5329. success?: GetContentsSuccessCallback
  5330. }
  5331. interface GetContentsSuccessCallbackResult {
  5332. /** 表示内容的delta对象 */
  5333. delta: IAnyObject
  5334. /** 带标签的HTML内容 */
  5335. html: string
  5336. /** 纯文本内容 */
  5337. text: string
  5338. errMsg: string
  5339. }
  5340. interface GetDeviceVoIPListOption {
  5341. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5342. complete?: GetDeviceVoIPListCompleteCallback
  5343. /** 接口调用失败的回调函数 */
  5344. fail?: GetDeviceVoIPListFailCallback
  5345. /** 接口调用成功的回调函数 */
  5346. success?: GetDeviceVoIPListSuccessCallback
  5347. }
  5348. interface GetDeviceVoIPListSuccessCallbackResult {
  5349. list: DeviceVoIPInfo[]
  5350. errMsg: string
  5351. }
  5352. interface GetExtConfigOption {
  5353. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5354. complete?: GetExtConfigCompleteCallback
  5355. /** 接口调用失败的回调函数 */
  5356. fail?: GetExtConfigFailCallback
  5357. /** 接口调用成功的回调函数 */
  5358. success?: GetExtConfigSuccessCallback
  5359. }
  5360. interface GetExtConfigSuccessCallbackResult {
  5361. /** 第三方平台自定义的数据 */
  5362. extConfig: IAnyObject
  5363. errMsg: string
  5364. }
  5365. interface GetFileInfoOption {
  5366. /** 要读取的文件路径 (本地路径) */
  5367. filePath: string
  5368. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5369. complete?: GetFileInfoCompleteCallback
  5370. /** 计算文件摘要的算法
  5371. *
  5372. * 可选值:
  5373. * - 'md5': md5 算法;
  5374. * - 'sha1': sha1 算法; */
  5375. digestAlgorithm?: 'md5' | 'sha1'
  5376. /** 接口调用失败的回调函数 */
  5377. fail?: GetFileInfoFailCallback
  5378. /** 接口调用成功的回调函数 */
  5379. success?: GetFileInfoSuccessCallback
  5380. }
  5381. interface GetFileInfoSuccessCallbackResult {
  5382. /** 按照传入的 digestAlgorithm 计算得出的的文件摘要 */
  5383. digest: string
  5384. /** 文件大小,以字节为单位 */
  5385. size: number
  5386. errMsg: string
  5387. }
  5388. interface GetFuzzyLocationOption {
  5389. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5390. complete?: GetFuzzyLocationCompleteCallback
  5391. /** 接口调用失败的回调函数 */
  5392. fail?: GetFuzzyLocationFailCallback
  5393. /** 接口调用成功的回调函数 */
  5394. success?: GetFuzzyLocationSuccessCallback
  5395. /** 返回的坐标类型
  5396. *
  5397. * 可选值:
  5398. * - 'wgs84': 返回 gps 坐标;
  5399. * - 'gcj02': 返回 gcj02 坐标,可用于 wx.openLocation; */
  5400. type?: 'wgs84' | 'gcj02'
  5401. }
  5402. interface GetFuzzyLocationSuccessCallbackResult {
  5403. /** 纬度,范围为 -90~90,负数表示南纬 */
  5404. latitude: number
  5405. /** 经度,范围为 -180~180,负数表示西经 */
  5406. longitude: number
  5407. errMsg: string
  5408. }
  5409. interface GetGroupEnterInfoOption {
  5410. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5411. complete?: GetGroupEnterInfoCompleteCallback
  5412. /** 接口调用失败的回调函数 */
  5413. fail?: GetGroupEnterInfoFailCallback
  5414. /** 接口调用成功的回调函数 */
  5415. success?: GetGroupEnterInfoSuccessCallback
  5416. }
  5417. interface GetGroupEnterInfoSuccessCallbackResult {
  5418. /** 需要基础库: `2.7.0`
  5419. *
  5420. * 敏感数据对应的云 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) */
  5421. cloudID: string
  5422. /** 包括敏感数据在内的完整转发信息的加密数据,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  5423. encryptedData: string
  5424. /** 错误信息 */
  5425. errMsg: string
  5426. /** 加密算法的初始向量,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  5427. iv: string
  5428. }
  5429. interface GetHCEStateOption {
  5430. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5431. complete?: GetHCEStateCompleteCallback
  5432. /** 接口调用失败的回调函数 */
  5433. fail?: GetHCEStateFailCallback
  5434. /** 接口调用成功的回调函数 */
  5435. success?: GetHCEStateSuccessCallback
  5436. }
  5437. interface GetHistoricalBytesOption {
  5438. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5439. complete?: GetHistoricalBytesCompleteCallback
  5440. /** 接口调用失败的回调函数 */
  5441. fail?: GetHistoricalBytesFailCallback
  5442. /** 接口调用成功的回调函数 */
  5443. success?: GetHistoricalBytesSuccessCallback
  5444. }
  5445. interface GetHistoricalBytesSuccessCallbackResult {
  5446. /** 返回历史二进制数据 */
  5447. histBytes: ArrayBuffer
  5448. errMsg: string
  5449. }
  5450. interface GetImageInfoOption {
  5451. /** 图片的路径,支持网络路径、本地路径、代码包路径 */
  5452. src: string
  5453. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5454. complete?: GetImageInfoCompleteCallback
  5455. /** 接口调用失败的回调函数 */
  5456. fail?: GetImageInfoFailCallback
  5457. /** 接口调用成功的回调函数 */
  5458. success?: GetImageInfoSuccessCallback
  5459. }
  5460. interface GetImageInfoSuccessCallbackResult {
  5461. /** 图片原始高度,单位px。不考虑旋转。 */
  5462. height: number
  5463. /** 需要基础库: `1.9.90`
  5464. *
  5465. * [拍照时设备方向](http://sylvana.net/jpegcrop/exif_orientation.html)
  5466. *
  5467. * 可选值:
  5468. * - 'up': 默认方向(手机横持拍照),对应 Exif 中的 1。或无 orientation 信息。;
  5469. * - 'up-mirrored': 同 up,但镜像翻转,对应 Exif 中的 2;
  5470. * - 'down': 旋转180度,对应 Exif 中的 3;
  5471. * - 'down-mirrored': 同 down,但镜像翻转,对应 Exif 中的 4;
  5472. * - 'left-mirrored': 同 left,但镜像翻转,对应 Exif 中的 5;
  5473. * - 'right': 顺时针旋转90度,对应 Exif 中的 6;
  5474. * - 'right-mirrored': 同 right,但镜像翻转,对应 Exif 中的 7;
  5475. * - 'left': 逆时针旋转90度,对应 Exif 中的 8; */
  5476. orientation:
  5477. | 'up'
  5478. | 'up-mirrored'
  5479. | 'down'
  5480. | 'down-mirrored'
  5481. | 'left-mirrored'
  5482. | 'right'
  5483. | 'right-mirrored'
  5484. | 'left'
  5485. /** 图片的本地路径 */
  5486. path: string
  5487. /** 需要基础库: `1.9.90`
  5488. *
  5489. * 图片格式
  5490. *
  5491. * 可选值:
  5492. * - 'unknown': 未知格式;
  5493. * - 'jpeg': jpeg压缩格式;
  5494. * - 'png': png压缩格式;
  5495. * - 'gif': gif压缩格式;
  5496. * - 'tiff': tiff压缩格式; */
  5497. type: 'unknown' | 'jpeg' | 'png' | 'gif' | 'tiff'
  5498. /** 图片原始宽度,单位px。不考虑旋转。 */
  5499. width: number
  5500. errMsg: string
  5501. }
  5502. interface GetInferenceEnvInfoOption {
  5503. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5504. complete?: GetInferenceEnvInfoCompleteCallback
  5505. /** 接口调用失败的回调函数 */
  5506. fail?: GetInferenceEnvInfoFailCallback
  5507. /** 接口调用成功的回调函数 */
  5508. success?: GetInferenceEnvInfoSuccessCallback
  5509. }
  5510. interface GetInferenceEnvInfoSuccessCallbackResult {
  5511. /** AI推理引擎版本 */
  5512. ver: string
  5513. errMsg: string
  5514. }
  5515. interface GetLatestUserKeyOption {
  5516. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5517. complete?: GetLatestUserKeyCompleteCallback
  5518. /** 接口调用失败的回调函数 */
  5519. fail?: GetLatestUserKeyFailCallback
  5520. /** 接口调用成功的回调函数 */
  5521. success?: GetLatestUserKeySuccessCallback
  5522. }
  5523. interface GetLatestUserKeySuccessCallbackResult {
  5524. /** 用户加密密钥 */
  5525. encryptKey: string
  5526. /** 密钥过期时间 */
  5527. expireTime: number
  5528. /** 密钥初始向量 */
  5529. iv: string
  5530. /** 密钥版本 */
  5531. version: number
  5532. errMsg: string
  5533. }
  5534. interface GetLocalIPAddressOption {
  5535. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5536. complete?: GetLocalIPAddressCompleteCallback
  5537. /** 接口调用失败的回调函数 */
  5538. fail?: GetLocalIPAddressFailCallback
  5539. /** 接口调用成功的回调函数 */
  5540. success?: GetLocalIPAddressSuccessCallback
  5541. }
  5542. interface GetLocalIPAddressSuccessCallbackResult {
  5543. /** 错误信息 */
  5544. errMsg: string
  5545. /** 本机局域网IP地址 */
  5546. localip: string
  5547. /** 本机局域网子网掩码,基础库 2.24.0 开始支持 */
  5548. netmask: string
  5549. }
  5550. interface GetLocationOption {
  5551. /** 需要基础库: `1.6.0`
  5552. *
  5553. * 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度 */
  5554. altitude?: boolean
  5555. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5556. complete?: GetLocationCompleteCallback
  5557. /** 接口调用失败的回调函数 */
  5558. fail?: GetLocationFailCallback
  5559. /** 需要基础库: `2.9.0`
  5560. *
  5561. * 高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果 */
  5562. highAccuracyExpireTime?: number
  5563. /** 需要基础库: `2.9.0`
  5564. *
  5565. * 开启高精度定位 */
  5566. isHighAccuracy?: boolean
  5567. /** 接口调用成功的回调函数 */
  5568. success?: GetLocationSuccessCallback
  5569. /** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标 */
  5570. type?: string
  5571. }
  5572. interface GetLocationSuccessCallbackResult {
  5573. /** 位置的精确度,反应与真实位置之间的接近程度,可以理解成10即与真实位置相差10m,越小越精确 */
  5574. accuracy: number
  5575. /** 需要基础库: `1.2.0`
  5576. *
  5577. * 高度,单位 m */
  5578. altitude: number
  5579. /** 需要基础库: `1.2.0`
  5580. *
  5581. * 水平精度,单位 m */
  5582. horizontalAccuracy: number
  5583. /** 纬度,范围为 -90~90,负数表示南纬 */
  5584. latitude: number
  5585. /** 经度,范围为 -180~180,负数表示西经 */
  5586. longitude: number
  5587. /** 速度,单位 m/s */
  5588. speed: number
  5589. /** 需要基础库: `1.2.0`
  5590. *
  5591. * 垂直精度,单位 m(Android 无法获取,返回 0) */
  5592. verticalAccuracy: number
  5593. errMsg: string
  5594. }
  5595. interface GetLogManagerOption {
  5596. /** 需要基础库: `2.3.2`
  5597. *
  5598. * 取值为0/1,取值为0表示会把 `App`、`Page` 的生命周期函数和 `wx` 命名空间下的函数调用写入日志,取值为1则不会。默认值是 0 */
  5599. level?: number
  5600. }
  5601. interface GetMaxTransceiveLengthOption {
  5602. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5603. complete?: GetMaxTransceiveLengthCompleteCallback
  5604. /** 接口调用失败的回调函数 */
  5605. fail?: GetMaxTransceiveLengthFailCallback
  5606. /** 接口调用成功的回调函数 */
  5607. success?: GetMaxTransceiveLengthSuccessCallback
  5608. }
  5609. interface GetMaxTransceiveLengthSuccessCallbackResult {
  5610. /** 最大传输长度 */
  5611. length: number
  5612. errMsg: string
  5613. }
  5614. interface GetMaxZoomOption {
  5615. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5616. complete?: GetMaxZoomCompleteCallback
  5617. /** 接口调用失败的回调函数 */
  5618. fail?: GetMaxZoomFailCallback
  5619. /** 接口调用成功的回调函数 */
  5620. success?: GetMaxZoomSuccessCallback
  5621. }
  5622. interface GetMaxZoomSuccessCallbackResult {
  5623. /** 最大放缩级别 */
  5624. maxZoom: string
  5625. errMsg: string
  5626. }
  5627. interface GetNetworkTypeOption {
  5628. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5629. complete?: GetNetworkTypeCompleteCallback
  5630. /** 接口调用失败的回调函数 */
  5631. fail?: GetNetworkTypeFailCallback
  5632. /** 接口调用成功的回调函数 */
  5633. success?: GetNetworkTypeSuccessCallback
  5634. }
  5635. interface GetNetworkTypeSuccessCallbackResult {
  5636. /** 需要基础库: `2.22.1`
  5637. *
  5638. * 设备是否使用了网络代理 */
  5639. hasSystemProxy: boolean
  5640. /** 网络类型
  5641. *
  5642. * 可选值:
  5643. * - 'wifi': wifi 网络;
  5644. * - '2g': 2g 网络;
  5645. * - '3g': 3g 网络;
  5646. * - '4g': 4g 网络;
  5647. * - '5g': 5g 网络;
  5648. * - 'unknown': Android 下不常见的网络类型;
  5649. * - 'none': 无网络; */
  5650. networkType: 'wifi' | '2g' | '3g' | '4g' | '5g' | 'unknown' | 'none'
  5651. /** 信号强弱,单位 dbm */
  5652. signalStrength: number
  5653. errMsg: string
  5654. }
  5655. interface GetPrivacySettingOption {
  5656. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5657. complete?: GetPrivacySettingCompleteCallback
  5658. /** 接口调用失败的回调函数 */
  5659. fail?: GetPrivacySettingFailCallback
  5660. /** 接口调用成功的回调函数 */
  5661. success?: GetPrivacySettingSuccessCallback
  5662. }
  5663. interface GetPrivacySettingSuccessCallbackResult {
  5664. /** 是否需要用户授权隐私协议(如果开发者没有在[mp后台-设置-服务内容声明-用户隐私保护指引]中声明隐私收集类型则会返回false;如果开发者声明了隐私收集,且用户之前同意过隐私协议则会返回false;如果开发者声明了隐私收集,且用户还没同意过则返回true;如果用户之前同意过、但后来小程序又新增了隐私收集类型也会返回true) */
  5665. needAuthorization: boolean
  5666. /** 隐私授权协议的名称 */
  5667. privacyContractName: string
  5668. errMsg: string
  5669. }
  5670. interface GetRandomValuesOption {
  5671. /** 整数,生成随机数的字节数,最大 1048576 */
  5672. length: number
  5673. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5674. complete?: GetRandomValuesCompleteCallback
  5675. /** 接口调用失败的回调函数 */
  5676. fail?: GetRandomValuesFailCallback
  5677. /** 接口调用成功的回调函数 */
  5678. success?: GetRandomValuesSuccessCallback
  5679. }
  5680. interface GetRandomValuesSuccessCallbackResult {
  5681. /** 随机数内容,长度为传入的字节数 */
  5682. randomValues: ArrayBuffer
  5683. errMsg: string
  5684. }
  5685. interface GetRegionOption {
  5686. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5687. complete?: GetRegionCompleteCallback
  5688. /** 接口调用失败的回调函数 */
  5689. fail?: GetRegionFailCallback
  5690. /** 接口调用成功的回调函数 */
  5691. success?: GetRegionSuccessCallback
  5692. }
  5693. interface GetRegionSuccessCallbackResult {
  5694. /** 东北角经纬度 */
  5695. northeast: MapPostion
  5696. /** 西南角经纬度 */
  5697. southwest: MapPostion
  5698. errMsg: string
  5699. }
  5700. interface GetRendererUserAgentOption {
  5701. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5702. complete?: GetRendererUserAgentCompleteCallback
  5703. /** 接口调用失败的回调函数 */
  5704. fail?: GetRendererUserAgentFailCallback
  5705. /** 接口调用成功的回调函数 */
  5706. success?: GetRendererUserAgentSuccessCallback
  5707. }
  5708. interface GetRotateOption {
  5709. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5710. complete?: GetRotateCompleteCallback
  5711. /** 接口调用失败的回调函数 */
  5712. fail?: GetRotateFailCallback
  5713. /** 接口调用成功的回调函数 */
  5714. success?: GetRotateSuccessCallback
  5715. }
  5716. interface GetRotateSuccessCallbackResult {
  5717. /** 旋转角 */
  5718. rotate: number
  5719. errMsg: string
  5720. }
  5721. interface GetSakOption {
  5722. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5723. complete?: GetSakCompleteCallback
  5724. /** 接口调用失败的回调函数 */
  5725. fail?: GetSakFailCallback
  5726. /** 接口调用成功的回调函数 */
  5727. success?: GetSakSuccessCallback
  5728. }
  5729. interface GetSakSuccessCallbackResult {
  5730. /** 返回 SAK/SEL_RES 数据 */
  5731. sak: number
  5732. errMsg: string
  5733. }
  5734. interface GetSavedFileListOption {
  5735. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5736. complete?: GetSavedFileListCompleteCallback
  5737. /** 接口调用失败的回调函数 */
  5738. fail?: GetSavedFileListFailCallback
  5739. /** 接口调用成功的回调函数 */
  5740. success?: GetSavedFileListSuccessCallback
  5741. }
  5742. interface GetSavedFileListSuccessCallbackResult {
  5743. /** 文件数组 */
  5744. fileList: FileItem[]
  5745. errMsg: string
  5746. }
  5747. interface GetScaleOption {
  5748. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5749. complete?: GetScaleCompleteCallback
  5750. /** 接口调用失败的回调函数 */
  5751. fail?: GetScaleFailCallback
  5752. /** 接口调用成功的回调函数 */
  5753. success?: GetScaleSuccessCallback
  5754. }
  5755. interface GetScaleSuccessCallbackResult {
  5756. /** 缩放值 */
  5757. scale: number
  5758. errMsg: string
  5759. }
  5760. interface GetScreenBrightnessOption {
  5761. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5762. complete?: GetScreenBrightnessCompleteCallback
  5763. /** 接口调用失败的回调函数 */
  5764. fail?: GetScreenBrightnessFailCallback
  5765. /** 接口调用成功的回调函数 */
  5766. success?: GetScreenBrightnessSuccessCallback
  5767. }
  5768. interface GetScreenBrightnessSuccessCallbackOption {
  5769. /** 屏幕亮度值,范围 0 ~ 1,0 最暗,1 最亮 */
  5770. value: number
  5771. errMsg: string
  5772. }
  5773. interface GetScreenRecordingStateOption {
  5774. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5775. complete?: GetScreenRecordingStateCompleteCallback
  5776. /** 接口调用失败的回调函数 */
  5777. fail?: GetScreenRecordingStateFailCallback
  5778. /** 接口调用成功的回调函数 */
  5779. success?: GetScreenRecordingStateSuccessCallback
  5780. }
  5781. interface GetScreenRecordingStateSuccessCallbackResult {
  5782. /** 录屏状态
  5783. *
  5784. * 可选值:
  5785. * - 'on': 开启;
  5786. * - 'off': 关闭; */
  5787. state: 'on' | 'off'
  5788. errMsg: string
  5789. }
  5790. interface GetSelectedTextRangeOption {
  5791. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5792. complete?: GetSelectedTextRangeCompleteCallback
  5793. /** 接口调用失败的回调函数 */
  5794. fail?: GetSelectedTextRangeFailCallback
  5795. /** 接口调用成功的回调函数 */
  5796. success?: GetSelectedTextRangeSuccessCallback
  5797. }
  5798. interface GetSelectedTextRangeSuccessCallbackResult {
  5799. /** 输入框光标结束位置 */
  5800. end: number
  5801. /** 输入框光标起始位置 */
  5802. start: number
  5803. errMsg: string
  5804. }
  5805. interface GetSelectionTextOption {
  5806. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5807. complete?: GetSelectionTextCompleteCallback
  5808. /** 接口调用失败的回调函数 */
  5809. fail?: GetSelectionTextFailCallback
  5810. /** 接口调用成功的回调函数 */
  5811. success?: GetSelectionTextSuccessCallback
  5812. }
  5813. interface GetSelectionTextSuccessCallbackResult {
  5814. /** 纯文本内容 */
  5815. text: string
  5816. errMsg: string
  5817. }
  5818. interface GetSettingOption {
  5819. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5820. complete?: GetSettingCompleteCallback
  5821. /** 接口调用失败的回调函数 */
  5822. fail?: GetSettingFailCallback
  5823. /** 接口调用成功的回调函数 */
  5824. success?: GetSettingSuccessCallback
  5825. /** 需要基础库: `2.10.1`
  5826. *
  5827. * 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。 */
  5828. withSubscriptions?: boolean
  5829. }
  5830. interface GetSettingSuccessCallbackResult {
  5831. /** [AuthSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/AuthSetting.html)
  5832. *
  5833. * 用户授权结果 */
  5834. authSetting: AuthSetting
  5835. /** [SubscriptionsSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/SubscriptionsSetting.html)
  5836. *
  5837. * 需要基础库: `2.10.1`
  5838. *
  5839. * 用户订阅消息设置,接口参数`withSubscriptions`值为`true`时才会返回。 */
  5840. subscriptionsSetting: SubscriptionsSetting
  5841. /** [AuthSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/AuthSetting.html)
  5842. *
  5843. * 在插件中调用时,当前宿主小程序的用户授权结果 */
  5844. miniprogramAuthSetting?: AuthSetting
  5845. errMsg: string
  5846. }
  5847. interface GetShareInfoOption {
  5848. /** shareTicket */
  5849. shareTicket: string
  5850. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5851. complete?: GetShareInfoCompleteCallback
  5852. /** 接口调用失败的回调函数 */
  5853. fail?: GetShareInfoFailCallback
  5854. /** 接口调用成功的回调函数 */
  5855. success?: GetShareInfoSuccessCallback
  5856. /** 需要基础库: `1.9.90`
  5857. *
  5858. * 超时时间,单位 ms */
  5859. timeout?: number
  5860. }
  5861. interface GetSkewOption {
  5862. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5863. complete?: GetSkewCompleteCallback
  5864. /** 接口调用失败的回调函数 */
  5865. fail?: GetSkewFailCallback
  5866. /** 接口调用成功的回调函数 */
  5867. success?: GetSkewSuccessCallback
  5868. }
  5869. interface GetSkewSuccessCallbackResult {
  5870. /** 倾斜角 */
  5871. skew: number
  5872. errMsg: string
  5873. }
  5874. interface GetSkylineInfoOption {
  5875. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5876. complete?: GetSkylineInfoCompleteCallback
  5877. /** 接口调用失败的回调函数 */
  5878. fail?: GetSkylineInfoFailCallback
  5879. /** 接口调用成功的回调函数 */
  5880. success?: GetSkylineInfoSuccessCallback
  5881. }
  5882. interface GetStorageInfoOption {
  5883. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5884. complete?: GetStorageInfoCompleteCallback
  5885. /** 接口调用失败的回调函数 */
  5886. fail?: GetStorageInfoFailCallback
  5887. /** 接口调用成功的回调函数 */
  5888. success?: GetStorageInfoSuccessCallback
  5889. }
  5890. interface GetStorageInfoSuccessCallbackOption {
  5891. /** 当前占用的空间大小, 单位 KB */
  5892. currentSize: number
  5893. /** 当前 storage 中所有的 key */
  5894. keys: string[]
  5895. /** 限制的空间大小,单位 KB */
  5896. limitSize: number
  5897. errMsg: string
  5898. }
  5899. interface GetStorageInfoSyncOption {
  5900. /** 当前占用的空间大小, 单位 KB */
  5901. currentSize: number
  5902. /** 当前 storage 中所有的 key */
  5903. keys: string[]
  5904. /** 限制的空间大小,单位 KB */
  5905. limitSize: number
  5906. }
  5907. interface GetStorageOption<T = any> {
  5908. /** 本地缓存中指定的 key */
  5909. key: string
  5910. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5911. complete?: GetStorageCompleteCallback
  5912. /** 需要基础库: `2.21.3`
  5913. *
  5914. * 是否开启加密存储。只有异步的 getStorage 接口支持开启加密存储。开启后,将会对 data 使用 AES128 解密,接口回调耗时将会增加。若开启加密存储,setStorage 和 getStorage 需要同时声明 encrypt 的值为 true */
  5915. encrypt?: boolean
  5916. /** 接口调用失败的回调函数 */
  5917. fail?: GetStorageFailCallback
  5918. /** 接口调用成功的回调函数 */
  5919. success?: GetStorageSuccessCallback<T>
  5920. }
  5921. interface GetStorageSuccessCallbackResult<T = any> {
  5922. /** key对应的内容 */
  5923. data: T
  5924. errMsg: string
  5925. }
  5926. interface GetSystemInfoAsyncOption {
  5927. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5928. complete?: GetSystemInfoAsyncCompleteCallback
  5929. /** 接口调用失败的回调函数 */
  5930. fail?: GetSystemInfoAsyncFailCallback
  5931. /** 接口调用成功的回调函数 */
  5932. success?: GetSystemInfoAsyncSuccessCallback
  5933. }
  5934. interface GetSystemInfoOption {
  5935. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5936. complete?: GetSystemInfoCompleteCallback
  5937. /** 接口调用失败的回调函数 */
  5938. fail?: GetSystemInfoFailCallback
  5939. /** 接口调用成功的回调函数 */
  5940. success?: GetSystemInfoSuccessCallback
  5941. }
  5942. interface GetUserInfoOption {
  5943. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5944. complete?: GetUserInfoCompleteCallback
  5945. /** 接口调用失败的回调函数 */
  5946. fail?: GetUserInfoFailCallback
  5947. /** 显示用户信息的语言
  5948. *
  5949. * 可选值:
  5950. * - 'en': 英文;
  5951. * - 'zh_CN': 简体中文;
  5952. * - 'zh_TW': 繁体中文; */
  5953. lang?: 'en' | 'zh_CN' | 'zh_TW'
  5954. /** 接口调用成功的回调函数 */
  5955. success?: GetUserInfoSuccessCallback
  5956. /** 是否带上登录态信息。当 withCredentials 为 true 时,要求此前有调用过 wx.login 且登录态尚未过期,此时返回的数据会包含 encryptedData, iv 等敏感信息;当 withCredentials 为 false 时,不要求有登录态,返回的数据不包含 encryptedData, iv 等敏感信息。 */
  5957. withCredentials?: boolean
  5958. }
  5959. interface GetUserInfoSuccessCallbackResult {
  5960. /** 需要基础库: `2.7.0`
  5961. *
  5962. * 敏感数据对应的云 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) */
  5963. cloudID: string
  5964. /** 包括敏感数据在内的完整用户信息的加密数据,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) */
  5965. encryptedData: string
  5966. /** 加密算法的初始向量,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) */
  5967. iv: string
  5968. /** 不包括敏感信息的原始数据字符串,用于计算签名 */
  5969. rawData: string
  5970. /** 使用 sha1( rawData + sessionkey ) 得到字符串,用于校验用户信息,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  5971. signature: string
  5972. /** [UserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/UserInfo.html)
  5973. *
  5974. * 用户信息对象,不包含 openid 等敏感信息 */
  5975. userInfo: UserInfo
  5976. errMsg: string
  5977. }
  5978. interface GetUserProfileOption {
  5979. /** 声明获取用户个人信息后的用途,不超过30个字符 */
  5980. desc: string
  5981. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  5982. complete?: GetUserProfileCompleteCallback
  5983. /** 接口调用失败的回调函数 */
  5984. fail?: GetUserProfileFailCallback
  5985. /** 显示用户信息的语言
  5986. *
  5987. * 可选值:
  5988. * - 'en': 英文;
  5989. * - 'zh_CN': 简体中文;
  5990. * - 'zh_TW': 繁体中文; */
  5991. lang?: 'en' | 'zh_CN' | 'zh_TW'
  5992. /** 接口调用成功的回调函数 */
  5993. success?: GetUserProfileSuccessCallback
  5994. }
  5995. interface GetUserProfileSuccessCallbackResult {
  5996. /** 需要基础库: `2.10.4`
  5997. *
  5998. * 敏感数据对应的云 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) */
  5999. cloudID: string
  6000. /** 需要基础库: `2.10.4`
  6001. *
  6002. * 包括敏感数据在内的完整用户信息的加密数据,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) */
  6003. encryptedData: string
  6004. /** 需要基础库: `2.10.4`
  6005. *
  6006. * 加密算法的初始向量,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) */
  6007. iv: string
  6008. /** 需要基础库: `2.10.4`
  6009. *
  6010. * 不包括敏感信息的原始数据字符串,用于计算签名 */
  6011. rawData: string
  6012. /** 需要基础库: `2.10.4`
  6013. *
  6014. * 使用 sha1( rawData + sessionkey ) 得到字符串,用于校验用户信息,详见 [用户数据的签名验证和加解密](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  6015. signature: string
  6016. /** [UserInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/UserInfo.html)
  6017. *
  6018. * 需要基础库: `2.10.4`
  6019. *
  6020. * 用户信息对象 */
  6021. userInfo: UserInfo
  6022. errMsg: string
  6023. }
  6024. interface GetVideoInfoOption {
  6025. /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 */
  6026. src: string
  6027. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6028. complete?: GetVideoInfoCompleteCallback
  6029. /** 接口调用失败的回调函数 */
  6030. fail?: GetVideoInfoFailCallback
  6031. /** 接口调用成功的回调函数 */
  6032. success?: GetVideoInfoSuccessCallback
  6033. }
  6034. interface GetVideoInfoSuccessCallbackResult {
  6035. /** 视频码率,单位 kbps */
  6036. bitrate: number
  6037. /** 视频长度 */
  6038. duration: number
  6039. /** 视频帧率 */
  6040. fps: number
  6041. /** 视频的长,单位 px */
  6042. height: number
  6043. /** 画面方向
  6044. *
  6045. * 可选值:
  6046. * - 'up': 默认;
  6047. * - 'down': 180度旋转;
  6048. * - 'left': 逆时针旋转90度;
  6049. * - 'right': 顺时针旋转90度;
  6050. * - 'up-mirrored': 同up,但水平翻转;
  6051. * - 'down-mirrored': 同down,但水平翻转;
  6052. * - 'left-mirrored': 同left,但垂直翻转;
  6053. * - 'right-mirrored': 同right,但垂直翻转; */
  6054. orientation:
  6055. | 'up'
  6056. | 'down'
  6057. | 'left'
  6058. | 'right'
  6059. | 'up-mirrored'
  6060. | 'down-mirrored'
  6061. | 'left-mirrored'
  6062. | 'right-mirrored'
  6063. /** 视频大小,单位 kB */
  6064. size: number
  6065. /** 视频格式 */
  6066. type: string
  6067. /** 视频的宽,单位 px */
  6068. width: number
  6069. errMsg: string
  6070. }
  6071. interface GetWeRunDataOption {
  6072. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6073. complete?: GetWeRunDataCompleteCallback
  6074. /** 接口调用失败的回调函数 */
  6075. fail?: GetWeRunDataFailCallback
  6076. /** 接口调用成功的回调函数 */
  6077. success?: GetWeRunDataSuccessCallback
  6078. }
  6079. interface GetWeRunDataSuccessCallbackResult {
  6080. /** 需要基础库: `2.7.0`
  6081. *
  6082. * 敏感数据对应的云 ID,开通云开发的小程序才会返回,可通过云调用直接获取开放数据,详细见[云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#method-cloud) */
  6083. cloudID: string
  6084. /** 包括敏感数据在内的完整用户信息的加密数据,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html)。解密后得到的数据结构见后文 */
  6085. encryptedData: string
  6086. /** 加密算法的初始向量,详细见[加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html) */
  6087. iv: string
  6088. errMsg: string
  6089. }
  6090. interface GetWifiListOption {
  6091. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6092. complete?: GetWifiListCompleteCallback
  6093. /** 接口调用失败的回调函数 */
  6094. fail?: GetWifiListFailCallback
  6095. /** 接口调用成功的回调函数 */
  6096. success?: GetWifiListSuccessCallback
  6097. }
  6098. /** 需要基础库: `2.28.0`
  6099. *
  6100. * 手势检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/hand.html)。 */
  6101. interface HandTrack {
  6102. /** 需要基础库: `2.28.0`
  6103. *
  6104. * 手势检测模式
  6105. *
  6106. * 可选值:
  6107. * - 1: 通过摄像头实时检测;
  6108. * - 2: 静态图片检测; */
  6109. mode: 1 | 2
  6110. }
  6111. interface HideHomeButtonOption {
  6112. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6113. complete?: HideHomeButtonCompleteCallback
  6114. /** 接口调用失败的回调函数 */
  6115. fail?: HideHomeButtonFailCallback
  6116. /** 接口调用成功的回调函数 */
  6117. success?: HideHomeButtonSuccessCallback
  6118. }
  6119. interface HideKeyboardOption {
  6120. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6121. complete?: HideKeyboardCompleteCallback
  6122. /** 接口调用失败的回调函数 */
  6123. fail?: HideKeyboardFailCallback
  6124. /** 接口调用成功的回调函数 */
  6125. success?: HideKeyboardSuccessCallback
  6126. }
  6127. interface HideLoadingOption {
  6128. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6129. complete?: HideLoadingCompleteCallback
  6130. /** 接口调用失败的回调函数 */
  6131. fail?: HideLoadingFailCallback
  6132. /** 需要基础库: `2.22.1`
  6133. *
  6134. * 目前 toast 和 loading 相关接口可以相互混用,此参数可用于取消混用特性 */
  6135. noConflict?: boolean
  6136. /** 接口调用成功的回调函数 */
  6137. success?: HideLoadingSuccessCallback
  6138. }
  6139. interface HideNavigationBarLoadingOption {
  6140. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6141. complete?: HideNavigationBarLoadingCompleteCallback
  6142. /** 接口调用失败的回调函数 */
  6143. fail?: HideNavigationBarLoadingFailCallback
  6144. /** 接口调用成功的回调函数 */
  6145. success?: HideNavigationBarLoadingSuccessCallback
  6146. }
  6147. interface HideShareMenuOption {
  6148. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6149. complete?: HideShareMenuCompleteCallback
  6150. /** 接口调用失败的回调函数 */
  6151. fail?: HideShareMenuFailCallback
  6152. /** 需要基础库: `2.11.3`
  6153. *
  6154. * 本接口为 Beta 版本,暂只在 Android 平台支持。需要隐藏的转发按钮名称列表,默认['shareAppMessage', 'shareTimeline']。按钮名称合法值包含 "shareAppMessage"、"shareTimeline" 两种 */
  6155. menus?: string[]
  6156. /** 接口调用成功的回调函数 */
  6157. success?: HideShareMenuSuccessCallback
  6158. }
  6159. interface HideTabBarOption {
  6160. /** 是否需要动画效果 */
  6161. animation?: boolean
  6162. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6163. complete?: HideTabBarCompleteCallback
  6164. /** 接口调用失败的回调函数 */
  6165. fail?: HideTabBarFailCallback
  6166. /** 接口调用成功的回调函数 */
  6167. success?: HideTabBarSuccessCallback
  6168. }
  6169. interface HideTabBarRedDotOption {
  6170. /** tabBar 的哪一项,从左边算起 */
  6171. index: number
  6172. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6173. complete?: HideTabBarRedDotCompleteCallback
  6174. /** 接口调用失败的回调函数 */
  6175. fail?: HideTabBarRedDotFailCallback
  6176. /** 接口调用成功的回调函数 */
  6177. success?: HideTabBarRedDotSuccessCallback
  6178. }
  6179. interface HideToastOption {
  6180. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6181. complete?: HideToastCompleteCallback
  6182. /** 接口调用失败的回调函数 */
  6183. fail?: HideToastFailCallback
  6184. /** 需要基础库: `2.22.1`
  6185. *
  6186. * 目前 toast 和 loading 相关接口可以相互混用,此参数可用于取消混用特性 */
  6187. noConflict?: boolean
  6188. /** 接口调用成功的回调函数 */
  6189. success?: HideToastSuccessCallback
  6190. }
  6191. /** 检测结果 */
  6192. interface HitTestRes {
  6193. /** 包含位置、旋转、放缩信息的矩阵,以列为主序 */
  6194. transform: Float32Array
  6195. }
  6196. /** 需要基础库: `2.7.0`
  6197. *
  6198. * 图片对象 */
  6199. interface Image {
  6200. /** 图片的真实高度 */
  6201. height: number
  6202. /** 图片加载发生错误后触发的回调函数 */
  6203. onerror: (...args: any[]) => any
  6204. /** 图片加载完成后触发的回调函数 */
  6205. onload: (...args: any[]) => any
  6206. /** 需要基础库: `2.13.0`
  6207. *
  6208. * `origin`: 发送完整的referrer; `no-referrer`: 不发送。格式固定为 `https://servicewechat.com/{appid}/{version}/page-frame.html`,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本; */
  6209. referrerPolicy: string
  6210. /** 图片的 URL。v2.11.0 起支持传递 base64 Data URI */
  6211. src: string
  6212. /** 图片的真实宽度 */
  6213. width: number
  6214. }
  6215. /** 需要基础库: `2.9.0`
  6216. *
  6217. * ImageData 对象 */
  6218. interface ImageData {
  6219. /** 一维数组,包含以 RGBA 顺序的数据,数据使用 0 至 255(包含)的整数表示 */
  6220. data: Uint8ClampedArray
  6221. /** 使用像素描述 ImageData 的实际高度 */
  6222. height: number
  6223. /** 使用像素描述 ImageData 的实际宽度 */
  6224. width: number
  6225. }
  6226. /** 需要基础库: `1.2.0`
  6227. *
  6228. * 图片的本地临时文件列表 */
  6229. interface ImageFile {
  6230. /** 本地临时文件路径 (本地路径) */
  6231. path: string
  6232. /** 本地临时文件大小,单位 B */
  6233. size: number
  6234. }
  6235. interface IncludePointsOption {
  6236. /** 要显示在可视区域内的坐标点列表 */
  6237. points: MapPostion[]
  6238. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6239. complete?: IncludePointsCompleteCallback
  6240. /** 接口调用失败的回调函数 */
  6241. fail?: IncludePointsFailCallback
  6242. /** 坐标点形成的矩形边缘到地图边缘的距离,单位像素。格式为[上,右,下,左]。开发者工具暂不支持padding参数。 */
  6243. padding?: number[]
  6244. /** 接口调用成功的回调函数 */
  6245. success?: IncludePointsSuccessCallback
  6246. }
  6247. interface InitFaceDetectOption {
  6248. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6249. complete?: InitFaceDetectCompleteCallback
  6250. /** 接口调用失败的回调函数 */
  6251. fail?: InitFaceDetectFailCallback
  6252. /** 接口调用成功的回调函数 */
  6253. success?: InitFaceDetectSuccessCallback
  6254. }
  6255. interface InitMarkerClusterOption {
  6256. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6257. complete?: InitMarkerClusterCompleteCallback
  6258. /** 启用默认的聚合样式 */
  6259. enableDefaultStyle?: boolean
  6260. /** 接口调用失败的回调函数 */
  6261. fail?: InitMarkerClusterFailCallback
  6262. /** 聚合算法的可聚合距离,即距离小于该值的点会聚合至一起,以像素为单位 */
  6263. gridSize?: number
  6264. /** 接口调用成功的回调函数 */
  6265. success?: InitMarkerClusterSuccessCallback
  6266. /** 点击已经聚合的标记点时是否实现聚合分离 */
  6267. zoomOnClick?: boolean
  6268. }
  6269. /** 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)事件来处理这种情况。
  6270. *
  6271. * **支持格式**
  6272. *
  6273. * | 格式 | iOS | Android |
  6274. * | ---- | ---- | ------- |
  6275. * | flac | x | √ |
  6276. * | m4a | √ | √ |
  6277. * | ogg | x | √ |
  6278. * | ape | x | √ |
  6279. * | amr | x | √ |
  6280. * | wma | x | √ |
  6281. * | wav | √ | √ |
  6282. * | mp3 | √ | √ |
  6283. * | mp4 | x | √ |
  6284. * | aac | √ | √ |
  6285. * | aiff | √ | x |
  6286. * | caf | √ | x |
  6287. *
  6288. * **示例代码**
  6289. *
  6290. * ```js
  6291. const innerAudioContext = wx.createInnerAudioContext()
  6292. innerAudioContext.autoplay = true
  6293. innerAudioContext.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46'
  6294. innerAudioContext.onPlay(() => {
  6295. console.log('开始播放')
  6296. })
  6297. innerAudioContext.onError((res) => {
  6298. console.log(res.errMsg)
  6299. console.log(res.errCode)
  6300. })
  6301. ``` */
  6302. interface InnerAudioContext {
  6303. /** 是否自动开始播放,默认为 `false` */
  6304. autoplay: boolean
  6305. /** 音频缓冲的时间点,仅保证当前播放时间点到此时间点内容已缓冲(只读) */
  6306. buffered: number
  6307. /** 当前音频的播放位置(单位 s)。只有在当前有合法的 src 时返回,时间保留小数点后 6 位(currentTime 属性在基础库 2.26.2 之前只读,基础库 2.26.2 开始可读可写,改变 currentTime 值等同于调用 seek) */
  6308. currentTime: number
  6309. /** 当前音频的长度(单位 s)。只有在当前有合法的 src 时返回(只读) */
  6310. duration: number
  6311. /** 是否循环播放,默认为 `false` */
  6312. loop: boolean
  6313. /** 是否遵循系统静音开关,默认为 `true`。当此参数为 `false` 时,即使用户打开了静音开关,也能继续发出声音。从 2.3.0 版本开始此参数不生效,使用 [wx.setInnerAudioOption](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.setInnerAudioOption.html) 接口统一设置。 */
  6314. obeyMuteSwitch: boolean
  6315. /** 当前是是否暂停或停止状态(只读) */
  6316. paused: boolean
  6317. /** 需要基础库: `2.11.0`
  6318. *
  6319. * 播放速度。范围 0.5-2.0,默认为 1。(Android 需要 6 及以上版本) */
  6320. playbackRate: number
  6321. /** 需要基础库: `2.13.0`
  6322. *
  6323. * `origin`: 发送完整的referrer; `no-referrer`: 不发送。格式固定为 `https://servicewechat.com/{appid}/{version}/page-frame.html`,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本; */
  6324. referrerPolicy: string
  6325. /** 音频资源的地址,用于直接播放。[2.2.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 开始支持云文件ID */
  6326. src: string
  6327. /** 开始播放的位置(单位:s),默认为 0 */
  6328. startTime: number
  6329. /** 需要基础库: `1.9.90`
  6330. *
  6331. * 音量。范围 0~1。默认为 1 */
  6332. volume: number
  6333. /** [InnerAudioContext.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.destroy.html)
  6334. *
  6335. * 在插件中使用:支持
  6336. *
  6337. * 销毁当前实例 */
  6338. destroy(): void
  6339. /** [InnerAudioContext.offCanplay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offCanplay.html)
  6340. *
  6341. * 需要基础库: `1.9.0`
  6342. *
  6343. * 在插件中使用:支持
  6344. *
  6345. * 移除音频进入可以播放状态的事件的监听函数
  6346. *
  6347. * **示例代码**
  6348. *
  6349. * ```js
  6350. const listener = function (res) { console.log(res) }
  6351. InnerAudioContext.onCanplay(listener)
  6352. InnerAudioContext.offCanplay(listener) // 需传入与监听时同一个的函数对象
  6353. ``` */
  6354. offCanplay(
  6355. /** onCanplay 传入的监听函数。不传此参数则移除所有监听函数。 */
  6356. listener?: OffCanplayCallback
  6357. ): void
  6358. /** [InnerAudioContext.offEnded(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offEnded.html)
  6359. *
  6360. * 需要基础库: `1.9.0`
  6361. *
  6362. * 在插件中使用:支持
  6363. *
  6364. * 移除音频自然播放至结束的事件的监听函数
  6365. *
  6366. * **示例代码**
  6367. *
  6368. * ```js
  6369. const listener = function (res) { console.log(res) }
  6370. InnerAudioContext.onEnded(listener)
  6371. InnerAudioContext.offEnded(listener) // 需传入与监听时同一个的函数对象
  6372. ``` */
  6373. offEnded(
  6374. /** onEnded 传入的监听函数。不传此参数则移除所有监听函数。 */
  6375. listener?: OffEndedCallback
  6376. ): void
  6377. /** [InnerAudioContext.offError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offError.html)
  6378. *
  6379. * 需要基础库: `1.9.0`
  6380. *
  6381. * 在插件中使用:支持
  6382. *
  6383. * 移除音频播放错误事件的监听函数
  6384. *
  6385. * **示例代码**
  6386. *
  6387. * ```js
  6388. const listener = function (res) { console.log(res) }
  6389. InnerAudioContext.onError(listener)
  6390. InnerAudioContext.offError(listener) // 需传入与监听时同一个的函数对象
  6391. ``` */
  6392. offError(
  6393. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  6394. listener?: InnerAudioContextOffErrorCallback
  6395. ): void
  6396. /** [InnerAudioContext.offPause(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offPause.html)
  6397. *
  6398. * 需要基础库: `1.9.0`
  6399. *
  6400. * 在插件中使用:支持
  6401. *
  6402. * 移除音频暂停事件的监听函数
  6403. *
  6404. * **示例代码**
  6405. *
  6406. * ```js
  6407. const listener = function (res) { console.log(res) }
  6408. InnerAudioContext.onPause(listener)
  6409. InnerAudioContext.offPause(listener) // 需传入与监听时同一个的函数对象
  6410. ``` */
  6411. offPause(
  6412. /** onPause 传入的监听函数。不传此参数则移除所有监听函数。 */
  6413. listener?: OffPauseCallback
  6414. ): void
  6415. /** [InnerAudioContext.offPlay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offPlay.html)
  6416. *
  6417. * 需要基础库: `1.9.0`
  6418. *
  6419. * 在插件中使用:支持
  6420. *
  6421. * 移除音频播放事件的监听函数
  6422. *
  6423. * **示例代码**
  6424. *
  6425. * ```js
  6426. const listener = function (res) { console.log(res) }
  6427. InnerAudioContext.onPlay(listener)
  6428. InnerAudioContext.offPlay(listener) // 需传入与监听时同一个的函数对象
  6429. ``` */
  6430. offPlay(
  6431. /** onPlay 传入的监听函数。不传此参数则移除所有监听函数。 */
  6432. listener?: OffPlayCallback
  6433. ): void
  6434. /** [InnerAudioContext.offSeeked(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offSeeked.html)
  6435. *
  6436. * 需要基础库: `1.9.0`
  6437. *
  6438. * 在插件中使用:支持
  6439. *
  6440. * 移除音频完成跳转操作的事件的监听函数
  6441. *
  6442. * **示例代码**
  6443. *
  6444. * ```js
  6445. const listener = function (res) { console.log(res) }
  6446. InnerAudioContext.onSeeked(listener)
  6447. InnerAudioContext.offSeeked(listener) // 需传入与监听时同一个的函数对象
  6448. ``` */
  6449. offSeeked(
  6450. /** onSeeked 传入的监听函数。不传此参数则移除所有监听函数。 */
  6451. listener?: OffSeekedCallback
  6452. ): void
  6453. /** [InnerAudioContext.offSeeking(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offSeeking.html)
  6454. *
  6455. * 需要基础库: `1.9.0`
  6456. *
  6457. * 在插件中使用:支持
  6458. *
  6459. * 移除音频进行跳转操作的事件的监听函数
  6460. *
  6461. * **示例代码**
  6462. *
  6463. * ```js
  6464. const listener = function (res) { console.log(res) }
  6465. InnerAudioContext.onSeeking(listener)
  6466. InnerAudioContext.offSeeking(listener) // 需传入与监听时同一个的函数对象
  6467. ``` */
  6468. offSeeking(
  6469. /** onSeeking 传入的监听函数。不传此参数则移除所有监听函数。 */
  6470. listener?: OffSeekingCallback
  6471. ): void
  6472. /** [InnerAudioContext.offStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offStop.html)
  6473. *
  6474. * 需要基础库: `1.9.0`
  6475. *
  6476. * 在插件中使用:支持
  6477. *
  6478. * 移除音频停止事件的监听函数
  6479. *
  6480. * **示例代码**
  6481. *
  6482. * ```js
  6483. const listener = function (res) { console.log(res) }
  6484. InnerAudioContext.onStop(listener)
  6485. InnerAudioContext.offStop(listener) // 需传入与监听时同一个的函数对象
  6486. ``` */
  6487. offStop(
  6488. /** onStop 传入的监听函数。不传此参数则移除所有监听函数。 */
  6489. listener?: OffStopCallback
  6490. ): void
  6491. /** [InnerAudioContext.offTimeUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offTimeUpdate.html)
  6492. *
  6493. * 需要基础库: `1.9.0`
  6494. *
  6495. * 在插件中使用:支持
  6496. *
  6497. * 移除音频播放进度更新事件的监听函数
  6498. *
  6499. * **示例代码**
  6500. *
  6501. * ```js
  6502. const listener = function (res) { console.log(res) }
  6503. InnerAudioContext.onTimeUpdate(listener)
  6504. InnerAudioContext.offTimeUpdate(listener) // 需传入与监听时同一个的函数对象
  6505. ``` */
  6506. offTimeUpdate(
  6507. /** onTimeUpdate 传入的监听函数。不传此参数则移除所有监听函数。 */
  6508. listener?: OffTimeUpdateCallback
  6509. ): void
  6510. /** [InnerAudioContext.offWaiting(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.offWaiting.html)
  6511. *
  6512. * 需要基础库: `1.9.0`
  6513. *
  6514. * 在插件中使用:支持
  6515. *
  6516. * 移除音频加载中事件的监听函数
  6517. *
  6518. * **示例代码**
  6519. *
  6520. * ```js
  6521. const listener = function (res) { console.log(res) }
  6522. InnerAudioContext.onWaiting(listener)
  6523. InnerAudioContext.offWaiting(listener) // 需传入与监听时同一个的函数对象
  6524. ``` */
  6525. offWaiting(
  6526. /** onWaiting 传入的监听函数。不传此参数则移除所有监听函数。 */
  6527. listener?: OffWaitingCallback
  6528. ): void
  6529. /** [InnerAudioContext.onCanplay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onCanplay.html)
  6530. *
  6531. * 在插件中使用:支持
  6532. *
  6533. * 监听音频进入可以播放状态的事件。但不保证后面可以流畅播放 */
  6534. onCanplay(
  6535. /** 音频进入可以播放状态的事件的监听函数 */
  6536. listener: OnCanplayCallback
  6537. ): void
  6538. /** [InnerAudioContext.onEnded(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onEnded.html)
  6539. *
  6540. * 在插件中使用:支持
  6541. *
  6542. * 监听音频自然播放至结束的事件 */
  6543. onEnded(
  6544. /** 音频自然播放至结束的事件的监听函数 */
  6545. listener: OnEndedCallback
  6546. ): void
  6547. /** [InnerAudioContext.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onError.html)
  6548. *
  6549. * 在插件中使用:支持
  6550. *
  6551. * 监听音频播放错误事件
  6552. *
  6553. * **Tips**
  6554. *
  6555. * 1. errCode=100001 时,如若 errMsg 中有 INNERCODE -11828 ,请先检查 response header 是否缺少 Content-Length
  6556. * 2. errCode=100001 时,如若 errMsg 中有 systemErrCode:200333420,请检查文件编码格式和 fileExtension 是否一致 */
  6557. onError(
  6558. /** 音频播放错误事件的监听函数 */
  6559. listener: InnerAudioContextOnErrorCallback
  6560. ): void
  6561. /** [InnerAudioContext.onPause(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onPause.html)
  6562. *
  6563. * 在插件中使用:支持
  6564. *
  6565. * 监听音频暂停事件 */
  6566. onPause(
  6567. /** 音频暂停事件的监听函数 */
  6568. listener: OnPauseCallback
  6569. ): void
  6570. /** [InnerAudioContext.onPlay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onPlay.html)
  6571. *
  6572. * 在插件中使用:支持
  6573. *
  6574. * 监听音频播放事件 */
  6575. onPlay(
  6576. /** 音频播放事件的监听函数 */
  6577. listener: OnPlayCallback
  6578. ): void
  6579. /** [InnerAudioContext.onSeeked(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onSeeked.html)
  6580. *
  6581. * 在插件中使用:支持
  6582. *
  6583. * 监听音频完成跳转操作的事件 */
  6584. onSeeked(
  6585. /** 音频完成跳转操作的事件的监听函数 */
  6586. listener: OnSeekedCallback
  6587. ): void
  6588. /** [InnerAudioContext.onSeeking(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onSeeking.html)
  6589. *
  6590. * 在插件中使用:支持
  6591. *
  6592. * 监听音频进行跳转操作的事件 */
  6593. onSeeking(
  6594. /** 音频进行跳转操作的事件的监听函数 */
  6595. listener: OnSeekingCallback
  6596. ): void
  6597. /** [InnerAudioContext.onStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onStop.html)
  6598. *
  6599. * 在插件中使用:支持
  6600. *
  6601. * 监听音频停止事件 */
  6602. onStop(
  6603. /** 音频停止事件的监听函数 */
  6604. listener: InnerAudioContextOnStopCallback
  6605. ): void
  6606. /** [InnerAudioContext.onTimeUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onTimeUpdate.html)
  6607. *
  6608. * 在插件中使用:支持
  6609. *
  6610. * 监听音频播放进度更新事件 */
  6611. onTimeUpdate(
  6612. /** 音频播放进度更新事件的监听函数 */
  6613. listener: OnTimeUpdateCallback
  6614. ): void
  6615. /** [InnerAudioContext.onWaiting(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.onWaiting.html)
  6616. *
  6617. * 在插件中使用:支持
  6618. *
  6619. * 监听音频加载中事件。当音频因为数据不足,需要停下来加载时会触发 */
  6620. onWaiting(
  6621. /** 音频加载中事件的监听函数 */
  6622. listener: OnWaitingCallback
  6623. ): void
  6624. /** [InnerAudioContext.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.pause.html)
  6625. *
  6626. * 在插件中使用:支持
  6627. *
  6628. * 暂停。暂停后的音频再播放会从暂停处开始播放 */
  6629. pause(): void
  6630. /** [InnerAudioContext.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.play.html)
  6631. *
  6632. * 在插件中使用:支持
  6633. *
  6634. * 播放 */
  6635. play(): void
  6636. /** [InnerAudioContext.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.seek.html)
  6637. *
  6638. * 在插件中使用:支持
  6639. *
  6640. * 跳转到指定位置 */
  6641. seek(
  6642. /** 跳转的时间,单位 s。精确到小数点后 3 位,即支持 ms 级别精确度 */
  6643. position: number
  6644. ): void
  6645. /** [InnerAudioContext.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.stop.html)
  6646. *
  6647. * 在插件中使用:支持
  6648. *
  6649. * 停止。停止后的音频再播放会从头开始播放。 */
  6650. stop(): void
  6651. }
  6652. interface InnerAudioContextOnErrorListenerResult {
  6653. /** 可选值:
  6654. * - 10001: 系统错误;
  6655. * - 10002: 网络错误;
  6656. * - 10003: 文件错误;
  6657. * - 10004: 格式错误;
  6658. * - -1: 未知错误; */
  6659. errCode: 10001 | 10002 | 10003 | 10004 | -1
  6660. errMsg: string
  6661. }
  6662. interface InsertDividerOption {
  6663. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6664. complete?: InsertDividerCompleteCallback
  6665. /** 接口调用失败的回调函数 */
  6666. fail?: InsertDividerFailCallback
  6667. /** 接口调用成功的回调函数 */
  6668. success?: InsertDividerSuccessCallback
  6669. }
  6670. interface InsertImageOption {
  6671. /** 图片地址,仅支持 http(s)、base64、云图片(2.8.0)、临时文件(2.8.3)。 */
  6672. src: string
  6673. /** 图像无法显示时的替代文本 */
  6674. alt?: string
  6675. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6676. complete?: InsertImageCompleteCallback
  6677. /** data 被序列化为 name=value;name1=value2 的格式挂在属性 data-custom 上 */
  6678. data?: IAnyObject
  6679. /** 添加到图片 img 标签上的类名 */
  6680. extClass?: string
  6681. /** 接口调用失败的回调函数 */
  6682. fail?: InsertImageFailCallback
  6683. /** 图片高度 (pixels/百分比) */
  6684. height?: string
  6685. /** 插入图片后是否自动换行,默认换行 */
  6686. nowrap?: boolean
  6687. /** 接口调用成功的回调函数 */
  6688. success?: InsertImageSuccessCallback
  6689. /** 图片宽度(pixels/百分比) */
  6690. width?: string
  6691. }
  6692. interface InsertTextOption {
  6693. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6694. complete?: InsertTextCompleteCallback
  6695. /** 接口调用失败的回调函数 */
  6696. fail?: InsertTextFailCallback
  6697. /** 接口调用成功的回调函数 */
  6698. success?: InsertTextSuccessCallback
  6699. /** 文本内容 */
  6700. text?: string
  6701. }
  6702. interface IntersectionObserverObserveCallbackResult {
  6703. /** 目标边界 */
  6704. boundingClientRect: BoundingClientRectResult
  6705. /** 节点自定义数据属性 */
  6706. dataset: Record<string, any>
  6707. /** 节点 ID */
  6708. id: string
  6709. /** 相交比例 */
  6710. intersectionRatio: number
  6711. /** 相交区域的边界 */
  6712. intersectionRect: IntersectionRectResult
  6713. /** 参照区域的边界 */
  6714. relativeRect: RelativeRectResult
  6715. /** 相交检测时的时间戳 */
  6716. time: number
  6717. }
  6718. /** 相交区域的边界 */
  6719. interface IntersectionRectResult {
  6720. /** 下边界 */
  6721. bottom: number
  6722. /** 高度 */
  6723. height: number
  6724. /** 左边界 */
  6725. left: number
  6726. /** 右边界 */
  6727. right: number
  6728. /** 上边界 */
  6729. top: number
  6730. /** 宽度 */
  6731. width: number
  6732. }
  6733. interface InterstitialAdOnErrorListenerResult {
  6734. /** 错误码
  6735. *
  6736. * 可选值:
  6737. * - 1000: 后端接口调用失败;
  6738. * - 1001: 参数错误;
  6739. * - 1002: 广告单元无效;
  6740. * - 1003: 内部错误;
  6741. * - 1004: 无合适的广告;
  6742. * - 1005: 广告组件审核中;
  6743. * - 1006: 广告组件被驳回;
  6744. * - 1007: 广告组件被封禁;
  6745. * - 1008: 广告单元已关闭; */
  6746. errCode: 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008
  6747. /** 错误信息 */
  6748. errMsg: string
  6749. }
  6750. interface IsBluetoothDevicePairedOption {
  6751. /** 蓝牙设备 id */
  6752. deviceId: string
  6753. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6754. complete?: IsBluetoothDevicePairedCompleteCallback
  6755. /** 接口调用失败的回调函数 */
  6756. fail?: IsBluetoothDevicePairedFailCallback
  6757. /** 接口调用成功的回调函数 */
  6758. success?: IsBluetoothDevicePairedSuccessCallback
  6759. }
  6760. interface IsConnectedOption {
  6761. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6762. complete?: IsConnectedCompleteCallback
  6763. /** 接口调用失败的回调函数 */
  6764. fail?: IsConnectedFailCallback
  6765. /** 接口调用成功的回调函数 */
  6766. success?: IsConnectedSuccessCallback
  6767. }
  6768. interface Join1v1ChatOption {
  6769. /** 呼叫方信息 */
  6770. caller: VoIP1v1ChatUser
  6771. /** 接听方信息 */
  6772. listener: VoIP1v1ChatUser
  6773. /** 窗口背景色(音频通话背景以及小窗模式背景)
  6774. *
  6775. * 可选值:
  6776. * - 0: #262930;
  6777. * - 1: #FA5151;
  6778. * - 2: #FA9D3B;
  6779. * - 3: #3D7257;
  6780. * - 4: #1485EE;
  6781. * - 5: #6467F0; */
  6782. backgroundType?: 0 | 1 | 2 | 3 | 4 | 5
  6783. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6784. complete?: Join1v1ChatCompleteCallback
  6785. /** 不允许切换到语音通话 */
  6786. disableSwitchVoice?: boolean
  6787. /** 接口调用失败的回调函数 */
  6788. fail?: Join1v1ChatFailCallback
  6789. /** 小窗样式 */
  6790. minWindowType?: number
  6791. /** 通话类型
  6792. *
  6793. * 可选值:
  6794. * - 'voice': 语音通话;
  6795. * - 'video': 视频通话; */
  6796. roomType?: 'voice' | 'video'
  6797. /** 接口调用成功的回调函数 */
  6798. success?: Join1v1ChatSuccessCallback
  6799. }
  6800. interface JoinVoIPChatOption {
  6801. /** 小游戏内此房间/群聊的 ID。同一时刻传入相同 groupId 的用户会进入到同个实时语音房间。 */
  6802. groupId: string
  6803. /** 验证所需的随机字符串 */
  6804. nonceStr: string
  6805. /** 签名,用于验证小游戏的身份 */
  6806. signature: string
  6807. /** 验证所需的时间戳 */
  6808. timeStamp: number
  6809. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6810. complete?: JoinVoIPChatCompleteCallback
  6811. /** 接口调用失败的回调函数 */
  6812. fail?: JoinVoIPChatFailCallback
  6813. /** 需要基础库: `2.29.0`
  6814. *
  6815. * 开启后,joinVoIPChat 会同时走 Wi-Fi 和蜂窝网络2种网络模式,保证实时通话体验。 */
  6816. forceCellularNetwork?: boolean
  6817. /** 静音设置 */
  6818. muteConfig?: MuteConfig
  6819. /** 房间类型
  6820. *
  6821. * 可选值:
  6822. * - 'voice': 音频房间,用于语音通话;
  6823. * - 'video': 视频房间,结合 [voip-room](https://developers.weixin.qq.com/miniprogram/dev/component/voip-room.html) 组件可显示成员画面; */
  6824. roomType?: 'voice' | 'video'
  6825. /** 接口调用成功的回调函数 */
  6826. success?: JoinVoIPChatSuccessCallback
  6827. }
  6828. interface JoinVoIPChatSuccessCallbackResult {
  6829. /** 错误码 */
  6830. errCode: number
  6831. /** 调用结果 */
  6832. errMsg: string
  6833. /** 在此通话中的成员 openId 名单 */
  6834. openIdList: string[]
  6835. }
  6836. interface KvList {
  6837. /** key 本地缓存中指定的 key */
  6838. key: string
  6839. /** data 需要存储的内容。只支持原生类型、Date、及能够通过`JSON.stringify`序列化的对象。 */
  6840. value: any
  6841. }
  6842. /** 启动参数 */
  6843. interface LaunchOptionsApp {
  6844. /** 需要基础库: `2.20.0`
  6845. *
  6846. * API 类别
  6847. *
  6848. * 可选值:
  6849. * - 'default': 默认类别;
  6850. * - 'nativeFunctionalized': 原生功能化,视频号直播商品、商品橱窗等场景打开的小程序;
  6851. * - 'browseOnly': 仅浏览,朋友圈快照页等场景打开的小程序;
  6852. * - 'embedded': 内嵌,通过打开半屏小程序能力打开的小程序; */
  6853. apiCategory:
  6854. | 'default'
  6855. | 'nativeFunctionalized'
  6856. | 'browseOnly'
  6857. | 'embedded'
  6858. /** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */
  6859. forwardMaterials: ForwardMaterials[]
  6860. /** 启动小程序的路径 (代码包路径) */
  6861. path: string
  6862. /** 启动小程序的 query 参数 */
  6863. query: Record<string, string>
  6864. /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
  6865. referrerInfo: ReferrerInfo
  6866. /** 启动小程序的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */
  6867. scene: number
  6868. /** 从微信群聊/单聊打开小程序时,chatType 表示具体微信群聊/单聊类型
  6869. *
  6870. * 可选值:
  6871. * - 1: 微信联系人单聊;
  6872. * - 2: 企业微信联系人单聊;
  6873. * - 3: 普通微信群聊;
  6874. * - 4: 企业微信互通群聊; */
  6875. chatType?: 1 | 2 | 3 | 4
  6876. /** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
  6877. shareTicket?: string
  6878. }
  6879. interface LivePlayerContextRequestFullScreenOption {
  6880. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6881. complete?: RequestFullScreenCompleteCallback
  6882. /** 设置全屏时的方向
  6883. *
  6884. * 可选值:
  6885. * - 0: 正常竖向;
  6886. * - 90: 屏幕逆时针90度;
  6887. * - -90: 屏幕顺时针90度; */
  6888. direction?: 0 | 90 | -90
  6889. /** 接口调用失败的回调函数 */
  6890. fail?: RequestFullScreenFailCallback
  6891. /** 接口调用成功的回调函数 */
  6892. success?: RequestFullScreenSuccessCallback
  6893. }
  6894. interface LivePlayerContextSnapshotOption {
  6895. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6896. complete?: SnapshotCompleteCallback
  6897. /** 接口调用失败的回调函数 */
  6898. fail?: SnapshotFailCallback
  6899. /** 需要基础库: `2.10.0`
  6900. *
  6901. * 图片的质量
  6902. *
  6903. * 可选值:
  6904. * - 'raw': 原图;
  6905. * - 'compressed': 压缩图; */
  6906. quality?: 'raw' | 'compressed'
  6907. /** 需要基础库: `2.25.0`
  6908. *
  6909. * 截取的源类型
  6910. *
  6911. * 可选值:
  6912. * - 'stream': 截取视频源;
  6913. * - 'view': 截取渲染后的画面; */
  6914. sourceType?: 'stream' | 'view'
  6915. /** 接口调用成功的回调函数 */
  6916. success?: LivePlayerContextSnapshotSuccessCallback
  6917. }
  6918. interface LivePlayerContextSnapshotSuccessCallbackResult {
  6919. /** 图片的高度 */
  6920. height: string
  6921. /** 图片文件的临时路径 (本地路径) */
  6922. tempImagePath: string
  6923. /** 图片的宽度 */
  6924. width: string
  6925. errMsg: string
  6926. }
  6927. interface LivePusherContextSetZoomOption {
  6928. /** 缩放级别,范围[1, maxZoom]。zoom 可取小数,精确到小数后一位。 */
  6929. zoom: number
  6930. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6931. complete?: SetZoomCompleteCallback
  6932. /** 接口调用失败的回调函数 */
  6933. fail?: SetZoomFailCallback
  6934. /** 接口调用成功的回调函数 */
  6935. success?: LivePusherContextSetZoomSuccessCallback
  6936. }
  6937. interface LivePusherContextSnapshotOption {
  6938. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6939. complete?: SnapshotCompleteCallback
  6940. /** 接口调用失败的回调函数 */
  6941. fail?: SnapshotFailCallback
  6942. /** 需要基础库: `2.10.0`
  6943. *
  6944. * 图片的质量
  6945. *
  6946. * 可选值:
  6947. * - 'raw': 原图;
  6948. * - 'compressed': 压缩图; */
  6949. quality?: 'raw' | 'compressed'
  6950. /** 需要基础库: `2.25.0`
  6951. *
  6952. * 截取的源类型
  6953. *
  6954. * 可选值:
  6955. * - 'stream': 截取视频源;
  6956. * - 'view': 截取渲染后的画面; */
  6957. sourceType?: 'stream' | 'view'
  6958. /** 接口调用成功的回调函数 */
  6959. success?: LivePusherContextSnapshotSuccessCallback
  6960. }
  6961. interface LivePusherContextSnapshotSuccessCallbackResult {
  6962. /** 图片的高度 */
  6963. height: string
  6964. /** 图片文件的临时路径 */
  6965. tempImagePath: string
  6966. /** 图片的宽度 */
  6967. width: string
  6968. errMsg: string
  6969. }
  6970. interface LivePusherContextStartOption {
  6971. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6972. complete?: StartCompleteCallback
  6973. /** 接口调用失败的回调函数 */
  6974. fail?: StartFailCallback
  6975. /** 接口调用成功的回调函数 */
  6976. success?: StartSuccessCallback
  6977. }
  6978. interface LoadFontFaceCompleteCallbackResult {
  6979. /** 加载字体结果 */
  6980. status: string
  6981. }
  6982. interface LoadFontFaceOption {
  6983. /** 定义的字体名称 */
  6984. family: string
  6985. /** 字体资源的地址。建议格式为 TTF 和 WOFF,WOFF2 在低版本的iOS上会不兼容。 */
  6986. source: string
  6987. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  6988. complete?: LoadFontFaceCompleteCallback
  6989. /** 可选的字体描述符 */
  6990. desc?: DescOption
  6991. /** 接口调用失败的回调函数 */
  6992. fail?: LoadFontFaceFailCallback
  6993. /** 需要基础库: `2.10.0`
  6994. *
  6995. * 是否全局生效 */
  6996. global?: boolean
  6997. /** 字体作用范围,可选值为 webview / native,默认 webview,设置 native 可在 Canvas 2D 下使用 */
  6998. scopes?: any[]
  6999. /** 接口调用成功的回调函数 */
  7000. success?: LoadFontFaceSuccessCallback
  7001. }
  7002. interface LocalInfo {
  7003. /** 接收消息的 socket 的地址 */
  7004. address: string
  7005. /** 使用的协议族,为 IPv4 或者 IPv6 */
  7006. family: string
  7007. /** 端口号 */
  7008. port: number
  7009. }
  7010. interface LoginOption {
  7011. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7012. complete?: LoginCompleteCallback
  7013. /** 接口调用失败的回调函数 */
  7014. fail?: LoginFailCallback
  7015. /** 接口调用成功的回调函数 */
  7016. success?: LoginSuccessCallback
  7017. /** 需要基础库: `1.9.90`
  7018. *
  7019. * 超时时间,单位ms */
  7020. timeout?: number
  7021. }
  7022. interface LoginSuccessCallbackResult {
  7023. /** 用户登录凭证(有效期五分钟)。开发者需要在开发者服务器后台调用 [code2Session](https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/user-login/code2Session.html),使用 code 换取 openid、unionid、session_key 等信息 */
  7024. code: string
  7025. errMsg: string
  7026. }
  7027. interface MakeBluetoothPairOption {
  7028. /** 蓝牙设备 id */
  7029. deviceId: string
  7030. /** pin 码,Base64 格式。 */
  7031. pin: string
  7032. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7033. complete?: MakeBluetoothPairCompleteCallback
  7034. /** 接口调用失败的回调函数 */
  7035. fail?: MakeBluetoothPairFailCallback
  7036. /** 接口调用成功的回调函数 */
  7037. success?: MakeBluetoothPairSuccessCallback
  7038. /** 超时时间,单位 ms */
  7039. timeout?: number
  7040. }
  7041. interface MakePhoneCallOption {
  7042. /** 需要拨打的电话号码 */
  7043. phoneNumber: string
  7044. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7045. complete?: MakePhoneCallCompleteCallback
  7046. /** 接口调用失败的回调函数 */
  7047. fail?: MakePhoneCallFailCallback
  7048. /** 接口调用成功的回调函数 */
  7049. success?: MakePhoneCallSuccessCallback
  7050. }
  7051. /** 广播的制造商信息。仅安卓支持,iOS 因系统限制无法定制。 */
  7052. interface ManufacturerData {
  7053. /** 制造商ID,0x 开头的十六进制 */
  7054. manufacturerId: string
  7055. /** 制造商信息 */
  7056. manufacturerSpecificData?: ArrayBuffer
  7057. }
  7058. /** 图片覆盖的经纬度范围 */
  7059. interface MapBounds {
  7060. /** 东北角经纬度 */
  7061. northeast: MapPostion
  7062. /** 西南角经纬度 */
  7063. southwest: MapPostion
  7064. }
  7065. interface MapPostion {
  7066. /** 纬度 */
  7067. latitude: number
  7068. /** 经度 */
  7069. longitude: number
  7070. }
  7071. /** 用来扩展(或收缩)参照节点布局区域的边界 */
  7072. interface Margins {
  7073. /** 节点布局区域的下边界 */
  7074. bottom?: number
  7075. /** 节点布局区域的左边界 */
  7076. left?: number
  7077. /** 节点布局区域的右边界 */
  7078. right?: number
  7079. /** 节点布局区域的上边界 */
  7080. top?: number
  7081. }
  7082. /** 匹配到的缓存 */
  7083. interface MatchCache {
  7084. /** 缓存 id */
  7085. cacheId: string
  7086. /** 缓存创建时间 */
  7087. createTime: number
  7088. /** 缓存内容,会带有 fromCache 标记,方便开发者区分内容是否来自缓存 */
  7089. data: any
  7090. /** 缓存有效时间 */
  7091. maxAge: number
  7092. /** 命中的规则 id */
  7093. ruleId: string
  7094. }
  7095. /** MediaAudioPlayer 实例,可通过 [wx.createMediaAudioPlayer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createMediaAudioPlayer.html) 接口获取实例。 */
  7096. interface MediaAudioPlayer {
  7097. /** 音量。范围 0~1。默认为 1 */
  7098. volume: number
  7099. /** [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)
  7100. *
  7101. * 在插件中使用:支持
  7102. *
  7103. * 添加音频源 */
  7104. addAudioSource(
  7105. /** [VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html)
  7106. *
  7107. * 视频解码器实例。作为音频源添加到音频播放器中 */
  7108. source: VideoDecoder
  7109. ): Promise<any>
  7110. /** [Promise MediaAudioPlayer.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.destroy.html)
  7111. *
  7112. * 在插件中使用:支持
  7113. *
  7114. * 销毁播放器 */
  7115. destroy(): Promise<any>
  7116. /** [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)
  7117. *
  7118. * 在插件中使用:支持
  7119. *
  7120. * 移除音频源 */
  7121. removeAudioSource(
  7122. /** [VideoDecoder](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.html)
  7123. *
  7124. * 视频解码器实例 */
  7125. source: VideoDecoder
  7126. ): Promise<any>
  7127. /** [Promise MediaAudioPlayer.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.start.html)
  7128. *
  7129. * 在插件中使用:支持
  7130. *
  7131. * 启动播放器 */
  7132. start(): Promise<any>
  7133. /** [Promise MediaAudioPlayer.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/MediaAudioPlayer.stop.html)
  7134. *
  7135. * 在插件中使用:支持
  7136. *
  7137. * 停止播放器 */
  7138. stop(): Promise<any>
  7139. }
  7140. /** 本地临时文件列表 */
  7141. interface MediaFile {
  7142. /** 视频的时间长度 */
  7143. duration: number
  7144. /** 文件类型
  7145. *
  7146. * 可选值:
  7147. * - 'image': 图片;
  7148. * - 'video': 视频; */
  7149. fileType: 'image' | 'video'
  7150. /** 视频的高度 */
  7151. height: number
  7152. /** 本地临时文件大小,单位 B */
  7153. size: number
  7154. /** 本地临时文件路径 (本地路径) */
  7155. tempFilePath: string
  7156. /** 视频缩略图临时文件路径 */
  7157. thumbTempFilePath: string
  7158. /** 视频的宽度 */
  7159. width: number
  7160. }
  7161. interface MediaQueryObserverObserveCallbackResult {
  7162. /** 页面的当前状态是否满足所指定的 media query */
  7163. matches: boolean
  7164. }
  7165. /** 需要预览的资源列表 */
  7166. interface MediaSource {
  7167. /** 图片或视频的地址 */
  7168. url: string
  7169. /** 视频的封面图片 */
  7170. poster?: string
  7171. /** 资源的类型,默认为图片
  7172. *
  7173. * 可选值:
  7174. * - 'image': 图片;
  7175. * - 'video': 视频; */
  7176. type?: 'image' | 'video'
  7177. }
  7178. /** 需要基础库: `2.9.0`
  7179. *
  7180. * 可通过 [MediaContainer.extractDataSource](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.extractDataSource.html) 返回。
  7181. *
  7182. * [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html) 音频或视频轨道,可以对轨道进行一些操作 */
  7183. interface MediaTrack {
  7184. /** 轨道长度,只读 */
  7185. duration: number
  7186. /** 轨道类型,只读
  7187. *
  7188. * 可选值:
  7189. * - 'audio': 音频轨道;
  7190. * - 'video': 视频轨道; */
  7191. kind: 'audio' | 'video'
  7192. /** 音量,音频轨道下有效,可写 */
  7193. volume: number
  7194. }
  7195. /** 小程序账号信息 */
  7196. interface MiniProgram {
  7197. /** 小程序 appId */
  7198. appId: string
  7199. /** 需要基础库: `2.10.0`
  7200. *
  7201. * 小程序版本
  7202. *
  7203. * 可选值:
  7204. * - 'develop': 开发版;
  7205. * - 'trial': 体验版;
  7206. * - 'release': 正式版; */
  7207. envVersion: 'develop' | 'trial' | 'release'
  7208. /** 需要基础库: `2.10.2`
  7209. *
  7210. * 线上小程序版本号 */
  7211. version: string
  7212. }
  7213. interface MkdirOption {
  7214. /** 创建的目录路径 (本地路径) */
  7215. dirPath: string
  7216. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7217. complete?: MkdirCompleteCallback
  7218. /** 接口调用失败的回调函数 */
  7219. fail?: MkdirFailCallback
  7220. /** 需要基础库: `2.3.0`
  7221. *
  7222. * 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。 */
  7223. recursive?: boolean
  7224. /** 接口调用成功的回调函数 */
  7225. success?: MkdirSuccessCallback
  7226. }
  7227. interface MoveAlongOption {
  7228. /** 平滑移动的时间 */
  7229. duration: number
  7230. /** 指定 marker */
  7231. markerId: number
  7232. /** 移动路径的坐标串,坐标点格式 `{longitude, latitude}` */
  7233. path: any[]
  7234. /** 平滑移动触发 map 组件 interpolatepoint 事件的插值精度,单位为 m。默认不触发。 */
  7235. precision: IAnyObject
  7236. /** 根据路径方向自动改变 marker 的旋转角度 */
  7237. autoRotate?: boolean
  7238. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7239. complete?: MoveAlongCompleteCallback
  7240. /** 接口调用失败的回调函数 */
  7241. fail?: MoveAlongFailCallback
  7242. /** 接口调用成功的回调函数 */
  7243. success?: MoveAlongSuccessCallback
  7244. }
  7245. interface MoveToLocationOption {
  7246. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7247. complete?: MoveToLocationCompleteCallback
  7248. /** 接口调用失败的回调函数 */
  7249. fail?: MoveToLocationFailCallback
  7250. /** 需要基础库: `2.8.0`
  7251. *
  7252. * 纬度 */
  7253. latitude?: number
  7254. /** 需要基础库: `2.8.0`
  7255. *
  7256. * 经度 */
  7257. longitude?: number
  7258. /** 接口调用成功的回调函数 */
  7259. success?: MoveToLocationSuccessCallback
  7260. }
  7261. /** 静音设置 */
  7262. interface MuteConfig {
  7263. /** 是否静音耳机 */
  7264. muteEarphone?: boolean
  7265. /** 是否静音麦克风 */
  7266. muteMicrophone?: boolean
  7267. }
  7268. interface MuteOption {
  7269. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7270. complete?: MuteCompleteCallback
  7271. /** 接口调用失败的回调函数 */
  7272. fail?: MuteFailCallback
  7273. /** 接口调用成功的回调函数 */
  7274. success?: MuteSuccessCallback
  7275. }
  7276. /** 需要基础库: `2.11.2` */
  7277. interface NFCAdapter {
  7278. /** 标签类型枚举 */
  7279. tech: TechType
  7280. /** [NFCAdapter.offDiscovered(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.offDiscovered.html)
  7281. *
  7282. * 需要基础库: `2.11.2`
  7283. *
  7284. * 在插件中使用:支持
  7285. *
  7286. * 移除 NFC Tag的监听函数
  7287. *
  7288. * **示例代码**
  7289. *
  7290. * ```js
  7291. const listener = function (res) { console.log(res) }
  7292. NFCAdapter.onDiscovered(listener)
  7293. NFCAdapter.offDiscovered(listener) // 需传入与监听时同一个的函数对象
  7294. ``` */
  7295. offDiscovered(
  7296. /** onDiscovered 传入的监听函数。不传此参数则移除所有监听函数。 */
  7297. listener?: OffDiscoveredCallback
  7298. ): void
  7299. /** [NFCAdapter.onDiscovered(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.onDiscovered.html)
  7300. *
  7301. * 需要基础库: `2.11.2`
  7302. *
  7303. * 在插件中使用:支持
  7304. *
  7305. * 监听 NFC Tag */
  7306. onDiscovered(
  7307. /** 的监听函数 */
  7308. listener: OnDiscoveredCallback
  7309. ): void
  7310. /** [NFCAdapter.startDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.startDiscovery.html)
  7311. *
  7312. * 需要基础库: `2.11.2`
  7313. *
  7314. * 在插件中使用:支持 */
  7315. startDiscovery(option?: StartDiscoveryOption): void
  7316. /** [NFCAdapter.stopDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NFCAdapter.stopDiscovery.html)
  7317. *
  7318. * 需要基础库: `2.11.2`
  7319. *
  7320. * 在插件中使用:支持 */
  7321. stopDiscovery(option?: StopDiscoveryOption): void
  7322. /** [[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)
  7323. *
  7324. * 需要基础库: `2.11.2`
  7325. *
  7326. * 在插件中使用:支持
  7327. *
  7328. * 获取IsoDep实例,实例支持ISO-DEP (ISO 14443-4)标准的读写 */
  7329. getIsoDep(): IsoDep
  7330. /** [[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)
  7331. *
  7332. * 需要基础库: `2.11.2`
  7333. *
  7334. * 在插件中使用:支持
  7335. *
  7336. * 获取MifareClassic实例,实例支持MIFARE Classic标签的读写 */
  7337. getMifareClassic(): MifareClassic
  7338. /** [[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)
  7339. *
  7340. * 需要基础库: `2.11.2`
  7341. *
  7342. * 在插件中使用:支持
  7343. *
  7344. * 获取MifareUltralight实例,实例支持MIFARE Ultralight标签的读写 */
  7345. getMifareUltralight(): MifareUltralight
  7346. /** [[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)
  7347. *
  7348. * 需要基础库: `2.11.2`
  7349. *
  7350. * 在插件中使用:支持
  7351. *
  7352. * 获取Ndef实例,实例支持对NDEF格式的NFC标签上的NDEF数据的读写 */
  7353. getNdef(): Ndef
  7354. /** [[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)
  7355. *
  7356. * 需要基础库: `2.11.2`
  7357. *
  7358. * 在插件中使用:支持
  7359. *
  7360. * 获取NfcA实例,实例支持NFC-A (ISO 14443-3A)标准的读写 */
  7361. getNfcA(): NfcA
  7362. /** [[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)
  7363. *
  7364. * 需要基础库: `2.11.2`
  7365. *
  7366. * 在插件中使用:支持
  7367. *
  7368. * 获取NfcB实例,实例支持NFC-B (ISO 14443-3B)标准的读写 */
  7369. getNfcB(): NfcB
  7370. /** [[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)
  7371. *
  7372. * 需要基础库: `2.11.2`
  7373. *
  7374. * 在插件中使用:支持
  7375. *
  7376. * 获取NfcF实例,实例支持NFC-F (JIS 6319-4)标准的读写 */
  7377. getNfcF(): NfcF
  7378. /** [[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)
  7379. *
  7380. * 需要基础库: `2.11.2`
  7381. *
  7382. * 在插件中使用:支持
  7383. *
  7384. * 获取NfcV实例,实例支持NFC-V (ISO 15693)标准的读写 */
  7385. getNfcV(): NfcV
  7386. }
  7387. interface NavigateBackMiniProgramOption {
  7388. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7389. complete?: NavigateBackMiniProgramCompleteCallback
  7390. /** 需要返回给上一个小程序的数据,上一个小程序可在 `App.onShow` 中获取到这份数据。 [详情](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html)。 */
  7391. extraData?: IAnyObject
  7392. /** 接口调用失败的回调函数 */
  7393. fail?: NavigateBackMiniProgramFailCallback
  7394. /** 接口调用成功的回调函数 */
  7395. success?: NavigateBackMiniProgramSuccessCallback
  7396. }
  7397. interface NavigateBackOption {
  7398. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7399. complete?: NavigateBackCompleteCallback
  7400. /** 返回的页面数,如果 delta 大于现有页面数,则返回到首页。 */
  7401. delta?: number
  7402. /** 接口调用失败的回调函数 */
  7403. fail?: NavigateBackFailCallback
  7404. /** 接口调用成功的回调函数 */
  7405. success?: NavigateBackSuccessCallback
  7406. }
  7407. interface NavigateToMiniProgramOption {
  7408. /** 要打开的小程序 appId */
  7409. appId?: string
  7410. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7411. complete?: NavigateToMiniProgramCompleteCallback
  7412. /** 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版。
  7413. *
  7414. * 可选值:
  7415. * - 'develop': 开发版;
  7416. * - 'trial': 体验版;
  7417. * - 'release': 正式版; */
  7418. envVersion?: 'develop' | 'trial' | 'release'
  7419. /** 需要传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据。如果跳转的是小游戏,可以在 [wx.onShow](#)、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到这份数据数据。 */
  7420. extraData?: IAnyObject
  7421. /** 接口调用失败的回调函数 */
  7422. fail?: NavigateToMiniProgramFailCallback
  7423. /** 需要基础库: `2.24.0`
  7424. *
  7425. * 不reLaunch目标小程序,直接打开目标跳转的小程序退后台时的页面,需满足以下条件:1. 目标跳转的小程序生命周期未被销毁;2. 且目标当次启动的path、query与上次启动相同,apiCategory以wx.getApiCategory接口的返回结果为准。 */
  7426. noRelaunchIfPathUnchanged?: boolean
  7427. /** 打开的页面路径,如果为空则打开首页。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"。 */
  7428. path?: string
  7429. /** 需要基础库: `2.18.1`
  7430. *
  7431. * 小程序链接,当传递该参数后,可以不传 appId 和 path。链接可以通过【小程序菜单】->【复制链接】获取。 */
  7432. shortLink?: string
  7433. /** 接口调用成功的回调函数 */
  7434. success?: NavigateToMiniProgramSuccessCallback
  7435. }
  7436. interface NavigateToOption {
  7437. /** 需要跳转的应用内非 tabBar 的页面的路径 (代码包路径), 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' */
  7438. url: string
  7439. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7440. complete?: NavigateToCompleteCallback
  7441. /** 页面间通信接口,用于监听被打开页面发送到当前页面的数据。基础库 2.7.3 开始支持。 */
  7442. events?: IAnyObject
  7443. /** 接口调用失败的回调函数 */
  7444. fail?: NavigateToFailCallback
  7445. /** 2.29.2 自定义路由类型,相关文档 [自定义路由](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/custom-route.html) */
  7446. routeType?: string
  7447. /** 接口调用成功的回调函数 */
  7448. success?: NavigateToSuccessCallback
  7449. }
  7450. interface NavigateToSuccessCallbackResult {
  7451. /** [EventChannel](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.html)
  7452. *
  7453. * 和被打开页面进行通信 */
  7454. eventChannel: EventChannel
  7455. errMsg: string
  7456. }
  7457. interface NdefCloseOption {
  7458. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7459. complete?: NdefCloseCompleteCallback
  7460. /** 接口调用失败的回调函数 */
  7461. fail?: NdefCloseFailCallback
  7462. /** 接口调用成功的回调函数 */
  7463. success?: NdefCloseSuccessCallback
  7464. }
  7465. interface NdefConnectOption {
  7466. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7467. complete?: ConnectCompleteCallback
  7468. /** 接口调用失败的回调函数 */
  7469. fail?: ConnectFailCallback
  7470. /** 接口调用成功的回调函数 */
  7471. success?: ConnectSuccessCallback
  7472. }
  7473. interface NodeCallbackResult {
  7474. /** 节点对应的 Node 实例 */
  7475. node: IAnyObject
  7476. }
  7477. interface NotifyBLECharacteristicValueChangeOption {
  7478. /** 蓝牙特征的 UUID */
  7479. characteristicId: string
  7480. /** 蓝牙设备 id */
  7481. deviceId: string
  7482. /** 蓝牙特征对应服务的 UUID */
  7483. serviceId: string
  7484. /** 是否启用 notify */
  7485. state: boolean
  7486. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7487. complete?: NotifyBLECharacteristicValueChangeCompleteCallback
  7488. /** 接口调用失败的回调函数 */
  7489. fail?: NotifyBLECharacteristicValueChangeFailCallback
  7490. /** 接口调用成功的回调函数 */
  7491. success?: NotifyBLECharacteristicValueChangeSuccessCallback
  7492. /** 需要基础库: `2.4.0`
  7493. *
  7494. * 设置特征订阅类型,有效值有 `notification` 和 `indication` */
  7495. type?: string
  7496. }
  7497. /** 需要基础库: `2.27.0`
  7498. *
  7499. * OCR检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/ocr.html)。 */
  7500. interface OCRTrack {
  7501. /** 需要基础库: `2.27.0`
  7502. *
  7503. * OCR检测模式
  7504. *
  7505. * 可选值:
  7506. * - 1: 通过摄像头实时检测;
  7507. * - 2: 静态图片检测; */
  7508. mode: 1 | 2
  7509. }
  7510. /** media query 描述符 */
  7511. interface ObserveDescriptor {
  7512. /** 页面高度( px 为单位) */
  7513. height: number
  7514. /** 页面最大高度( px 为单位) */
  7515. maxHeight: number
  7516. /** 页面最大宽度( px 为单位) */
  7517. maxWidth: number
  7518. /** 页面最小高度( px 为单位) */
  7519. minHeight: number
  7520. /** 页面最小宽度( px 为单位) */
  7521. minWidth: number
  7522. /** 屏幕方向( `landscape` 或 `portrait` ) */
  7523. orientation: string
  7524. /** 页面宽度( px 为单位) */
  7525. width: number
  7526. }
  7527. /** 设置 type 监听单个类型的指标,设置 entryTypes 监听多个类型指标。 */
  7528. interface ObserveOption {
  7529. /** 指标类型列表。不能和 type 同时使用。 */
  7530. entryTypes?: string[]
  7531. /** 指标类型。不能和 entryTypes 同时使用
  7532. *
  7533. * 可选值:
  7534. * - 'navigation': 路由;
  7535. * - 'render': 渲染;
  7536. * - 'script': 脚本; */
  7537. type?: 'navigation' | 'render' | 'script'
  7538. }
  7539. /** 需要基础库: `2.7.0`
  7540. *
  7541. * 离屏 canvas 实例,可通过 [wx.createOffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html) 创建。 */
  7542. interface OffscreenCanvas {
  7543. /** 画布高度 */
  7544. height: number
  7545. /** 画布宽度 */
  7546. width: number
  7547. /** [[Image](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Image.html) OffscreenCanvas.createImage()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.createImage.html)
  7548. *
  7549. * 需要基础库: `2.7.3`
  7550. *
  7551. * 在插件中使用:需要基础库 `2.16.1`
  7552. *
  7553. * 创建一个图片对象。支持在 2D Canvas 和 WebGL Canvas 下使用, 但不支持混用 2D 和 WebGL 的方法。
  7554. *
  7555. * ****
  7556. *
  7557. * 注意不允许混用 webgl 和 2d 画布创建的图片对象,使用时请注意尽量使用 canvas 自身的 `createImage` 创建图片对象。 */
  7558. createImage(): Image
  7559. /** [[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)
  7560. *
  7561. * 需要基础库: `2.7.0`
  7562. *
  7563. * 在插件中使用:需要基础库 `2.16.1`
  7564. *
  7565. * 该方法返回 OffscreenCanvas 的绘图上下文
  7566. *
  7567. * ****
  7568. *
  7569. * 注意不允许混用 webgl 和 2d 绘图上下文,传入的 contextType 必须要与 `wx.createOffscreenCanvas` 传入的 type 类型一致。 */
  7570. getContext(
  7571. /** 绘图上下文类型,需要与 createOffscreenCanvas 时传入的 type 一致
  7572. *
  7573. * 参数 contextType 可选值:
  7574. * - 'webgl': webgl类型上下文;
  7575. * - '2d': 2d类型上下文; */
  7576. contextType: 'webgl' | '2d'
  7577. ): any
  7578. }
  7579. interface OnAccelerometerChangeListenerResult {
  7580. /** X 轴 */
  7581. x: number
  7582. /** Y 轴 */
  7583. y: number
  7584. /** Z 轴 */
  7585. z: number
  7586. }
  7587. interface OnApiCategoryChangeListenerResult {
  7588. /** API 类别
  7589. *
  7590. * 可选值:
  7591. * - 'default': 默认类别;
  7592. * - 'nativeFunctionalized': 原生功能化,视频号直播商品、商品橱窗等场景打开的小程序;
  7593. * - 'browseOnly': 仅浏览,朋友圈快照页等场景打开的小程序;
  7594. * - 'embedded': 内嵌,通过打开半屏小程序能力打开的小程序; */
  7595. apiCategory:
  7596. | 'default'
  7597. | 'nativeFunctionalized'
  7598. | 'browseOnly'
  7599. | 'embedded'
  7600. }
  7601. interface OnBLECharacteristicValueChangeListenerResult {
  7602. /** 蓝牙特征的 UUID */
  7603. characteristicId: string
  7604. /** 蓝牙设备 id */
  7605. deviceId: string
  7606. /** 蓝牙特征对应服务的 UUID */
  7607. serviceId: string
  7608. /** 特征最新的值 */
  7609. value: ArrayBuffer
  7610. }
  7611. interface OnBLEConnectionStateChangeListenerResult {
  7612. /** 是否处于已连接状态 */
  7613. connected: boolean
  7614. /** 蓝牙设备 id */
  7615. deviceId: string
  7616. }
  7617. interface OnBLEMTUChangeListenerResult {
  7618. /** 蓝牙设备 id */
  7619. deviceId: string
  7620. /** 最大传输单元 */
  7621. mtu: number
  7622. }
  7623. interface OnBLEPeripheralConnectionStateChangedListenerResult {
  7624. /** 连接目前状态 */
  7625. connected: boolean
  7626. /** 连接状态变化的设备 id */
  7627. deviceId: string
  7628. /** server 的 UUID */
  7629. serverId: string
  7630. }
  7631. interface OnBackgroundFetchDataListenerResult {
  7632. /** 缓存数据类别,取值为 periodic 或 pre */
  7633. fetchType: string
  7634. /** 缓存数据 */
  7635. fetchedData: string
  7636. /** 小程序页面路径 */
  7637. path: string
  7638. /** 传给页面的 query 参数 */
  7639. query: string
  7640. /** 进入小程序的场景值 */
  7641. scene: number
  7642. /** 客户端拿到缓存数据的时间戳 */
  7643. timeStamp: number
  7644. }
  7645. interface OnBeaconServiceChangeListenerResult {
  7646. /** 服务目前是否可用 */
  7647. available: boolean
  7648. /** 目前是否处于搜索状态 */
  7649. discovering: boolean
  7650. }
  7651. interface OnBeaconUpdateListenerResult {
  7652. /** 当前搜寻到的所有 Beacon 设备列表 */
  7653. beacons: BeaconInfo[]
  7654. }
  7655. interface OnBluetoothAdapterStateChangeListenerResult {
  7656. /** 蓝牙适配器是否可用 */
  7657. available: boolean
  7658. /** 蓝牙适配器是否处于搜索状态 */
  7659. discovering: boolean
  7660. }
  7661. interface OnBluetoothDeviceFoundListenerResult {
  7662. /** 新搜索到的设备列表 */
  7663. devices: BlueToothDevice[]
  7664. }
  7665. interface OnCameraFrameCallbackResult {
  7666. /** 图像像素点数据,一维数组,每四项表示一个像素点的 rgba */
  7667. data: ArrayBuffer
  7668. /** 图像数据矩形的高度 */
  7669. height: number
  7670. /** 图像数据矩形的宽度 */
  7671. width: number
  7672. }
  7673. interface OnCharacteristicReadRequestListenerResult {
  7674. /** 唯一标识码,调用 [writeCharacteristicValue](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html) 时使用 */
  7675. callbackId: number
  7676. /** 蓝牙特征的 UUID */
  7677. characteristicId: string
  7678. /** 蓝牙特征对应服务的 UUID */
  7679. serviceId: string
  7680. }
  7681. interface OnCharacteristicSubscribedListenerResult {
  7682. /** 蓝牙特征的 UUID */
  7683. characteristicId: string
  7684. /** 蓝牙特征对应服务的 UUID */
  7685. serviceId: string
  7686. }
  7687. interface OnCharacteristicWriteRequestListenerResult {
  7688. /** 唯一标识码,调用 [writeCharacteristicValue](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html) 时使用 */
  7689. callbackId: number
  7690. /** 蓝牙特征的 UUID */
  7691. characteristicId: string
  7692. /** 蓝牙特征对应服务的 UUID */
  7693. serviceId: string
  7694. /** 请求写入特征的二进制数据值 */
  7695. value: ArrayBuffer
  7696. }
  7697. interface OnCheckForUpdateListenerResult {
  7698. /** 是否有新版本 */
  7699. hasUpdate: boolean
  7700. }
  7701. interface OnChunkReceivedListenerResult {
  7702. /** 返回的chunk buffer */
  7703. data: ArrayBuffer
  7704. }
  7705. interface OnCompassChangeListenerResult {
  7706. /** 需要基础库: `2.4.0`
  7707. *
  7708. * 精度 */
  7709. accuracy: number | string
  7710. /** 面对的方向度数 */
  7711. direction: number
  7712. }
  7713. interface OnCopyUrlListenerResult {
  7714. /** 用短链打开小程序时当前页面携带的查询字符串。小程序中使用时,应在进入页面时调用 `wx.onCopyUrl` 自定义 `query`,退出页面时调用 `wx.offCopyUrl`,防止影响其它页面。 */
  7715. query: string
  7716. }
  7717. interface OnCustomRendererEventCallbackResult {
  7718. /** 推流高度 */
  7719. height: number
  7720. /** 推流宽度 */
  7721. width: number
  7722. }
  7723. interface OnDeviceMotionChangeListenerResult {
  7724. /** 当 手机坐标 X/Y 和 地球 X/Y 重合时,绕着 Z 轴转动的夹角为 alpha,范围值为 [0, 2*PI)。逆时针转动为正。 */
  7725. alpha: number
  7726. /** 当手机坐标 Y/Z 和地球 Y/Z 重合时,绕着 X 轴转动的夹角为 beta。范围值为 [-1*PI, PI) 。顶部朝着地球表面转动为正。也有可能朝着用户为正。 */
  7727. beta: number
  7728. /** 当手机 X/Z 和地球 X/Z 重合时,绕着 Y 轴转动的夹角为 gamma。范围值为 [-1*PI/2, PI/2)。右边朝着地球表面转动为正。 */
  7729. gamma: number
  7730. }
  7731. interface OnDiscoveredListenerResult {
  7732. id: ArrayBuffer
  7733. /** 可选,NdefMessage 数组,消息格式为 {id: ArrayBuffer, type: ArrayBuffer, payload: ArrayBuffer} */
  7734. messages: any[]
  7735. /** tech 数组,用于匹配NFC卡片具体可以使用什么标准(NfcA等实例)处理 */
  7736. techs: any[]
  7737. }
  7738. interface OnEmbeddedMiniProgramHeightChangeListenerResult {
  7739. /** 可视高度 */
  7740. height: number
  7741. /** 半屏小程序初始高度 */
  7742. initialHeight: number
  7743. }
  7744. interface OnFrameRecordedListenerResult {
  7745. /** 录音分片数据 */
  7746. frameBuffer: ArrayBuffer
  7747. /** 当前帧是否正常录音结束前的最后一帧 */
  7748. isLastFrame: boolean
  7749. }
  7750. interface OnGetWifiListListenerResult {
  7751. /** Wi-Fi 列表数据 */
  7752. wifiList: WifiInfo[]
  7753. }
  7754. interface OnGyroscopeChangeListenerResult {
  7755. /** x 轴的角速度 */
  7756. x: number
  7757. /** y 轴的角速度 */
  7758. y: number
  7759. /** z 轴的角速度 */
  7760. z: number
  7761. }
  7762. interface OnHCEMessageListenerResult {
  7763. /** `messageType=1` 时 ,客户端接收到 NFC 设备的指令 */
  7764. data: ArrayBuffer
  7765. /** 消息类型
  7766. *
  7767. * 可选值:
  7768. * - 1: HCE APDU Command类型,小程序需对此指令进行处理,并调用 sendHCEMessage 接口返回处理指令;
  7769. * - 2: 设备离场事件类型; */
  7770. messageType: 1 | 2
  7771. /** `messageType=2` 时,原因 */
  7772. reason: number
  7773. }
  7774. interface OnKeyboardHeightChangeListenerResult {
  7775. /** 键盘高度 */
  7776. height: number
  7777. }
  7778. interface OnLazyLoadErrorListenerResult {
  7779. /** 详细信息 */
  7780. errMsg: string
  7781. /** 异步组件所属的分包 */
  7782. subpackage: any[]
  7783. /** 'subpackage' 失败类型 */
  7784. type: string
  7785. }
  7786. interface OnLocalServiceFoundListenerResult {
  7787. /** 服务的 ip 地址 */
  7788. ip: string
  7789. /** 服务的端口 */
  7790. port: number
  7791. /** 服务的名称 */
  7792. serviceName: string
  7793. /** 服务的类型 */
  7794. serviceType: string
  7795. }
  7796. interface OnLocalServiceLostListenerResult {
  7797. /** 服务的名称 */
  7798. serviceName: string
  7799. /** 服务的类型 */
  7800. serviceType: string
  7801. }
  7802. interface OnLocationChangeErrorListenerResult {
  7803. /** 错误码 */
  7804. errCode: number
  7805. }
  7806. interface OnLocationChangeListenerResult {
  7807. /** 位置的精确度 */
  7808. accuracy: number
  7809. /** 需要基础库: `1.2.0`
  7810. *
  7811. * 高度,单位 m */
  7812. altitude: number
  7813. /** 需要基础库: `1.2.0`
  7814. *
  7815. * 水平精度,单位 m */
  7816. horizontalAccuracy: number
  7817. /** 纬度,范围为 -90~90,负数表示南纬。使用 gcj02 国测局坐标系 */
  7818. latitude: number
  7819. /** 经度,范围为 -180~180,负数表示西经。使用 gcj02 国测局坐标系 */
  7820. longitude: number
  7821. /** 速度,单位 m/s */
  7822. speed: number
  7823. /** 需要基础库: `1.2.0`
  7824. *
  7825. * 垂直精度,单位 m(Android 无法获取,返回 0) */
  7826. verticalAccuracy: number
  7827. }
  7828. interface OnMemoryWarningListenerResult {
  7829. /** 内存告警等级,只有 Android 才有,对应系统宏定义
  7830. *
  7831. * 可选值:
  7832. * - 5: TRIM_MEMORY_RUNNING_MODERATE;
  7833. * - 10: TRIM_MEMORY_RUNNING_LOW;
  7834. * - 15: TRIM_MEMORY_RUNNING_CRITICAL; */
  7835. level: 5 | 10 | 15
  7836. }
  7837. interface OnNetworkStatusChangeListenerResult {
  7838. /** 当前是否有网络连接 */
  7839. isConnected: boolean
  7840. /** 网络类型
  7841. *
  7842. * 可选值:
  7843. * - 'wifi': wifi 网络;
  7844. * - '2g': 2g 网络;
  7845. * - '3g': 3g 网络;
  7846. * - '4g': 4g 网络;
  7847. * - '5g': 5g 网络;
  7848. * - 'unknown': Android 下不常见的网络类型;
  7849. * - 'none': 无网络; */
  7850. networkType: 'wifi' | '2g' | '3g' | '4g' | '5g' | 'unknown' | 'none'
  7851. }
  7852. interface OnNetworkWeakChangeListenerResult {
  7853. /** 当前网络类型 */
  7854. networkType: string
  7855. /** 当前是否处于弱网状态 */
  7856. weakNet: boolean
  7857. }
  7858. interface OnOpenListenerResult {
  7859. /** 需要基础库: `2.0.0`
  7860. *
  7861. * 连接成功的 HTTP 响应 Header */
  7862. header: IAnyObject
  7863. /** 需要基础库: `2.10.4`
  7864. *
  7865. * 网络请求过程中一些调试信息 */
  7866. profile: SocketProfile
  7867. }
  7868. interface OnPageNotFoundListenerResult {
  7869. /** 是否本次启动的首个页面(例如从分享等入口进来,首个页面是开发者配置的分享页面) */
  7870. isEntryPage: boolean
  7871. /** 不存在页面的路径 (代码包路径) */
  7872. path: string
  7873. /** 打开不存在页面的 query 参数 */
  7874. query: Record<string, string>
  7875. }
  7876. interface OnScreenRecordingStateChangedListenerResult {
  7877. /** 录屏状态
  7878. *
  7879. * 可选值:
  7880. * - 'start': 开始录屏;
  7881. * - 'stop': 结束录屏; */
  7882. state: 'start' | 'stop'
  7883. }
  7884. interface OnSocketOpenListenerResult {
  7885. /** 需要基础库: `2.0.0`
  7886. *
  7887. * 连接成功的 HTTP 响应 Header */
  7888. header: IAnyObject
  7889. }
  7890. interface OnStopListenerResult {
  7891. /** 录音总时长,单位:ms */
  7892. duration: number
  7893. /** 录音文件大小,单位:Byte */
  7894. fileSize: number
  7895. /** 录音文件的临时路径 (本地路径) */
  7896. tempFilePath: string
  7897. }
  7898. interface OnThemeChangeListenerResult {
  7899. /** 系统当前的主题,取值为`light`或`dark`
  7900. *
  7901. * 可选值:
  7902. * - 'dark': 深色主题;
  7903. * - 'light': 浅色主题; */
  7904. theme: 'dark' | 'light'
  7905. }
  7906. interface OnUnhandledRejectionListenerResult {
  7907. /** 被拒绝的 Promise 对象 */
  7908. promise: Promise<any>
  7909. /** 拒绝原因,一般是一个 Error 对象 */
  7910. reason: string
  7911. }
  7912. interface OnVoIPChatInterruptedListenerResult {
  7913. /** 错误码 */
  7914. errCode: number
  7915. /** 调用结果(错误原因) */
  7916. errMsg: string
  7917. }
  7918. interface OnVoIPChatMembersChangedListenerResult {
  7919. /** 错误码 */
  7920. errCode: number
  7921. /** 调用结果 */
  7922. errMsg: string
  7923. /** 还在实时语音通话中的成员 openId 名单 */
  7924. openIdList: string[]
  7925. }
  7926. interface OnVoIPChatSpeakersChangedListenerResult {
  7927. /** 错误码 */
  7928. errCode: number
  7929. /** 调用结果(错误原因) */
  7930. errMsg: string
  7931. /** 还在实时语音通话中的成员 openId 名单 */
  7932. openIdList: string[]
  7933. }
  7934. interface OnVoIPChatStateChangedListenerResult {
  7935. /** 事件码 */
  7936. code: number
  7937. /** 附加信息 */
  7938. data: IAnyObject
  7939. /** 错误码 */
  7940. errCode: number
  7941. /** 调用结果 */
  7942. errMsg: string
  7943. }
  7944. interface OnVoIPVideoMembersChangedListenerResult {
  7945. /** 错误码 */
  7946. errCode: number
  7947. /** 调用结果 */
  7948. errMsg: string
  7949. /** 开启视频的成员名单 */
  7950. openIdList: string[]
  7951. }
  7952. interface OnWifiConnectedListenerResult {
  7953. /** [WifiInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/WifiInfo.html)
  7954. *
  7955. * Wi-Fi 信息 */
  7956. wifi: WifiInfo
  7957. }
  7958. interface OnWifiConnectedWithPartialInfoListenerResult {
  7959. /** [WifiInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/WifiInfo.html)
  7960. *
  7961. * 只包含 SSID 属性的 WifiInfo 对象 */
  7962. wifi: WifiInfo
  7963. }
  7964. interface OnWindowResizeListenerResult {
  7965. size: Size
  7966. }
  7967. interface OpenAppAuthorizeSettingOption {
  7968. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7969. complete?: OpenAppAuthorizeSettingCompleteCallback
  7970. /** 接口调用失败的回调函数 */
  7971. fail?: OpenAppAuthorizeSettingFailCallback
  7972. /** 接口调用成功的回调函数 */
  7973. success?: OpenAppAuthorizeSettingSuccessCallback
  7974. }
  7975. interface OpenBluetoothAdapterOption {
  7976. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7977. complete?: OpenBluetoothAdapterCompleteCallback
  7978. /** 接口调用失败的回调函数 */
  7979. fail?: OpenBluetoothAdapterFailCallback
  7980. /** 需要基础库: `2.10.0`
  7981. *
  7982. * 蓝牙模式,可作为主/从设备,仅 iOS 需要。
  7983. *
  7984. * 可选值:
  7985. * - 'central': 主机模式;
  7986. * - 'peripheral': 从机(外围设备)模式; */
  7987. mode?: 'central' | 'peripheral'
  7988. /** 接口调用成功的回调函数 */
  7989. success?: OpenBluetoothAdapterSuccessCallback
  7990. }
  7991. interface OpenCardOption {
  7992. /** 需要打开的卡券列表 */
  7993. cardList: OpenCardRequestInfo[]
  7994. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  7995. complete?: OpenCardCompleteCallback
  7996. /** 接口调用失败的回调函数 */
  7997. fail?: OpenCardFailCallback
  7998. /** 接口调用成功的回调函数 */
  7999. success?: OpenCardSuccessCallback
  8000. }
  8001. /** 需要打开的卡券列表 */
  8002. interface OpenCardRequestInfo {
  8003. /** 卡券 ID */
  8004. cardId: string
  8005. /** 由 [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) */
  8006. code: string
  8007. }
  8008. interface OpenChannelsActivityOption {
  8009. /** 视频 feedId */
  8010. feedId: string
  8011. /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
  8012. finderUserName: string
  8013. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8014. complete?: OpenChannelsActivityCompleteCallback
  8015. /** 接口调用失败的回调函数 */
  8016. fail?: OpenChannelsActivityFailCallback
  8017. /** 接口调用成功的回调函数 */
  8018. success?: OpenChannelsActivitySuccessCallback
  8019. }
  8020. interface OpenChannelsEventOption {
  8021. /** 活动 id */
  8022. eventId: string
  8023. /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
  8024. finderUserName: string
  8025. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8026. complete?: OpenChannelsEventCompleteCallback
  8027. /** 接口调用失败的回调函数 */
  8028. fail?: OpenChannelsEventFailCallback
  8029. /** 接口调用成功的回调函数 */
  8030. success?: OpenChannelsEventSuccessCallback
  8031. }
  8032. interface OpenChannelsLiveOption {
  8033. /** 视频号 id,以“sph”开头的id,可在视频号助手获取 */
  8034. finderUserName: string
  8035. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8036. complete?: OpenChannelsLiveCompleteCallback
  8037. /** 接口调用失败的回调函数 */
  8038. fail?: OpenChannelsLiveFailCallback
  8039. /** 直播 feedId,通过 getChannelsLiveInfo 接口获取(基础库 v2.19.2 之前的版本需要填写) */
  8040. feedId?: string
  8041. /** 直播 nonceId,通过 getChannelsLiveInfo 接口获取(基础库 v2.19.2 之前的版本需要填写) */
  8042. nonceId?: string
  8043. /** 接口调用成功的回调函数 */
  8044. success?: OpenChannelsLiveSuccessCallback
  8045. }
  8046. interface OpenChannelsUserProfileOption {
  8047. /** 视频号 id */
  8048. finderUserName: string
  8049. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8050. complete?: OpenChannelsUserProfileCompleteCallback
  8051. /** 接口调用失败的回调函数 */
  8052. fail?: OpenChannelsUserProfileFailCallback
  8053. /** 接口调用成功的回调函数 */
  8054. success?: OpenChannelsUserProfileSuccessCallback
  8055. }
  8056. interface OpenCustomerServiceChatOption {
  8057. /** 企业ID */
  8058. corpId: string
  8059. /** 客服信息 */
  8060. extInfo: ExtInfoOption
  8061. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8062. complete?: OpenCustomerServiceChatCompleteCallback
  8063. /** 接口调用失败的回调函数 */
  8064. fail?: OpenCustomerServiceChatFailCallback
  8065. /** 气泡消息图片 */
  8066. sendMessageImg?: string
  8067. /** 气泡消息小程序路径 */
  8068. sendMessagePath?: string
  8069. /** 气泡消息标题 */
  8070. sendMessageTitle?: string
  8071. /** 是否发送小程序气泡消息 */
  8072. showMessageCard?: boolean
  8073. /** 接口调用成功的回调函数 */
  8074. success?: OpenCustomerServiceChatSuccessCallback
  8075. }
  8076. interface OpenDocumentOption {
  8077. /** 文件路径 (本地路径) ,可通过 downloadFile 获得 */
  8078. filePath: string
  8079. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8080. complete?: OpenDocumentCompleteCallback
  8081. /** 接口调用失败的回调函数 */
  8082. fail?: OpenDocumentFailCallback
  8083. /** 需要基础库: `1.4.0`
  8084. *
  8085. * 文件类型,指定文件类型打开文件
  8086. *
  8087. * 可选值:
  8088. * - 'doc': doc 格式;
  8089. * - 'docx': docx 格式;
  8090. * - 'xls': xls 格式;
  8091. * - 'xlsx': xlsx 格式;
  8092. * - 'ppt': ppt 格式;
  8093. * - 'pptx': pptx 格式;
  8094. * - 'pdf': pdf 格式; */
  8095. fileType?: 'doc' | 'docx' | 'xls' | 'xlsx' | 'ppt' | 'pptx' | 'pdf'
  8096. /** 需要基础库: `2.11.0`
  8097. *
  8098. * 是否显示右上角菜单 */
  8099. showMenu?: boolean
  8100. /** 接口调用成功的回调函数 */
  8101. success?: OpenDocumentSuccessCallback
  8102. }
  8103. interface OpenEmbeddedMiniProgramOption {
  8104. /** 要打开的小程序 appId */
  8105. appId: string
  8106. /** 需要基础库: `2.33.0`
  8107. *
  8108. * 打开的小程序是否支持全屏 */
  8109. allowFullScreen?: boolean
  8110. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8111. complete?: OpenEmbeddedMiniProgramCompleteCallback
  8112. /** 要打开的小程序版本。仅在当前小程序为开发版或体验版时此参数有效。如果当前小程序是正式版,则打开的小程序必定是正式版。
  8113. *
  8114. * 可选值:
  8115. * - 'develop': 开发版;
  8116. * - 'trial': 体验版;
  8117. * - 'release': 正式版; */
  8118. envVersion?: 'develop' | 'trial' | 'release'
  8119. /** 需要传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据。如果跳转的是小游戏,可以在 [wx.onShow](#)、[wx.getLaunchOptionsSync](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html) 中可以获取到这份数据数据。 */
  8120. extraData?: IAnyObject
  8121. /** 接口调用失败的回调函数 */
  8122. fail?: OpenEmbeddedMiniProgramFailCallback
  8123. /** 需要基础库: `2.24.0`
  8124. *
  8125. * 不reLaunch目标小程序,直接打开目标跳转的小程序退后台时的页面,需满足以下条件:1. 目标跳转的小程序生命周期未被销毁;2. 且目标当次启动的path、query与上次启动相同,apiCategory以wx.getApiCategory接口的返回结果为准。 */
  8126. noRelaunchIfPathUnchanged?: boolean
  8127. /** 打开的页面路径,如果为空则打开首页。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"。 */
  8128. path?: string
  8129. /** 小程序链接,当传递该参数后,可以不传 appId 和 path。链接可以通过【小程序菜单】->【复制链接】获取。仅 verify=binding 支持。 */
  8130. shortLink?: string
  8131. /** 接口调用成功的回调函数 */
  8132. success?: OpenEmbeddedMiniProgramSuccessCallback
  8133. /** 需要基础库: `2.24.3`
  8134. *
  8135. * 校验方式。
  8136. *
  8137. * 可选值:
  8138. * - 'binding': 校验小程序管理后台的绑定关系。;
  8139. * - 'unionProduct': 校验目标打开链接是否为[小程序联盟](https://developers.weixin.qq.com/doc/ministore/union/brief-introduction.html)商品。; */
  8140. verify?: 'binding' | 'unionProduct'
  8141. }
  8142. interface OpenLocationOption {
  8143. /** 纬度,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */
  8144. latitude: number
  8145. /** 经度,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */
  8146. longitude: number
  8147. /** 地址的详细说明 */
  8148. address?: string
  8149. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8150. complete?: OpenLocationCompleteCallback
  8151. /** 接口调用失败的回调函数 */
  8152. fail?: OpenLocationFailCallback
  8153. /** 位置名 */
  8154. name?: string
  8155. /** 缩放比例,范围5~18 */
  8156. scale?: number
  8157. /** 接口调用成功的回调函数 */
  8158. success?: OpenLocationSuccessCallback
  8159. }
  8160. interface OpenMapAppOption {
  8161. /** 目的地名称 */
  8162. destination: string
  8163. /** 目的地纬度 */
  8164. latitude: number
  8165. /** 目的地经度 */
  8166. longitude: number
  8167. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8168. complete?: OpenMapAppCompleteCallback
  8169. /** 接口调用失败的回调函数 */
  8170. fail?: OpenMapAppFailCallback
  8171. /** 接口调用成功的回调函数 */
  8172. success?: OpenMapAppSuccessCallback
  8173. }
  8174. interface OpenOption {
  8175. /** 文件路径 (本地路径) */
  8176. filePath: string
  8177. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8178. complete?: OpenCompleteCallback
  8179. /** 接口调用失败的回调函数 */
  8180. fail?: OpenFailCallback
  8181. /** 文件系统标志,默认值: 'r'
  8182. *
  8183. * 可选值:
  8184. * - 'a': 打开文件用于追加。 如果文件不存在,则创建该文件;
  8185. * - 'ax': 类似于 'a',但如果路径存在,则失败;
  8186. * - 'a+': 打开文件用于读取和追加。 如果文件不存在,则创建该文件;
  8187. * - 'ax+': 类似于 'a+',但如果路径存在,则失败;
  8188. * - 'as': 打开文件用于追加(在同步模式中)。 如果文件不存在,则创建该文件;
  8189. * - 'as+': 打开文件用于读取和追加(在同步模式中)。 如果文件不存在,则创建该文件;
  8190. * - 'r': 打开文件用于读取。 如果文件不存在,则会发生异常;
  8191. * - 'r+': 打开文件用于读取和写入。 如果文件不存在,则会发生异常;
  8192. * - 'w': 打开文件用于写入。 如果文件不存在则创建文件,如果文件存在则截断文件;
  8193. * - 'wx': 类似于 'w',但如果路径存在,则失败;
  8194. * - 'w+': 打开文件用于读取和写入。 如果文件不存在则创建文件,如果文件存在则截断文件;
  8195. * - 'wx+': 类似于 'w+',但如果路径存在,则失败; */
  8196. flag?:
  8197. | 'a'
  8198. | 'ax'
  8199. | 'a+'
  8200. | 'ax+'
  8201. | 'as'
  8202. | 'as+'
  8203. | 'r'
  8204. | 'r+'
  8205. | 'w'
  8206. | 'wx'
  8207. | 'w+'
  8208. | 'wx+'
  8209. /** 接口调用成功的回调函数 */
  8210. success?: OpenSuccessCallback
  8211. }
  8212. interface OpenPrivacyContractOption {
  8213. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8214. complete?: OpenPrivacyContractCompleteCallback
  8215. /** 接口调用失败的回调函数 */
  8216. fail?: OpenPrivacyContractFailCallback
  8217. /** 接口调用成功的回调函数 */
  8218. success?: OpenPrivacyContractSuccessCallback
  8219. }
  8220. interface OpenSettingOption {
  8221. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8222. complete?: OpenSettingCompleteCallback
  8223. /** 接口调用失败的回调函数 */
  8224. fail?: OpenSettingFailCallback
  8225. /** 接口调用成功的回调函数 */
  8226. success?: OpenSettingSuccessCallback
  8227. /** 需要基础库: `2.10.3`
  8228. *
  8229. * 是否同时获取用户订阅消息的订阅状态,默认不获取。注意:withSubscriptions 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。 */
  8230. withSubscriptions?: boolean
  8231. }
  8232. interface OpenSettingSuccessCallbackResult {
  8233. /** [AuthSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/AuthSetting.html)
  8234. *
  8235. * 用户授权结果 */
  8236. authSetting: AuthSetting
  8237. /** [SubscriptionsSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/SubscriptionsSetting.html)
  8238. *
  8239. * 需要基础库: `2.10.3`
  8240. *
  8241. * 用户订阅消息设置,接口参数`withSubscriptions`值为`true`时才会返回。 */
  8242. subscriptionsSetting: SubscriptionsSetting
  8243. errMsg: string
  8244. }
  8245. interface OpenSingleStickerViewOption {
  8246. /** 表情链接,可前往[表情开放平台](https://sticker.weixin.qq.com/cgi-bin/mmemoticon-bin/loginpage?t=login/index),在详情页中的「小程序跳转链接」入口复制 */
  8247. url: IAnyObject
  8248. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8249. complete?: OpenSingleStickerViewCompleteCallback
  8250. /** 接口调用失败的回调函数 */
  8251. fail?: OpenSingleStickerViewFailCallback
  8252. /** 接口调用成功的回调函数 */
  8253. success?: OpenSingleStickerViewSuccessCallback
  8254. }
  8255. interface OpenStickerIPViewOption {
  8256. /** 表情IP合辑链接,可前往[表情开放平台](https://sticker.weixin.qq.com/cgi-bin/mmemoticon-bin/loginpage?t=login/index),在详情页中的「小程序跳转链接」入口复制 */
  8257. url: IAnyObject
  8258. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8259. complete?: OpenStickerIPViewCompleteCallback
  8260. /** 接口调用失败的回调函数 */
  8261. fail?: OpenStickerIPViewFailCallback
  8262. /** 接口调用成功的回调函数 */
  8263. success?: OpenStickerIPViewSuccessCallback
  8264. }
  8265. interface OpenStickerSetViewOption {
  8266. /** 表情专辑链接,可前往[表情开放平台](https://sticker.weixin.qq.com/cgi-bin/mmemoticon-bin/loginpage?t=login/index),在详情页中的「小程序跳转链接」入口复制 */
  8267. url: IAnyObject
  8268. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8269. complete?: OpenStickerSetViewCompleteCallback
  8270. /** 接口调用失败的回调函数 */
  8271. fail?: OpenStickerSetViewFailCallback
  8272. /** 接口调用成功的回调函数 */
  8273. success?: OpenStickerSetViewSuccessCallback
  8274. }
  8275. interface OpenSuccessCallbackResult {
  8276. /** 文件描述符 */
  8277. fd: string
  8278. errMsg: string
  8279. }
  8280. interface OpenSyncOption {
  8281. /** 文件路径 (本地路径) */
  8282. filePath: string
  8283. /** 文件系统标志,默认值: 'r'
  8284. *
  8285. * 可选值:
  8286. * - 'a': 打开文件用于追加。 如果文件不存在,则创建该文件;
  8287. * - 'ax': 类似于 'a',但如果路径存在,则失败;
  8288. * - 'a+': 打开文件用于读取和追加。 如果文件不存在,则创建该文件;
  8289. * - 'ax+': 类似于 'a+',但如果路径存在,则失败;
  8290. * - 'as': 打开文件用于追加(在同步模式中)。 如果文件不存在,则创建该文件;
  8291. * - 'as+': 打开文件用于读取和追加(在同步模式中)。 如果文件不存在,则创建该文件;
  8292. * - 'r': 打开文件用于读取。 如果文件不存在,则会发生异常;
  8293. * - 'r+': 打开文件用于读取和写入。 如果文件不存在,则会发生异常;
  8294. * - 'w': 打开文件用于写入。 如果文件不存在则创建文件,如果文件存在则截断文件;
  8295. * - 'wx': 类似于 'w',但如果路径存在,则失败;
  8296. * - 'w+': 打开文件用于读取和写入。 如果文件不存在则创建文件,如果文件存在则截断文件;
  8297. * - 'wx+': 类似于 'w+',但如果路径存在,则失败; */
  8298. flag?:
  8299. | 'a'
  8300. | 'ax'
  8301. | 'a+'
  8302. | 'ax+'
  8303. | 'as'
  8304. | 'as+'
  8305. | 'r'
  8306. | 'r+'
  8307. | 'w'
  8308. | 'wx'
  8309. | 'w+'
  8310. | 'wx+'
  8311. }
  8312. interface OpenSystemBluetoothSettingOption {
  8313. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8314. complete?: OpenSystemBluetoothSettingCompleteCallback
  8315. /** 接口调用失败的回调函数 */
  8316. fail?: OpenSystemBluetoothSettingFailCallback
  8317. /** 接口调用成功的回调函数 */
  8318. success?: OpenSystemBluetoothSettingSuccessCallback
  8319. }
  8320. interface OpenVideoEditorOption {
  8321. /** 视频源的路径,只支持本地路径 */
  8322. filePath: string
  8323. /** 需要基础库: `2.16.1`
  8324. *
  8325. * 视频裁剪的最大长度 */
  8326. maxDuration: string
  8327. /** 需要基础库: `2.16.1`
  8328. *
  8329. * 视频裁剪的最小长度 */
  8330. minDuration: string
  8331. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8332. complete?: OpenVideoEditorCompleteCallback
  8333. /** 接口调用失败的回调函数 */
  8334. fail?: OpenVideoEditorFailCallback
  8335. /** 接口调用成功的回调函数 */
  8336. success?: OpenVideoEditorSuccessCallback
  8337. }
  8338. interface OpenVideoEditorSuccessCallbackResult {
  8339. /** 剪辑后生成的视频文件的时长,单位毫秒(ms) */
  8340. duration: number
  8341. /** 剪辑后生成的视频文件大小,单位字节数(byte) */
  8342. size: number
  8343. /** 编辑后生成的视频文件的临时路径 */
  8344. tempFilePath: string
  8345. /** 编辑后生成的缩略图文件的临时路径 */
  8346. tempThumbPath: string
  8347. errMsg: string
  8348. }
  8349. interface PageScrollToOption {
  8350. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8351. complete?: PageScrollToCompleteCallback
  8352. /** 滚动动画的时长,单位 ms */
  8353. duration?: number
  8354. /** 接口调用失败的回调函数 */
  8355. fail?: PageScrollToFailCallback
  8356. /** 需要基础库: `2.23.1`
  8357. *
  8358. * 偏移距离,需要和 selector 参数搭配使用,可以滚动到 selector 加偏移距离的位置,单位 px */
  8359. offsetTop?: number
  8360. /** 滚动到页面的目标位置,单位 px */
  8361. scrollTop?: number
  8362. /** 需要基础库: `2.7.3`
  8363. *
  8364. * 选择器 */
  8365. selector?: string
  8366. /** 接口调用成功的回调函数 */
  8367. success?: PageScrollToSuccessCallback
  8368. }
  8369. interface PauseBGMOption {
  8370. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8371. complete?: PauseBGMCompleteCallback
  8372. /** 接口调用失败的回调函数 */
  8373. fail?: PauseBGMFailCallback
  8374. /** 接口调用成功的回调函数 */
  8375. success?: PauseBGMSuccessCallback
  8376. }
  8377. interface PauseBackgroundAudioOption {
  8378. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8379. complete?: PauseBackgroundAudioCompleteCallback
  8380. /** 接口调用失败的回调函数 */
  8381. fail?: PauseBackgroundAudioFailCallback
  8382. /** 接口调用成功的回调函数 */
  8383. success?: PauseBackgroundAudioSuccessCallback
  8384. }
  8385. interface PauseOption {
  8386. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8387. complete?: PauseCompleteCallback
  8388. /** 接口调用失败的回调函数 */
  8389. fail?: PauseFailCallback
  8390. /** 接口调用成功的回调函数 */
  8391. success?: PauseSuccessCallback
  8392. }
  8393. interface PauseVoiceOption {
  8394. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8395. complete?: PauseVoiceCompleteCallback
  8396. /** 接口调用失败的回调函数 */
  8397. fail?: PauseVoiceFailCallback
  8398. /** 接口调用成功的回调函数 */
  8399. success?: PauseVoiceSuccessCallback
  8400. }
  8401. /** 单条性能数据。具体数据口径请参考[性能数据文档]((performance/perf_data##_1-4-%E9%80%9A%E8%BF%87-wx-getPerformance-%E5%9C%A8%E5%B0%8F%E7%A8%8B%E5%BA%8F%E5%86%85%E8%8E%B7%E5%8F%96)) */
  8402. interface PerformanceEntry {
  8403. /** 需要基础库: `2.24.0`
  8404. *
  8405. * 解析域名结束时间。仅 resourceTiming 指标有效。 */
  8406. domainLookupEnd: number
  8407. /** 需要基础库: `2.24.0`
  8408. *
  8409. * 解析域名开始时间。仅 resourceTiming 指标有效。 */
  8410. domainLookupStart: number
  8411. /** 耗时 ms。仅对于表示阶段的指标有效。 */
  8412. duration: number
  8413. /** 指标类型
  8414. *
  8415. * 可选值:
  8416. * - 'navigation': 路由;
  8417. * - 'render': 渲染;
  8418. * - 'script': 脚本; */
  8419. entryType: 'navigation' | 'render' | 'script'
  8420. /** 需要基础库: `2.21.2`
  8421. *
  8422. * 注入文件列表。仅 evaluateScript 指标有效。 */
  8423. fileList: string[]
  8424. /** 需要基础库: `2.21.2`
  8425. *
  8426. * 首次渲染参数在渲染层收到的时间。仅 firstRender 指标有效。 */
  8427. initDataRecvTime: number
  8428. /** 需要基础库: `2.21.2`
  8429. *
  8430. * 首次渲染参数从逻辑层发出的时间。仅 firstRender 指标有效。 */
  8431. initDataSendTime: number
  8432. /** 需要基础库: `2.24.0`
  8433. *
  8434. * 初始化性能条目的资源类型。仅 resourceTiming 指标有效。
  8435. *
  8436. * 可选值:
  8437. * - 'audio': 音频;
  8438. * - 'cover-image': cover-image 组件的图片;
  8439. * - 'image': 组件的图片;
  8440. * - 'open-data': 组件的图片; */
  8441. initiatorType: 'audio' | 'cover-image' | 'image' | 'open-data'
  8442. /** 分包名,主包表示为 __APP__ (2.21.2 开始)。仅 evaluateScript 指标有效。 */
  8443. moduleName: string
  8444. /** 指标名称
  8445. *
  8446. * 可选值:
  8447. * - 'appLaunch': 小程序启动耗时。(entryType: navigation);
  8448. * - 'route': 路由处理耗时。(entryType: navigation);
  8449. * - 'firstRender': 页面首次渲染耗时。(entryType: render);
  8450. * - 'firstPaint': 页面首次绘制(FP)时间点,无 duration。(iOS 不支持)(entryType: render);
  8451. * - 'firstContentfulPaint': 页面首次内容绘制(FCP)时间点,无 duration。(iOS 14.5 以下版本不支持)(entryType: render);
  8452. * - 'largestContentfulPaint': 页面最大内容绘制(LCP)时间点,无 duration。(iOS 不支持)(entryType: render);
  8453. * - 'evaluateScript': 逻辑层 JS 代码注入耗时。(entryType: script);
  8454. * - 'downloadPackage': 代码包下载耗时。(entryType: loadPackage);
  8455. * - 'resourceTiming': 视图层资源加载耗时。(entryType: resource); */
  8456. name:
  8457. | 'appLaunch'
  8458. | 'route'
  8459. | 'firstRender'
  8460. | 'firstPaint'
  8461. | 'firstContentfulPaint'
  8462. | 'largestContentfulPaint'
  8463. | 'evaluateScript'
  8464. | 'downloadPackage'
  8465. | 'resourceTiming'
  8466. /** 路由真正响应开始时间。仅 navigation 类型指标有效。 */
  8467. navigationStart: number
  8468. /** 路由详细类型,与小程序路由方法对应。仅 navigation 类型指标有效。 */
  8469. navigationType: string
  8470. /** 需要基础库: `2.24.0`
  8471. *
  8472. * 代码包名称。仅 downloadPackage 指标有效。 */
  8473. packageName: string
  8474. /** 需要基础库: `2.24.0`
  8475. *
  8476. * 代码包大小。仅 downloadPackage 指标有效。 */
  8477. packageSize: number
  8478. /** 需要基础库: `2.23.1`
  8479. *
  8480. * path 对应页面实例 Id(随机生成,不保证递增)。仅 render/navigation 指标有效。 */
  8481. pageId: number
  8482. /** 页面路径。仅 render 和 navigation 类型指标有效。 */
  8483. path: string
  8484. /** 需要基础库: `2.23.1`
  8485. *
  8486. * referrerPath对应页面实例 Id(随机生成,不保证递增)。仅 route 指标有效。 */
  8487. referrerPageId: number
  8488. /** 需要基础库: `2.23.1`
  8489. *
  8490. * 页面跳转来源页面路径。仅 route 指标有效。 */
  8491. referrerPath: number
  8492. /** 开始时间,不同指标的具体含义会有差异。 */
  8493. startTime: number
  8494. /** 需要基础库: `2.24.0`
  8495. *
  8496. * 表示获取资源的大小(以八位字节为单位)的数字。仅 resourceTiming 指标有效。(iOS 不支持) */
  8497. transferSize: number
  8498. /** 需要基础库: `2.24.0`
  8499. *
  8500. * 资源路径。仅 resourceTiming 指标有效。 */
  8501. uri: string
  8502. /** 需要基础库: `2.21.2`
  8503. *
  8504. * 渲染层代码注入完成时间。仅 firstRender 指标有效。 */
  8505. viewLayerReadyTime: number
  8506. /** 需要基础库: `2.21.2`
  8507. *
  8508. * 渲染层执行渲染结束时间。仅 firstRender 指标有效。 */
  8509. viewLayerRenderEndTime: number
  8510. /** 需要基础库: `2.21.2`
  8511. *
  8512. * 渲染层执行渲染开始时间。仅 firstRender 指标有效。 */
  8513. viewLayerRenderStartTime: number
  8514. }
  8515. /** 需要基础库: `2.11.0`
  8516. *
  8517. * PerformanceObserver 对象,用于监听性能相关事件 */
  8518. interface PerformanceObserver {
  8519. /** 获取当前支持的所有性能指标类型 */
  8520. supportedEntryTypes: any[]
  8521. /** [PerformanceObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceObserver.disconnect.html)
  8522. *
  8523. * 需要基础库: `2.11.0`
  8524. *
  8525. * 在插件中使用:不支持
  8526. *
  8527. * 停止监听 */
  8528. disconnect(): void
  8529. /** [PerformanceObserver.observe(Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceObserver.observe.html)
  8530. *
  8531. * 需要基础库: `2.11.0`
  8532. *
  8533. * 在插件中使用:不支持
  8534. *
  8535. * 开始监听 */
  8536. observe(
  8537. /** 设置 type 监听单个类型的指标,设置 entryTypes 监听多个类型指标。 */
  8538. options: ObserveOption
  8539. ): void
  8540. }
  8541. /** 平面跟踪配置 */
  8542. interface PlaneTrack {
  8543. /** 平面跟踪配置模式
  8544. *
  8545. * 可选值:
  8546. * - 1: 检测横向平面;
  8547. * - 2: 检测纵向平面,只有 v2 版本支持;
  8548. * - 3: 检测横向和纵向平面,只有 v2 版本支持; */
  8549. mode: 1 | 2 | 3
  8550. }
  8551. interface PlayBGMOption {
  8552. /** 加入背景混音的资源地址 */
  8553. url: string
  8554. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8555. complete?: PlayBGMCompleteCallback
  8556. /** 需要基础库: `2.31.0`
  8557. *
  8558. * BGM结束播放时间点,单位ms,0代表播放至文件结尾,若入参为负或超过文件长度,则默认播放至文件结尾 */
  8559. endTimeMs?: number
  8560. /** 接口调用失败的回调函数 */
  8561. fail?: PlayBGMFailCallback
  8562. /** 需要基础库: `2.31.0`
  8563. *
  8564. * BGM开始播时间点,单位ms,若入参为负或超过文件长度,则默认从文件开头进行播放 */
  8565. startTimeMs?: number
  8566. /** 接口调用成功的回调函数 */
  8567. success?: PlayBGMSuccessCallback
  8568. }
  8569. interface PlayBackgroundAudioOption {
  8570. /** 音乐链接,目前支持的格式有 m4a, aac, mp3, wav */
  8571. dataUrl: string
  8572. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8573. complete?: PlayBackgroundAudioCompleteCallback
  8574. /** 封面URL */
  8575. coverImgUrl?: string
  8576. /** 接口调用失败的回调函数 */
  8577. fail?: PlayBackgroundAudioFailCallback
  8578. /** 接口调用成功的回调函数 */
  8579. success?: PlayBackgroundAudioSuccessCallback
  8580. /** 音乐标题 */
  8581. title?: string
  8582. }
  8583. interface PlayOption {
  8584. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8585. complete?: PlayCompleteCallback
  8586. /** 接口调用失败的回调函数 */
  8587. fail?: PlayFailCallback
  8588. /** 接口调用成功的回调函数 */
  8589. success?: PlaySuccessCallback
  8590. }
  8591. interface PlayVoiceOption {
  8592. /** 需要播放的语音文件的文件路径 (本地路径) */
  8593. filePath: string
  8594. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8595. complete?: PlayVoiceCompleteCallback
  8596. /** 需要基础库: `1.6.0`
  8597. *
  8598. * 指定播放时长,到达指定的播放时长后会自动停止播放,单位:秒 */
  8599. duration?: number
  8600. /** 接口调用失败的回调函数 */
  8601. fail?: PlayVoiceFailCallback
  8602. /** 接口调用成功的回调函数 */
  8603. success?: PlayVoiceSuccessCallback
  8604. }
  8605. /** 插件账号信息(仅在插件中调用时包含这一项) */
  8606. interface Plugin {
  8607. /** 插件 appId */
  8608. appId: string
  8609. /** 插件版本号 */
  8610. version: string
  8611. }
  8612. interface PluginLoginOption {
  8613. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8614. complete?: PluginLoginCompleteCallback
  8615. /** 接口调用失败的回调函数 */
  8616. fail?: PluginLoginFailCallback
  8617. /** 接口调用成功的回调函数 */
  8618. success?: PluginLoginSuccessCallback
  8619. }
  8620. interface PluginLoginSuccessCallbackResult {
  8621. /** 用于换取 openpid 的凭证(有效期五分钟)。插件开发者可以用此 code 在开发者服务器后台调用 [getPluginOpenPId](https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/user-info/basic-info/getPluginOpenPId.html) 换取 openpid。 */
  8622. code: string
  8623. errMsg: string
  8624. }
  8625. interface PreDownloadSubpackageOption {
  8626. /** 分包加载结束回调事件(加载成功、失败都会执行) */
  8627. complete: (...args: any[]) => any
  8628. /** 分包加载失败回调事件 */
  8629. fail: (...args: any[]) => any
  8630. /** 分包的类型。目前仅支持填 "workers",表示 workers 分包。 */
  8631. packageType: string
  8632. /** 分包加载成功回调事件 */
  8633. success: (...args: any[]) => any
  8634. }
  8635. interface PreDownloadSubpackageTaskOnProgressUpdateListenerResult {
  8636. /** 分包下载进度百分比 */
  8637. progress: number
  8638. /** 预期需要下载的数据总长度,单位 Bytes */
  8639. totalBytesExpectedToWrite: number
  8640. /** 已经下载的数据长度,单位 Bytes */
  8641. totalBytesWritten: number
  8642. }
  8643. interface PreloadAssetsOption {
  8644. data: Asset[]
  8645. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8646. complete?: PreloadAssetsCompleteCallback
  8647. /** 接口调用失败的回调函数 */
  8648. fail?: PreloadAssetsFailCallback
  8649. /** 接口调用成功的回调函数 */
  8650. success?: PreloadAssetsSuccessCallback
  8651. }
  8652. interface PreloadSkylineViewOption {
  8653. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8654. complete?: PreloadSkylineViewCompleteCallback
  8655. /** 接口调用失败的回调函数 */
  8656. fail?: PreloadSkylineViewFailCallback
  8657. /** 接口调用成功的回调函数 */
  8658. success?: PreloadSkylineViewSuccessCallback
  8659. }
  8660. interface PreloadWebviewOption {
  8661. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8662. complete?: PreloadWebviewCompleteCallback
  8663. /** 接口调用失败的回调函数 */
  8664. fail?: PreloadWebviewFailCallback
  8665. /** 接口调用成功的回调函数 */
  8666. success?: PreloadWebviewSuccessCallback
  8667. }
  8668. interface PreviewImageOption {
  8669. /** 需要预览的图片链接列表。[2.2.3](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起支持云文件ID。 */
  8670. urls: string[]
  8671. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8672. complete?: PreviewImageCompleteCallback
  8673. /** 当前显示图片的链接 */
  8674. current?: string
  8675. /** 接口调用失败的回调函数 */
  8676. fail?: PreviewImageFailCallback
  8677. /** 需要基础库: `2.13.0`
  8678. *
  8679. * `origin`: 发送完整的referrer; `no-referrer`: 不发送。格式固定为 `https://servicewechat.com/{appid}/{version}/page-frame.html`,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本; */
  8680. referrerPolicy?: string
  8681. /** 需要基础库: `2.13.0`
  8682. *
  8683. * 是否显示长按菜单。 */
  8684. showmenu?: boolean
  8685. /** 接口调用成功的回调函数 */
  8686. success?: PreviewImageSuccessCallback
  8687. }
  8688. interface PreviewMediaOption {
  8689. /** 需要预览的资源列表 */
  8690. sources: MediaSource[]
  8691. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8692. complete?: PreviewMediaCompleteCallback
  8693. /** 当前显示的资源序号 */
  8694. current?: number
  8695. /** 接口调用失败的回调函数 */
  8696. fail?: PreviewMediaFailCallback
  8697. /** 需要基础库: `2.13.0`
  8698. *
  8699. * `origin`: 发送完整的referrer; `no-referrer`: 不发送。格式固定为 `https://servicewechat.com/{appid}/{version}/page-frame.html`,其中 {appid} 为小程序的 appid,{version} 为小程序的版本号,版本号为 0 表示为开发版、体验版以及审核版本,版本号为 devtools 表示为开发者工具,其余为正式版本; */
  8700. referrerPolicy?: string
  8701. /** 需要基础库: `2.13.0`
  8702. *
  8703. * 是否显示长按菜单。 */
  8704. showmenu?: boolean
  8705. /** 接口调用成功的回调函数 */
  8706. success?: PreviewMediaSuccessCallback
  8707. }
  8708. /** 推广员 */
  8709. interface PromoterResult {
  8710. /** 推广员昵称 */
  8711. finderNickname: string
  8712. /** 推广员 id */
  8713. promoterId: string
  8714. /** 推广员 openid */
  8715. promoterOpenId: string
  8716. }
  8717. interface ReLaunchOption {
  8718. /** 需要跳转的应用内页面路径 (代码包路径),路径后可以带参数。参数与路径之间使用?分隔,参数键与参数值用=相连,不同参数用&分隔;如 'path?key=value&key2=value2' */
  8719. url: string
  8720. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8721. complete?: ReLaunchCompleteCallback
  8722. /** 接口调用失败的回调函数 */
  8723. fail?: ReLaunchFailCallback
  8724. /** 接口调用成功的回调函数 */
  8725. success?: ReLaunchSuccessCallback
  8726. }
  8727. interface ReadBLECharacteristicValueOption {
  8728. /** 蓝牙特征的 UUID */
  8729. characteristicId: string
  8730. /** 蓝牙设备 id */
  8731. deviceId: string
  8732. /** 蓝牙特征对应服务的 UUID */
  8733. serviceId: string
  8734. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8735. complete?: ReadBLECharacteristicValueCompleteCallback
  8736. /** 接口调用失败的回调函数 */
  8737. fail?: ReadBLECharacteristicValueFailCallback
  8738. /** 接口调用成功的回调函数 */
  8739. success?: ReadBLECharacteristicValueSuccessCallback
  8740. }
  8741. interface ReadCompressedFileOption {
  8742. /** 文件压缩类型,目前仅支持 'br'。
  8743. *
  8744. * 可选值:
  8745. * - 'br': brotli压缩文件; */
  8746. compressionAlgorithm: 'br'
  8747. /** 要读取的文件的路径 (本地用户文件或代码包文件) */
  8748. filePath: string
  8749. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8750. complete?: ReadCompressedFileCompleteCallback
  8751. /** 接口调用失败的回调函数 */
  8752. fail?: ReadCompressedFileFailCallback
  8753. /** 接口调用成功的回调函数 */
  8754. success?: ReadCompressedFileSuccessCallback
  8755. }
  8756. interface ReadCompressedFileSuccessCallbackResult {
  8757. /** 文件内容 */
  8758. data: ArrayBuffer
  8759. errMsg: string
  8760. }
  8761. interface ReadCompressedFileSyncOption {
  8762. /** 文件压缩类型,目前仅支持 'br'。
  8763. *
  8764. * 可选值:
  8765. * - 'br': brotli压缩文件; */
  8766. compressionAlgorithm: 'br'
  8767. /** 要读取的文件的路径 (本地用户文件或代码包文件) */
  8768. filePath: string
  8769. }
  8770. interface ReadFileOption {
  8771. /** 要读取的文件的路径 (本地路径) */
  8772. filePath: string
  8773. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8774. complete?: ReadFileCompleteCallback
  8775. /** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
  8776. *
  8777. * 可选值:
  8778. * - 'ascii': ;
  8779. * - 'base64': ;
  8780. * - 'binary': ;
  8781. * - 'hex': ;
  8782. * - 'ucs2': 以小端序读取;
  8783. * - 'ucs-2': 以小端序读取;
  8784. * - 'utf16le': 以小端序读取;
  8785. * - 'utf-16le': 以小端序读取;
  8786. * - 'utf-8': ;
  8787. * - 'utf8': ;
  8788. * - 'latin1': ; */
  8789. encoding?:
  8790. | 'ascii'
  8791. | 'base64'
  8792. | 'binary'
  8793. | 'hex'
  8794. | 'ucs2'
  8795. | 'ucs-2'
  8796. | 'utf16le'
  8797. | 'utf-16le'
  8798. | 'utf-8'
  8799. | 'utf8'
  8800. | 'latin1'
  8801. /** 接口调用失败的回调函数 */
  8802. fail?: ReadFileFailCallback
  8803. /** 需要基础库: `2.10.0`
  8804. *
  8805. * 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */
  8806. length?: number
  8807. /** 需要基础库: `2.10.0`
  8808. *
  8809. * 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */
  8810. position?: number
  8811. /** 接口调用成功的回调函数 */
  8812. success?: ReadFileSuccessCallback
  8813. }
  8814. interface ReadFileSuccessCallbackResult {
  8815. /** 文件内容 */
  8816. data: string | ArrayBuffer
  8817. errMsg: string
  8818. }
  8819. interface ReadOption {
  8820. /** 数据写入的缓冲区,必须是 ArrayBuffer 实例 */
  8821. arrayBuffer: ArrayBuffer
  8822. /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  8823. fd: string
  8824. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8825. complete?: ReadCompleteCallback
  8826. /** 接口调用失败的回调函数 */
  8827. fail?: ReadFailCallback
  8828. /** 要从文件中读取的字节数,默认0 */
  8829. length?: number
  8830. /** 缓冲区中的写入偏移量,默认0 */
  8831. offset?: number
  8832. /** 文件读取的起始位置,如不传或传 null,则会从当前文件指针的位置读取。如果 position 是正整数,则文件指针位置会保持不变并从 position 读取文件。 */
  8833. position?: number
  8834. /** 接口调用成功的回调函数 */
  8835. success?: ReadSuccessCallback
  8836. }
  8837. /** 文件读取结果。 通过 [FileSystemManager.readSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readSync.html) 接口返回 */
  8838. interface ReadResult {
  8839. /** 被写入的缓存区的对象,即接口入参的 arrayBuffer */
  8840. arrayBuffer: ArrayBuffer
  8841. /** 实际读取的字节数 */
  8842. bytesRead: number
  8843. }
  8844. interface ReadSuccessCallbackResult {
  8845. /** 被写入的缓存区的对象,即接口入参的 arrayBuffer */
  8846. arrayBuffer: ArrayBuffer
  8847. /** 实际读取的字节数 */
  8848. bytesRead: number
  8849. errMsg: string
  8850. }
  8851. interface ReadSyncOption {
  8852. /** 数据写入的缓冲区,必须是 ArrayBuffer 实例 */
  8853. arrayBuffer: ArrayBuffer
  8854. /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  8855. fd: string
  8856. /** 要从文件中读取的字节数,默认0 */
  8857. length?: number
  8858. /** 缓冲区中的写入偏移量,默认0 */
  8859. offset?: number
  8860. /** 文件读取的起始位置,如不传或传 null,则会从当前文件指针的位置读取。如果 position 是正整数,则文件指针位置会保持不变并从 position 读取文件。 */
  8861. position?: number
  8862. }
  8863. interface ReadZipEntryOption {
  8864. /** 要读取的压缩包内的文件列表(当传入"all" 时表示读取压缩包内所有文件) */
  8865. entries: EntryItem[] | 'all'
  8866. /** 要读取的压缩包的路径 (本地路径) */
  8867. filePath: string
  8868. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8869. complete?: ReadZipEntryCompleteCallback
  8870. /** 统一指定读取文件的字符编码,只在 entries 值为"all"时有效。如果 entries 值为"all"且不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
  8871. *
  8872. * 可选值:
  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. /** 接口调用失败的回调函数 */
  8897. fail?: ReadZipEntryFailCallback
  8898. /** 接口调用成功的回调函数 */
  8899. success?: ReadZipEntrySuccessCallback
  8900. }
  8901. interface ReadZipEntrySuccessCallbackResult {
  8902. /** 文件读取结果。res.entries 是一个对象,key是文件路径,value是一个对象 FileItem ,表示该文件的读取结果。每个 FileItem 包含 data (文件内容) 和 errMsg (错误信息) 属性。 */
  8903. entries: EntriesResult
  8904. errMsg: string
  8905. }
  8906. interface ReaddirOption {
  8907. /** 要读取的目录路径 (本地路径) */
  8908. dirPath: string
  8909. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8910. complete?: ReaddirCompleteCallback
  8911. /** 接口调用失败的回调函数 */
  8912. fail?: ReaddirFailCallback
  8913. /** 接口调用成功的回调函数 */
  8914. success?: ReaddirSuccessCallback
  8915. }
  8916. interface ReaddirSuccessCallbackResult {
  8917. /** 指定目录下的文件名数组。 */
  8918. files: string[]
  8919. errMsg: string
  8920. }
  8921. interface ReconnectCastingOption {
  8922. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8923. complete?: ReconnectCastingCompleteCallback
  8924. /** 接口调用失败的回调函数 */
  8925. fail?: ReconnectCastingFailCallback
  8926. /** 接口调用成功的回调函数 */
  8927. success?: ReconnectCastingSuccessCallback
  8928. }
  8929. interface RecorderManagerStartOption {
  8930. /** 需要基础库: `2.1.0`
  8931. *
  8932. * 指定录音的音频输入源,可通过 [wx.getAvailableAudioSources()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.getAvailableAudioSources.html) 获取当前可用的音频源
  8933. *
  8934. * 可选值:
  8935. * - 'auto': 自动设置,默认使用手机麦克风,插上耳麦后自动切换使用耳机麦克风,所有平台适用;
  8936. * - 'buildInMic': 手机麦克风,仅限 iOS;
  8937. * - 'headsetMic': 有线耳机麦克风,仅限 iOS;
  8938. * - 'mic': 麦克风(没插耳麦时是手机麦克风,插耳麦时是耳机麦克风),仅限 Android;
  8939. * - 'camcorder': 同 mic,适用于录制音视频内容,仅限 Android;
  8940. * - 'voice_communication': 同 mic,适用于实时沟通,仅限 Android;
  8941. * - 'voice_recognition': 同 mic,适用于语音识别,仅限 Android; */
  8942. audioSource?:
  8943. | 'auto'
  8944. | 'buildInMic'
  8945. | 'headsetMic'
  8946. | 'mic'
  8947. | 'camcorder'
  8948. | 'voice_communication'
  8949. | 'voice_recognition'
  8950. /** 录音的时长,单位 ms,最大值 600000(10 分钟) */
  8951. duration?: number
  8952. /** 编码码率,有效值见下表格 */
  8953. encodeBitRate?: number
  8954. /** 音频格式
  8955. *
  8956. * 可选值:
  8957. * - 'mp3': mp3 格式;
  8958. * - 'aac': aac 格式;
  8959. * - 'wav': wav 格式;
  8960. * - 'PCM': pcm 格式; */
  8961. format?: 'mp3' | 'aac' | 'wav' | 'PCM'
  8962. /** 指定帧大小,单位 KB。传入 frameSize 后,每录制指定帧大小的内容后,会回调录制的文件内容,不指定则不会回调。暂仅支持 mp3、pcm 格式。 */
  8963. frameSize?: number
  8964. /** 录音通道数
  8965. *
  8966. * 可选值:
  8967. * - 1: 1 个通道;
  8968. * - 2: 2 个通道; */
  8969. numberOfChannels?: 1 | 2
  8970. /** 采样率(pc不支持)
  8971. *
  8972. * 可选值:
  8973. * - 8000: 8000 采样率;
  8974. * - 11025: 11025 采样率;
  8975. * - 12000: 12000 采样率;
  8976. * - 16000: 16000 采样率;
  8977. * - 22050: 22050 采样率;
  8978. * - 24000: 24000 采样率;
  8979. * - 32000: 32000 采样率;
  8980. * - 44100: 44100 采样率;
  8981. * - 48000: 48000 采样率; */
  8982. sampleRate?:
  8983. | 8000
  8984. | 11025
  8985. | 12000
  8986. | 16000
  8987. | 22050
  8988. | 24000
  8989. | 32000
  8990. | 44100
  8991. | 48000
  8992. }
  8993. interface RedirectToOption {
  8994. /** 需要跳转的应用内非 tabBar 的页面的路径 (代码包路径), 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' */
  8995. url: string
  8996. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  8997. complete?: RedirectToCompleteCallback
  8998. /** 接口调用失败的回调函数 */
  8999. fail?: RedirectToFailCallback
  9000. /** 接口调用成功的回调函数 */
  9001. success?: RedirectToSuccessCallback
  9002. }
  9003. interface RedoOption {
  9004. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9005. complete?: RedoCompleteCallback
  9006. /** 接口调用失败的回调函数 */
  9007. fail?: RedoFailCallback
  9008. /** 接口调用成功的回调函数 */
  9009. success?: RedoSuccessCallback
  9010. }
  9011. /** 来源信息。从另一个小程序、公众号或 App 进入小程序时返回。否则返回 `{}`。(参见后文注意) */
  9012. interface ReferrerInfo {
  9013. /** 来源小程序、公众号或 App 的 appId */
  9014. appId: string
  9015. /** 来源小程序传过来的数据,scene=1037或1038时支持 */
  9016. extraData: IAnyObject
  9017. }
  9018. /** 参照区域的边界 */
  9019. interface RelativeRectResult {
  9020. /** 下边界 */
  9021. bottom: number
  9022. /** 左边界 */
  9023. left: number
  9024. /** 右边界 */
  9025. right: number
  9026. /** 上边界 */
  9027. top: number
  9028. }
  9029. /** 发送端地址信息 */
  9030. interface RemoteInfo {
  9031. /** 发送消息的 socket 的地址 */
  9032. address: string
  9033. /** 使用的协议族,为 IPv4 或者 IPv6 */
  9034. family: string
  9035. /** 端口号 */
  9036. port: number
  9037. /** message 的大小,单位:字节 */
  9038. size: number
  9039. }
  9040. interface RemoveArcOption {
  9041. /** 圆弧 id */
  9042. id: number
  9043. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9044. complete?: RemoveArcCompleteCallback
  9045. /** 接口调用失败的回调函数 */
  9046. fail?: RemoveArcFailCallback
  9047. /** 接口调用成功的回调函数 */
  9048. success?: RemoveArcSuccessCallback
  9049. }
  9050. interface RemoveCustomLayerOption {
  9051. /** 个性化图层id */
  9052. layerId: string
  9053. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9054. complete?: RemoveCustomLayerCompleteCallback
  9055. /** 接口调用失败的回调函数 */
  9056. fail?: RemoveCustomLayerFailCallback
  9057. /** 接口调用成功的回调函数 */
  9058. success?: RemoveCustomLayerSuccessCallback
  9059. }
  9060. interface RemoveFormatOption {
  9061. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9062. complete?: RemoveFormatCompleteCallback
  9063. /** 接口调用失败的回调函数 */
  9064. fail?: RemoveFormatFailCallback
  9065. /** 接口调用成功的回调函数 */
  9066. success?: RemoveFormatSuccessCallback
  9067. }
  9068. interface RemoveGroundOverlayOption {
  9069. /** 图片图层 id */
  9070. id: string
  9071. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9072. complete?: RemoveGroundOverlayCompleteCallback
  9073. /** 接口调用失败的回调函数 */
  9074. fail?: RemoveGroundOverlayFailCallback
  9075. /** 接口调用成功的回调函数 */
  9076. success?: RemoveGroundOverlaySuccessCallback
  9077. }
  9078. interface RemoveMarkersOption {
  9079. /** marker 的 id 集合。 */
  9080. markerIds: any[]
  9081. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9082. complete?: RemoveMarkersCompleteCallback
  9083. /** 接口调用失败的回调函数 */
  9084. fail?: RemoveMarkersFailCallback
  9085. /** 接口调用成功的回调函数 */
  9086. success?: RemoveMarkersSuccessCallback
  9087. }
  9088. interface RemoveSavedFileOption {
  9089. /** 需要删除的文件路径 (本地路径) */
  9090. filePath: string
  9091. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9092. complete?: RemoveSavedFileCompleteCallback
  9093. /** 接口调用失败的回调函数 */
  9094. fail?: RemoveSavedFileFailCallback
  9095. /** 接口调用成功的回调函数 */
  9096. success?: RemoveSavedFileSuccessCallback
  9097. }
  9098. interface RemoveServiceOption {
  9099. /** service 的 UUID */
  9100. serviceId: string
  9101. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9102. complete?: RemoveServiceCompleteCallback
  9103. /** 接口调用失败的回调函数 */
  9104. fail?: RemoveServiceFailCallback
  9105. /** 接口调用成功的回调函数 */
  9106. success?: RemoveServiceSuccessCallback
  9107. }
  9108. interface RemoveStorageOption {
  9109. /** 本地缓存中指定的 key */
  9110. key: string
  9111. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9112. complete?: RemoveStorageCompleteCallback
  9113. /** 接口调用失败的回调函数 */
  9114. fail?: RemoveStorageFailCallback
  9115. /** 接口调用成功的回调函数 */
  9116. success?: RemoveStorageSuccessCallback
  9117. }
  9118. interface RemoveTabBarBadgeOption {
  9119. /** tabBar 的哪一项,从左边算起 */
  9120. index: number
  9121. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9122. complete?: RemoveTabBarBadgeCompleteCallback
  9123. /** 接口调用失败的回调函数 */
  9124. fail?: RemoveTabBarBadgeFailCallback
  9125. /** 接口调用成功的回调函数 */
  9126. success?: RemoveTabBarBadgeSuccessCallback
  9127. }
  9128. interface RemoveVisualLayerOption {
  9129. /** 可视化图层id */
  9130. layerId: string
  9131. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9132. complete?: RemoveVisualLayerCompleteCallback
  9133. /** 接口调用失败的回调函数 */
  9134. fail?: RemoveVisualLayerFailCallback
  9135. /** 接口调用成功的回调函数 */
  9136. success?: RemoveVisualLayerSuccessCallback
  9137. }
  9138. interface RenameOption {
  9139. /** 新文件路径,支持本地路径 */
  9140. newPath: string
  9141. /** 源文件路径,支持本地路径 */
  9142. oldPath: string
  9143. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9144. complete?: RenameCompleteCallback
  9145. /** 接口调用失败的回调函数 */
  9146. fail?: RenameFailCallback
  9147. /** 接口调用成功的回调函数 */
  9148. success?: RenameSuccessCallback
  9149. }
  9150. /** Canvas 绘图上下文。
  9151. *
  9152. * ****
  9153. *
  9154. * - 通过 Canvas.getContext('2d') 接口可以获取 CanvasRenderingContext2D 对象,实现了 [HTML Canvas 2D Context](https://www.w3.org/TR/2dcontext/) 定义的属性、方法。
  9155. * - 通过 Canvas.getContext('webgl') 或 OffscreenCanvas.getContext('webgl') 接口可以获取 WebGLRenderingContext 对象,实现了 [WebGL 1.0](https://www.khronos.org/registry/webgl/specs/latest/1.0/) 定义的所有属性、方法、常量。
  9156. * - CanvasRenderingContext2D 的 drawImage 方法 2.10.0 起支持传入通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取的 video 对象,2.29.0 起支持传入开启了自定义渲染的 [LivePusherContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.html) 对象。
  9157. *
  9158. * **示例代码**
  9159. *
  9160. * video 画到 2D Canvas 示例
  9161. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/tJTak7mU7sfX) */
  9162. interface RenderingContext {}
  9163. interface RequestCommonPaymentFailCallbackErr {
  9164. /** 错误码 */
  9165. errCode: number
  9166. /** 错误信息 */
  9167. errMsg: string
  9168. }
  9169. interface RequestCommonPaymentOption {
  9170. /** 支付的类型。b2b支付填 'retail_pay_goods' */
  9171. mode: string
  9172. /** 支付签名, 详见[《签名详解》](https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/virtual-payment.html) */
  9173. paySig: string
  9174. /** 具体支付参数见signData, 该参数需以string形式传递, 例如signData: '{"offerId":"123","buyQuantity":1,"env":0,"currencyType":"CNY","platform":"android","productId":"testproductId","goodsPrice":10,"outTradeNo":"xxxxxx","attach":"testdata"}' */
  9175. signData: SignData
  9176. /** 用户态签名, 详见[《签名详解》](https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/virtual-payment.html) */
  9177. signature: string
  9178. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9179. complete?: RequestCommonPaymentCompleteCallback
  9180. /** 接口调用失败的回调函数 */
  9181. fail?: RequestCommonPaymentFailCallback
  9182. /** 接口调用成功的回调函数 */
  9183. success?: RequestCommonPaymentSuccessCallback
  9184. }
  9185. interface RequestCommonPaymentSuccessCallbackResult {
  9186. /** 调用成功信息 */
  9187. errMsg: string
  9188. }
  9189. interface RequestDeviceVoIPOption {
  9190. /** 设备名称,将显示在授权弹窗内(长度不超过13)。授权框中「设备名字」= 「deviceName」 + 「modelId 对应设备型号」。 */
  9191. deviceName: string
  9192. /** 需要基础库: `2.30.4`
  9193. *
  9194. * 设备组的唯一标识 id 。isGroup 为 true 时只需要传该参数,isGroup 为 false 时不需要传该参数,但需要传 sn、snTicket、modelId、deviceName 。 */
  9195. groupId: string
  9196. /** 设备型号 id。通过微信公众平台注册设备获得。 */
  9197. modelId: string
  9198. /** 设备唯一序列号。由厂商分配,长度不能超过128字节。字符只接受数字,大小写字母,下划线(_)和连字符(-)。 */
  9199. sn: string
  9200. /** [设备票据](https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/hardware-device/getSnTicket.html),5分钟内有效。 */
  9201. snTicket: string
  9202. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9203. complete?: RequestDeviceVoIPCompleteCallback
  9204. /** 接口调用失败的回调函数 */
  9205. fail?: RequestDeviceVoIPFailCallback
  9206. /** 需要基础库: `2.30.4`
  9207. *
  9208. * 是否为授权设备组,默认 false 。 */
  9209. isGroup?: boolean
  9210. /** 接口调用成功的回调函数 */
  9211. success?: RequestDeviceVoIPSuccessCallback
  9212. }
  9213. /** 需要基础库: `3.0.0`
  9214. *
  9215. * 网络请求过程中的一些异常信息,例如httpdns重试等 */
  9216. interface RequestException {
  9217. /** 本次请求底层失败信息,所有失败信息均符合Errno错误码 */
  9218. reasons: ExceptionReason[]
  9219. /** 本次请求底层重试次数 */
  9220. retryCount: number
  9221. }
  9222. interface RequestFailCallbackErr {
  9223. /** 错误信息 */
  9224. errMsg: string
  9225. /** 需要基础库: `2.24.0`
  9226. *
  9227. * errno 错误码,错误码的详细说明参考 [Errno错误码](https://developers.weixin.qq.com/miniprogram/dev/framework/usability/PublicErrno.html) */
  9228. errno: number
  9229. }
  9230. interface RequestOption<
  9231. T extends string | IAnyObject | ArrayBuffer =
  9232. | string
  9233. | IAnyObject
  9234. | ArrayBuffer
  9235. > {
  9236. /** 开发者服务器接口地址 */
  9237. url: string
  9238. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9239. complete?: RequestCompleteCallback
  9240. /** 请求的参数 */
  9241. data?: string | IAnyObject | ArrayBuffer
  9242. /** 返回的数据格式
  9243. *
  9244. * 可选值:
  9245. * - 'json': 返回的数据为 JSON,返回后会对返回的数据进行一次 JSON.parse;
  9246. * - '其他': 不对返回的内容进行 JSON.parse; */
  9247. dataType?: 'json' | '其他'
  9248. /** 需要基础库: `2.10.4`
  9249. *
  9250. * 开启 cache */
  9251. enableCache?: boolean
  9252. /** 需要基础库: `2.20.2`
  9253. *
  9254. * 开启 transfer-encoding chunked。 */
  9255. enableChunked?: boolean
  9256. /** 需要基础库: `2.10.4`
  9257. *
  9258. * 开启 http2 */
  9259. enableHttp2?: boolean
  9260. /** 需要基础库: `2.19.1`
  9261. *
  9262. * 是否开启 HttpDNS 服务。如开启,需要同时填入 httpDNSServiceId 。 HttpDNS 用法详见 [移动解析HttpDNS](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/HTTPDNS.html) */
  9263. enableHttpDNS?: boolean
  9264. /** 需要基础库: `2.10.4`
  9265. *
  9266. * 开启 quic */
  9267. enableQuic?: boolean
  9268. /** 接口调用失败的回调函数 */
  9269. fail?: RequestFailCallback
  9270. /** 需要基础库: `2.21.0`
  9271. *
  9272. * 强制使用蜂窝网络发送请求 */
  9273. forceCellularNetwork?: boolean
  9274. /** 设置请求的 header,header 中不能设置 Referer。
  9275. *
  9276. * `content-type` 默认为 `application/json` */
  9277. header?: IAnyObject
  9278. /** 需要基础库: `2.19.1`
  9279. *
  9280. * HttpDNS 服务商 Id。 HttpDNS 用法详见 [移动解析HttpDNS](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/HTTPDNS.html) */
  9281. httpDNSServiceId?: string
  9282. /** HTTP 请求方法
  9283. *
  9284. * 可选值:
  9285. * - 'OPTIONS': HTTP 请求 OPTIONS;
  9286. * - 'GET': HTTP 请求 GET;
  9287. * - 'HEAD': HTTP 请求 HEAD;
  9288. * - 'POST': HTTP 请求 POST;
  9289. * - 'PUT': HTTP 请求 PUT;
  9290. * - 'DELETE': HTTP 请求 DELETE;
  9291. * - 'TRACE': HTTP 请求 TRACE;
  9292. * - 'CONNECT': HTTP 请求 CONNECT; */
  9293. method?:
  9294. | 'OPTIONS'
  9295. | 'GET'
  9296. | 'HEAD'
  9297. | 'POST'
  9298. | 'PUT'
  9299. | 'DELETE'
  9300. | 'TRACE'
  9301. | 'CONNECT'
  9302. /** 需要基础库: `3.2.2`
  9303. *
  9304. * 重定向拦截策略。(目前仅安卓和iOS端支持,开发者工具和PC端将在后续支持)
  9305. *
  9306. * 可选值:
  9307. * - 'follow': 不拦截重定向,即客户端自动处理重定向;
  9308. * - 'manual': 拦截重定向。开启后,当 http 状态码为 3xx 时客户端不再自动重定向,而是触发 onHeadersReceived 回调,并结束本次 request 请求。可通过 onHeadersReceived 回调中的 header.Location 获取重定向的 url; */
  9309. redirect?: 'follow' | 'manual'
  9310. /** 需要基础库: `1.7.0`
  9311. *
  9312. * 响应的数据类型
  9313. *
  9314. * 可选值:
  9315. * - 'text': 响应的数据为文本;
  9316. * - 'arraybuffer': 响应的数据为 ArrayBuffer; */
  9317. responseType?: 'text' | 'arraybuffer'
  9318. /** 接口调用成功的回调函数 */
  9319. success?: RequestSuccessCallback<T>
  9320. /** 需要基础库: `2.10.0`
  9321. *
  9322. * 超时时间,单位为毫秒。默认值为 60000 */
  9323. timeout?: number
  9324. }
  9325. interface RequestOrderPaymentOption {
  9326. /** 随机字符串,长度为32个字符以下 */
  9327. nonceStr: string
  9328. /** 统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=*** */
  9329. package: string
  9330. /** 签名,具体见微信支付文档 */
  9331. paySign: string
  9332. /** 时间戳,从 1970 年 1 月 1 日 00:00:00 至今的秒数,即当前的时间 */
  9333. timeStamp: string
  9334. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9335. complete?: RequestOrderPaymentCompleteCallback
  9336. /** 外部APP用户ID */
  9337. extUserUin?: string
  9338. /** 接口调用失败的回调函数 */
  9339. fail?: RequestOrderPaymentFailCallback
  9340. /** 订单信息,仅在需要校验的场景下需要传递,具体见[接口说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent2/API/order/requestOrderPayment) */
  9341. orderInfo?: IAnyObject
  9342. /** 签名算法,应与后台下单时的值一致
  9343. *
  9344. * 可选值:
  9345. * - 'MD5': 仅在 v2 版本接口适用;
  9346. * - 'HMAC-SHA256': 仅在 v2 版本接口适用;
  9347. * - 'RSA': 仅在 v3 版本接口适用; */
  9348. signType?: 'MD5' | 'HMAC-SHA256' | 'RSA'
  9349. /** 接口调用成功的回调函数 */
  9350. success?: RequestOrderPaymentSuccessCallback
  9351. }
  9352. interface RequestPaymentOption {
  9353. /** 随机字符串,长度为32个字符以下 */
  9354. nonceStr: string
  9355. /** 统一下单接口返回的 prepay_id 参数值,提交格式如:prepay_id=*** */
  9356. package: string
  9357. /** 签名,具体见微信支付文档 */
  9358. paySign: string
  9359. /** 时间戳,从 1970 年 1 月 1 日 00:00:00 至今的秒数,即当前的时间 */
  9360. timeStamp: string
  9361. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9362. complete?: RequestPaymentCompleteCallback
  9363. /** 接口调用失败的回调函数 */
  9364. fail?: RequestPaymentFailCallback
  9365. /** 签名算法,应与后台下单时的值一致
  9366. *
  9367. * 可选值:
  9368. * - 'MD5': 仅在 v2 版本接口适用;
  9369. * - 'HMAC-SHA256': 仅在 v2 版本接口适用;
  9370. * - 'RSA': 仅在 v3 版本接口适用; */
  9371. signType?: 'MD5' | 'HMAC-SHA256' | 'RSA'
  9372. /** 接口调用成功的回调函数 */
  9373. success?: RequestPaymentSuccessCallback
  9374. }
  9375. interface RequestPictureInPictureOption {
  9376. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9377. complete?: RequestPictureInPictureCompleteCallback
  9378. /** 接口调用失败的回调函数 */
  9379. fail?: RequestPictureInPictureFailCallback
  9380. /** 接口调用成功的回调函数 */
  9381. success?: RequestPictureInPictureSuccessCallback
  9382. }
  9383. interface RequestPluginPaymentOption {
  9384. /** 需要显示在页面中的金额,单位为分 */
  9385. fee: number
  9386. /** 任意数据,传递给功能页中的响应函数 */
  9387. paymentArgs: IAnyObject
  9388. /** 插件版本
  9389. *
  9390. * 可选值:
  9391. * - 'develop': 开发版;
  9392. * - 'trial': 体验版;
  9393. * - 'release': 正式版; */
  9394. version: 'develop' | 'trial' | 'release'
  9395. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9396. complete?: RequestPluginPaymentCompleteCallback
  9397. /** 需要显示在页面中的货币符号的代码 */
  9398. currencyType?: string
  9399. /** 接口调用失败的回调函数 */
  9400. fail?: RequestPluginPaymentFailCallback
  9401. /** 接口调用成功的回调函数 */
  9402. success?: RequestPluginPaymentSuccessCallback
  9403. }
  9404. /** 需要基础库: `2.10.4`
  9405. *
  9406. * 网络请求过程中一些调试信息,[查看详细说明](https://developers.weixin.qq.com/miniprogram/dev/framework/performance/network.html) */
  9407. interface RequestProfile {
  9408. /** SSL建立完成的时间,如果不是安全连接,则值为 0 */
  9409. SSLconnectionEnd: number
  9410. /** SSL建立连接的时间,如果不是安全连接,则值为 0 */
  9411. SSLconnectionStart: number
  9412. /** HTTP(TCP) 完成建立连接的时间(完成握手),如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接完成的时间。注意这里握手结束,包括安全连接建立完成、SOCKS 授权通过 */
  9413. connectEnd: number
  9414. /** HTTP(TCP) 开始建立连接的时间,如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接开始的时间 */
  9415. connectStart: number
  9416. /** DNS 域名查询完成的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
  9417. domainLookUpEnd: number
  9418. /** DNS 域名查询开始的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
  9419. domainLookUpStart: number
  9420. /** 评估当前网络下载的kbps */
  9421. downstreamThroughputKbpsEstimate: number
  9422. /** 评估的网络状态 unknown, offline, slow 2g, 2g, 3g, 4g, last/0, 1, 2, 3, 4, 5, 6 */
  9423. estimate_nettype: number
  9424. /** 组件准备好使用 HTTP 请求抓取资源的时间,这发生在检查本地缓存之前 */
  9425. fetchStart: number
  9426. /** 协议层根据多个请求评估当前网络的 rtt(仅供参考) */
  9427. httpRttEstimate: number
  9428. /** 当前请求的IP */
  9429. peerIP: string
  9430. /** 当前请求的端口 */
  9431. port: number
  9432. /** 使用协议类型,有效值:http1.1, h2, quic, unknown */
  9433. protocol: string
  9434. /** 收到字节数 */
  9435. receivedBytedCount: number
  9436. /** 最后一个 HTTP 重定向完成时的时间。有跳转且是同域名内部的重定向才算,否则值为 0 */
  9437. redirectEnd: number
  9438. /** 第一个 HTTP 重定向发生时的时间。有跳转且是同域名内的重定向才算,否则值为 0 */
  9439. redirectStart: number
  9440. /** HTTP请求读取真实文档结束的时间 */
  9441. requestEnd: number
  9442. /** HTTP请求读取真实文档开始的时间(完成建立连接),包括从本地读取缓存。连接错误重连时,这里显示的也是新建立连接的时间 */
  9443. requestStart: number
  9444. /** HTTP 响应全部接收完成的时间(获取到最后一个字节),包括从本地读取缓存 */
  9445. responseEnd: number
  9446. /** HTTP 开始接收响应的时间(获取到第一个字节),包括从本地读取缓存 */
  9447. responseStart: number
  9448. /** 当次请求连接过程中实时 rtt */
  9449. rtt: number
  9450. /** 发送的字节数 */
  9451. sendBytesCount: number
  9452. /** 是否复用连接 */
  9453. socketReused: boolean
  9454. /** 当前网络的实际下载kbps */
  9455. throughputKbps: number
  9456. /** 传输层根据多个请求评估的当前网络的 rtt(仅供参考) */
  9457. transportRttEstimate: number
  9458. }
  9459. interface RequestSubscribeDeviceMessageFailCallbackResult {
  9460. /** 接口调用失败错误码,有可能为空 */
  9461. errCode: number
  9462. /** 接口调用失败错误信息 */
  9463. errMsg: string
  9464. }
  9465. interface RequestSubscribeDeviceMessageOption {
  9466. /** 设备型号 id 。通过微信公众平台注册设备获得。 */
  9467. modelId: string
  9468. /** 设备唯一序列号。由厂商分配,长度不能超过128字节。字符只接受数字,大小写字母,下划线(_)和连字符(-)。 */
  9469. sn: string
  9470. /** 设备票据,5分钟内有效。 */
  9471. snTicket: string
  9472. /** 需要订阅的消息模板的 id 的集合,一次调用最多可订阅3条消息 */
  9473. tmplIds: any[]
  9474. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9475. complete?: RequestSubscribeDeviceMessageCompleteCallback
  9476. /** 接口调用失败的回调函数 */
  9477. fail?: RequestSubscribeDeviceMessageFailCallback
  9478. /** 接口调用成功的回调函数 */
  9479. success?: RequestSubscribeDeviceMessageSuccessCallback
  9480. }
  9481. interface RequestSubscribeDeviceMessageSuccessCallbackResult {
  9482. /** [TEMPLATE_ID]是动态的键,即模板id,值包括'accept'、'reject'、'ban'、'filter'、'acceptWithAudio'。'accept'表示用户同意订阅该条id对应的模板消息,'reject'表示用户拒绝订阅该条id对应的模板消息,'ban'表示已被后台封禁,'acceptWithAudio' 表示用户接收订阅消息并开启了语音提醒,'filter'表示该模板因为模板标题同名被后台过滤。例如 { errMsg: "requestSubscribeDeviceMessage:ok", zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: "accept"} 表示用户同意订阅zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE这条消息 */
  9483. [TEMPLATE_ID: string]: string
  9484. /** 接口调用成功时errMsg值为'requestSubscribeDeviceMessage:ok' */
  9485. errMsg: string
  9486. }
  9487. interface RequestSubscribeMessageFailCallbackResult {
  9488. /** 接口调用失败错误码 */
  9489. errCode: number
  9490. /** 接口调用失败错误信息 */
  9491. errMsg: string
  9492. }
  9493. interface RequestSubscribeMessageOption {
  9494. /** 需要订阅的消息模板的id的集合,一次调用最多可订阅3条消息(注意:iOS客户端7.0.6版本、Android客户端7.0.7版本之后的一次性订阅/长期订阅才支持多个模板消息,iOS客户端7.0.5版本、Android客户端7.0.6版本之前的一次订阅只支持一个模板消息)消息模板id在[微信公众平台(mp.weixin.qq.com)-功能-订阅消息]中配置。每个tmplId对应的模板标题需要不相同,否则会被过滤。 */
  9495. tmplIds: any[]
  9496. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9497. complete?: RequestSubscribeMessageCompleteCallback
  9498. /** 接口调用失败的回调函数 */
  9499. fail?: RequestSubscribeMessageFailCallback
  9500. /** 接口调用成功的回调函数 */
  9501. success?: RequestSubscribeMessageSuccessCallback
  9502. }
  9503. interface RequestSubscribeMessageSuccessCallbackResult {
  9504. /** [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这条消息 */
  9505. [TEMPLATE_ID: string]: string
  9506. /** 接口调用成功时errMsg值为'requestSubscribeMessage:ok' */
  9507. errMsg: string
  9508. }
  9509. interface RequestSuccessCallbackResult<
  9510. T extends string | IAnyObject | ArrayBuffer =
  9511. | string
  9512. | IAnyObject
  9513. | ArrayBuffer
  9514. > {
  9515. /** 需要基础库: `2.10.0`
  9516. *
  9517. * 开发者服务器返回的 cookies,格式为字符串数组 */
  9518. cookies: string[]
  9519. /** 开发者服务器返回的数据 */
  9520. data: T
  9521. /** 需要基础库: `3.0.0`
  9522. *
  9523. * 网络请求过程中的一些异常信息,例如httpdns重试等 */
  9524. exception: RequestException
  9525. /** 需要基础库: `1.2.0`
  9526. *
  9527. * 开发者服务器返回的 HTTP Response Header */
  9528. header: IAnyObject
  9529. /** 需要基础库: `2.10.4`
  9530. *
  9531. * 网络请求过程中一些调试信息,[查看详细说明](https://developers.weixin.qq.com/miniprogram/dev/framework/performance/network.html) */
  9532. profile: RequestProfile
  9533. /** 开发者服务器返回的 HTTP 状态码 */
  9534. statusCode: number
  9535. errMsg: string
  9536. }
  9537. interface RequestTaskOnHeadersReceivedListenerResult {
  9538. /** 开发者服务器返回的 cookies,格式为字符串数组 */
  9539. cookies: string[]
  9540. /** 开发者服务器返回的 HTTP Response Header */
  9541. header: IAnyObject
  9542. /** 开发者服务器返回的 HTTP 状态码 (目前开发者工具上不会返回 statusCode 字段,可用真机查看该字段,后续将会支持) */
  9543. statusCode: number
  9544. }
  9545. interface RequestVirtualPaymentOption {
  9546. /** 支付的类型, 不同的支付类型有各自额外要传的附加参数
  9547. *
  9548. * 可选值:
  9549. * - 'short_series_goods': 道具直购;
  9550. * - 'short_series_coin': 代币充值; */
  9551. mode: 'short_series_goods' | 'short_series_coin'
  9552. /** 支付签名, 详见[《签名详解》](https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/virtual-payment.html) */
  9553. paySig: string
  9554. /** 具体支付参数见signData, 该参数需以string形式传递, 例如signData: '{"offerId":"123","buyQuantity":1,"env":0,"currencyType":"CNY","platform":"android","productId":"testproductId","goodsPrice":10,"outTradeNo":"xxxxxx","attach":"testdata"}' */
  9555. signData: SignData
  9556. /** 用户态签名, 详见[《签名详解》](https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/virtual-payment.html) */
  9557. signature: string
  9558. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9559. complete?: RequestVirtualPaymentCompleteCallback
  9560. /** 接口调用失败的回调函数 */
  9561. fail?: RequestVirtualPaymentFailCallback
  9562. /** 接口调用成功的回调函数 */
  9563. success?: RequestVirtualPaymentSuccessCallback
  9564. }
  9565. interface RequirePrivacyAuthorizeOption {
  9566. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9567. complete?: RequirePrivacyAuthorizeCompleteCallback
  9568. /** 接口调用失败的回调函数 */
  9569. fail?: RequirePrivacyAuthorizeFailCallback
  9570. /** 接口调用成功的回调函数 */
  9571. success?: RequirePrivacyAuthorizeSuccessCallback
  9572. }
  9573. interface ReserveChannelsLiveOption {
  9574. /** 预告 id,通过 getChannelsLiveNoticeInfo 接口获取 */
  9575. noticeId: string
  9576. }
  9577. interface RestartMiniProgramOption {
  9578. /** 打开的页面路径,path 中 ? 后面的部分会成为 query */
  9579. path: string
  9580. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9581. complete?: RestartMiniProgramCompleteCallback
  9582. /** 接口调用失败的回调函数 */
  9583. fail?: RestartMiniProgramFailCallback
  9584. /** 接口调用成功的回调函数 */
  9585. success?: RestartMiniProgramSuccessCallback
  9586. }
  9587. interface ResumeBGMOption {
  9588. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9589. complete?: ResumeBGMCompleteCallback
  9590. /** 接口调用失败的回调函数 */
  9591. fail?: ResumeBGMFailCallback
  9592. /** 接口调用成功的回调函数 */
  9593. success?: ResumeBGMSuccessCallback
  9594. }
  9595. interface ResumeOption {
  9596. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9597. complete?: ResumeCompleteCallback
  9598. /** 接口调用失败的回调函数 */
  9599. fail?: ResumeFailCallback
  9600. /** 接口调用成功的回调函数 */
  9601. success?: ResumeSuccessCallback
  9602. }
  9603. interface RewardedVideoAdOnCloseListenerResult {
  9604. /** 需要基础库: `2.1.0`
  9605. *
  9606. * 视频是否是在用户完整观看的情况下被关闭的 */
  9607. isEnded: boolean
  9608. }
  9609. interface RewardedVideoAdOnErrorListenerResult {
  9610. /** 需要基础库: `2.2.2`
  9611. *
  9612. * 错误码
  9613. *
  9614. * 可选值:
  9615. * - 1000: 后端接口调用失败;
  9616. * - 1001: 参数错误;
  9617. * - 1002: 广告单元无效;
  9618. * - 1003: 内部错误;
  9619. * - 1004: 无合适的广告;
  9620. * - 1005: 广告组件审核中;
  9621. * - 1006: 广告组件被驳回;
  9622. * - 1007: 广告组件被封禁;
  9623. * - 1008: 广告单元已关闭; */
  9624. errCode: 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008
  9625. /** 错误信息 */
  9626. errMsg: string
  9627. }
  9628. interface RmdirOption {
  9629. /** 要删除的目录路径 (本地路径) */
  9630. dirPath: string
  9631. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9632. complete?: RmdirCompleteCallback
  9633. /** 接口调用失败的回调函数 */
  9634. fail?: RmdirFailCallback
  9635. /** 需要基础库: `2.3.0`
  9636. *
  9637. * 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。 */
  9638. recursive?: boolean
  9639. /** 接口调用成功的回调函数 */
  9640. success?: RmdirSuccessCallback
  9641. }
  9642. interface RunOCROption {
  9643. /** 待识别图像的像素点数据,每四项表示一个像素点的 RGBA */
  9644. frameBuffer: ArrayBuffer
  9645. /** 图像高度 */
  9646. height: number
  9647. /** 图像宽度 */
  9648. width: number
  9649. }
  9650. interface SafeArea {
  9651. /** 安全区域右下角纵坐标 */
  9652. bottom: number
  9653. /** 安全区域的高度,单位逻辑像素 */
  9654. height: number
  9655. /** 安全区域左上角横坐标 */
  9656. left: number
  9657. /** 安全区域右下角横坐标 */
  9658. right: number
  9659. /** 安全区域左上角纵坐标 */
  9660. top: number
  9661. /** 安全区域的宽度,单位逻辑像素 */
  9662. width: number
  9663. }
  9664. interface SaveFileOption {
  9665. /** 临时存储文件路径 (本地路径) */
  9666. tempFilePath: string
  9667. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9668. complete?: SaveFileCompleteCallback
  9669. /** 接口调用失败的回调函数 */
  9670. fail?: SaveFileFailCallback
  9671. /** 要存储的文件路径 (本地路径) */
  9672. filePath?: string
  9673. /** 接口调用成功的回调函数 */
  9674. success?: SaveFileSuccessCallback
  9675. }
  9676. interface SaveFileSuccessCallbackResult {
  9677. /** 存储后的文件路径 (本地路径) */
  9678. savedFilePath: string
  9679. errMsg: string
  9680. }
  9681. interface SaveFileToDiskOption {
  9682. /** 待保存文件路径 */
  9683. filePath: string
  9684. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9685. complete?: SaveFileToDiskCompleteCallback
  9686. /** 接口调用失败的回调函数 */
  9687. fail?: SaveFileToDiskFailCallback
  9688. /** 接口调用成功的回调函数 */
  9689. success?: SaveFileToDiskSuccessCallback
  9690. }
  9691. interface SaveImageToPhotosAlbumOption {
  9692. /** 图片文件路径,可以是临时文件路径或永久文件路径 (本地路径) ,不支持网络路径 */
  9693. filePath: string
  9694. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9695. complete?: SaveImageToPhotosAlbumCompleteCallback
  9696. /** 接口调用失败的回调函数 */
  9697. fail?: SaveImageToPhotosAlbumFailCallback
  9698. /** 接口调用成功的回调函数 */
  9699. success?: SaveImageToPhotosAlbumSuccessCallback
  9700. }
  9701. interface SaveVideoToPhotosAlbumOption {
  9702. /** 视频文件路径,可以是临时文件路径也可以是永久文件路径 (本地路径) */
  9703. filePath: string
  9704. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9705. complete?: SaveVideoToPhotosAlbumCompleteCallback
  9706. /** 接口调用失败的回调函数 */
  9707. fail?: SaveVideoToPhotosAlbumFailCallback
  9708. /** 接口调用成功的回调函数 */
  9709. success?: SaveVideoToPhotosAlbumSuccessCallback
  9710. }
  9711. interface ScanCodeOption {
  9712. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9713. complete?: ScanCodeCompleteCallback
  9714. /** 接口调用失败的回调函数 */
  9715. fail?: ScanCodeFailCallback
  9716. /** 需要基础库: `1.2.0`
  9717. *
  9718. * 是否只能从相机扫码,不允许从相册选择图片 */
  9719. onlyFromCamera?: boolean
  9720. /** 需要基础库: `1.7.0`
  9721. *
  9722. * 扫码类型
  9723. *
  9724. * 可选值:
  9725. * - 'barCode': 一维码;
  9726. * - 'qrCode': 二维码;
  9727. * - 'datamatrix': Data Matrix 码;
  9728. * - 'pdf417': PDF417 条码; */
  9729. scanType?: Array<'barCode' | 'qrCode' | 'datamatrix' | 'pdf417'>
  9730. /** 接口调用成功的回调函数 */
  9731. success?: ScanCodeSuccessCallback
  9732. }
  9733. interface ScanCodeSuccessCallbackResult {
  9734. /** 所扫码的字符集 */
  9735. charSet: string
  9736. /** 当所扫的码为当前小程序二维码时,会返回此字段,内容为二维码携带的 path */
  9737. path: string
  9738. /** 原始数据,base64编码 */
  9739. rawData: string
  9740. /** 所扫码的内容 */
  9741. result: string
  9742. /** 所扫码的类型
  9743. *
  9744. * 可选值:
  9745. * - 'QR_CODE': 二维码;
  9746. * - 'AZTEC': 一维码;
  9747. * - 'CODABAR': 一维码;
  9748. * - 'CODE_39': 一维码;
  9749. * - 'CODE_93': 一维码;
  9750. * - 'CODE_128': 一维码;
  9751. * - 'DATA_MATRIX': 二维码;
  9752. * - 'EAN_8': 一维码;
  9753. * - 'EAN_13': 一维码;
  9754. * - 'ITF': 一维码;
  9755. * - 'MAXICODE': 一维码;
  9756. * - 'PDF_417': 二维码;
  9757. * - 'RSS_14': 一维码;
  9758. * - 'RSS_EXPANDED': 一维码;
  9759. * - 'UPC_A': 一维码;
  9760. * - 'UPC_E': 一维码;
  9761. * - 'UPC_EAN_EXTENSION': 一维码;
  9762. * - 'WX_CODE': 二维码;
  9763. * - 'CODE_25': 一维码; */
  9764. scanType:
  9765. | 'QR_CODE'
  9766. | 'AZTEC'
  9767. | 'CODABAR'
  9768. | 'CODE_39'
  9769. | 'CODE_93'
  9770. | 'CODE_128'
  9771. | 'DATA_MATRIX'
  9772. | 'EAN_8'
  9773. | 'EAN_13'
  9774. | 'ITF'
  9775. | 'MAXICODE'
  9776. | 'PDF_417'
  9777. | 'RSS_14'
  9778. | 'RSS_EXPANDED'
  9779. | 'UPC_A'
  9780. | 'UPC_E'
  9781. | 'UPC_EAN_EXTENSION'
  9782. | 'WX_CODE'
  9783. | 'CODE_25'
  9784. errMsg: string
  9785. }
  9786. interface ScrollOffsetCallbackResult {
  9787. /** 节点的 dataset */
  9788. dataset: IAnyObject
  9789. /** 节点的 ID */
  9790. id: string
  9791. /** 节点的水平滚动位置 */
  9792. scrollLeft: number
  9793. /** 节点的竖直滚动位置 */
  9794. scrollTop: number
  9795. }
  9796. /** 需要基础库: `2.14.4`
  9797. *
  9798. * 增强 ScrollView 实例,可通过 [wx.createSelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/wx.createSelectorQuery.html) 的 [NodesRef.node](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/NodesRef.node.html) 方法获取。 仅在 scroll-view 组件开启 enhanced 属性后生效。
  9799. *
  9800. * **示例代码**
  9801. *
  9802. * ```js
  9803. wx.createSelectorQuery()
  9804. .select('#scrollview')
  9805. .node()
  9806. .exec((res) => {
  9807. const scrollView = res[0].node;
  9808. scrollView.scrollEnabled = false;
  9809. })
  9810. ``` */
  9811. interface ScrollViewContext {
  9812. /** 设置滚动边界弹性 (仅在 iOS 下生效) */
  9813. bounces: boolean
  9814. /** 取消滚动惯性 (仅在 iOS 下生效) */
  9815. decelerationDisabled: boolean
  9816. /** 设置滚动减速速率 (仅在 iOS 下生效) */
  9817. fastDeceleration: boolean
  9818. /** 分页滑动开关 */
  9819. pagingEnabled: boolean
  9820. /** 滚动开关 */
  9821. scrollEnabled: boolean
  9822. /** 设置是否显示滚动条 */
  9823. showScrollbar: boolean
  9824. /** [ScrollViewContext.closeRefresh()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.closeRefresh.html)
  9825. *
  9826. * 需要基础库: `3.0.0`
  9827. *
  9828. * 在插件中使用:支持
  9829. *
  9830. * 关闭下拉刷新。 */
  9831. closeRefresh(): void
  9832. /** [ScrollViewContext.closeTwoLevel(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.closeTwoLevel.html)
  9833. *
  9834. * 需要基础库: `3.0.0`
  9835. *
  9836. * 在插件中使用:支持
  9837. *
  9838. * 关闭下拉二级。 */
  9839. closeTwoLevel(option: TriggerRefreshOption): void
  9840. /** [ScrollViewContext.scrollIntoView(string selector, object ScrollIntoViewOptions)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.scrollIntoView.html)
  9841. *
  9842. * 需要基础库: `2.14.4`
  9843. *
  9844. * 在插件中使用:支持
  9845. *
  9846. * 滚动至指定位置 */
  9847. scrollIntoView(
  9848. /** 元素选择器 */
  9849. selector: string,
  9850. /** 需要基础库: `3.1.0`
  9851. *
  9852. * 配置项,仅 Skyine 模式支持 */
  9853. ScrollIntoViewOptions: IAnyObject
  9854. ): void
  9855. /** [ScrollViewContext.scrollTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.scrollTo.html)
  9856. *
  9857. * 需要基础库: `2.14.4`
  9858. *
  9859. * 在插件中使用:支持
  9860. *
  9861. * 滚动至指定位置 */
  9862. scrollTo(option: ScrollViewContextScrollToOption): void
  9863. /** [ScrollViewContext.triggerRefresh(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.triggerRefresh.html)
  9864. *
  9865. * 需要基础库: `3.0.0`
  9866. *
  9867. * 在插件中使用:支持
  9868. *
  9869. * 触发下拉刷新。 */
  9870. triggerRefresh(option: TriggerRefreshOption): void
  9871. /** [ScrollViewContext.triggerTwoLevel(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.triggerTwoLevel.html)
  9872. *
  9873. * 需要基础库: `3.0.0`
  9874. *
  9875. * 在插件中使用:支持
  9876. *
  9877. * 触发下拉二级。 */
  9878. triggerTwoLevel(option: TriggerRefreshOption): void
  9879. }
  9880. interface ScrollViewContextScrollToOption {
  9881. /** 是否启用滚动动画 */
  9882. animated?: boolean
  9883. /** 滚动动画时长 (仅在 iOS 下生效) */
  9884. duration?: number
  9885. /** 左边界距离 */
  9886. left?: number
  9887. /** 顶部距离 */
  9888. top?: number
  9889. /** 初始速度 (仅在 iOS 下生效) */
  9890. velocity?: number
  9891. }
  9892. interface SeekBackgroundAudioOption {
  9893. /** 音乐位置,单位:秒 */
  9894. position: number
  9895. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9896. complete?: SeekBackgroundAudioCompleteCallback
  9897. /** 接口调用失败的回调函数 */
  9898. fail?: SeekBackgroundAudioFailCallback
  9899. /** 接口调用成功的回调函数 */
  9900. success?: SeekBackgroundAudioSuccessCallback
  9901. }
  9902. interface SendHCEMessageOption {
  9903. /** 二进制数据 */
  9904. data: ArrayBuffer
  9905. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9906. complete?: SendHCEMessageCompleteCallback
  9907. /** 接口调用失败的回调函数 */
  9908. fail?: SendHCEMessageFailCallback
  9909. /** 接口调用成功的回调函数 */
  9910. success?: SendHCEMessageSuccessCallback
  9911. }
  9912. interface SendMessageOption {
  9913. /** SEI消息 */
  9914. msg: string
  9915. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9916. complete?: SendMessageCompleteCallback
  9917. /** 接口调用失败的回调函数 */
  9918. fail?: SendMessageFailCallback
  9919. /** 接口调用成功的回调函数 */
  9920. success?: SendMessageSuccessCallback
  9921. }
  9922. interface SendSmsOption {
  9923. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9924. complete?: SendSmsCompleteCallback
  9925. /** 预填到发送短信面板的内容 */
  9926. content?: string
  9927. /** 接口调用失败的回调函数 */
  9928. fail?: SendSmsFailCallback
  9929. /** 预填到发送短信面板的手机号 */
  9930. phoneNumber?: string
  9931. /** 接口调用成功的回调函数 */
  9932. success?: SendSmsSuccessCallback
  9933. }
  9934. interface SendSocketMessageOption {
  9935. /** 需要发送的内容 */
  9936. data: string | ArrayBuffer
  9937. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9938. complete?: SendSocketMessageCompleteCallback
  9939. /** 接口调用失败的回调函数 */
  9940. fail?: SendSocketMessageFailCallback
  9941. /** 接口调用成功的回调函数 */
  9942. success?: SendSocketMessageSuccessCallback
  9943. }
  9944. interface SetBGMVolumeOption {
  9945. /** 音量大小,范围是 0-1 */
  9946. volume: string
  9947. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9948. complete?: SetBGMVolumeCompleteCallback
  9949. /** 接口调用失败的回调函数 */
  9950. fail?: SetBGMVolumeFailCallback
  9951. /** 接口调用成功的回调函数 */
  9952. success?: SetBGMVolumeSuccessCallback
  9953. }
  9954. interface SetBLEMTUFailCallbackResult {
  9955. /** 最终协商的 MTU 值。如果协商失败则无此参数。安卓客户端 8.0.9 开始支持。 */
  9956. mtu: number
  9957. }
  9958. interface SetBLEMTUOption {
  9959. /** 蓝牙设备 id */
  9960. deviceId: string
  9961. /** 最大传输单元。设置范围为 (22,512) 区间内,单位 bytes */
  9962. mtu: number
  9963. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9964. complete?: SetBLEMTUCompleteCallback
  9965. /** 接口调用失败的回调函数 */
  9966. fail?: SetBLEMTUFailCallback
  9967. /** 接口调用成功的回调函数 */
  9968. success?: SetBLEMTUSuccessCallback
  9969. }
  9970. interface SetBLEMTUSuccessCallbackResult {
  9971. /** 最终协商的 MTU 值,与传入参数一致。安卓客户端 8.0.9 开始支持。 */
  9972. mtu: number
  9973. errMsg: string
  9974. }
  9975. interface SetBackgroundColorOption {
  9976. /** 窗口的背景色,必须为十六进制颜色值 */
  9977. backgroundColor?: string
  9978. /** 底部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持 */
  9979. backgroundColorBottom?: string
  9980. /** 顶部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持 */
  9981. backgroundColorTop?: string
  9982. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9983. complete?: SetBackgroundColorCompleteCallback
  9984. /** 接口调用失败的回调函数 */
  9985. fail?: SetBackgroundColorFailCallback
  9986. /** 接口调用成功的回调函数 */
  9987. success?: SetBackgroundColorSuccessCallback
  9988. }
  9989. interface SetBackgroundFetchTokenOption {
  9990. /** 自定义的登录态 */
  9991. token: string
  9992. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  9993. complete?: SetBackgroundFetchTokenCompleteCallback
  9994. /** 接口调用失败的回调函数 */
  9995. fail?: SetBackgroundFetchTokenFailCallback
  9996. /** 接口调用成功的回调函数 */
  9997. success?: SetBackgroundFetchTokenSuccessCallback
  9998. }
  9999. interface SetBackgroundTextStyleOption {
  10000. /** 下拉背景字体、loading 图的样式。
  10001. *
  10002. * 可选值:
  10003. * - 'dark': dark 样式;
  10004. * - 'light': light 样式; */
  10005. textStyle: 'dark' | 'light'
  10006. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10007. complete?: SetBackgroundTextStyleCompleteCallback
  10008. /** 接口调用失败的回调函数 */
  10009. fail?: SetBackgroundTextStyleFailCallback
  10010. /** 接口调用成功的回调函数 */
  10011. success?: SetBackgroundTextStyleSuccessCallback
  10012. }
  10013. interface SetBoundaryOption {
  10014. /** 东北角经纬度 */
  10015. northeast: MapPostion
  10016. /** 西南角经纬度 */
  10017. southwest: MapPostion
  10018. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10019. complete?: SetBoundaryCompleteCallback
  10020. /** 接口调用失败的回调函数 */
  10021. fail?: SetBoundaryFailCallback
  10022. /** 接口调用成功的回调函数 */
  10023. success?: SetBoundarySuccessCallback
  10024. }
  10025. interface SetCenterOffsetOption {
  10026. /** 偏移量,两位数组 */
  10027. offset: number[]
  10028. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10029. complete?: SetCenterOffsetCompleteCallback
  10030. /** 接口调用失败的回调函数 */
  10031. fail?: SetCenterOffsetFailCallback
  10032. /** 接口调用成功的回调函数 */
  10033. success?: SetCenterOffsetSuccessCallback
  10034. }
  10035. interface SetClipboardDataOption {
  10036. /** 剪贴板的内容 */
  10037. data: string
  10038. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10039. complete?: SetClipboardDataCompleteCallback
  10040. /** 接口调用失败的回调函数 */
  10041. fail?: SetClipboardDataFailCallback
  10042. /** 接口调用成功的回调函数 */
  10043. success?: SetClipboardDataSuccessCallback
  10044. }
  10045. interface SetContentsOption {
  10046. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10047. complete?: SetContentsCompleteCallback
  10048. /** 表示内容的delta对象 */
  10049. delta?: IAnyObject
  10050. /** 接口调用失败的回调函数 */
  10051. fail?: SetContentsFailCallback
  10052. /** 带标签的HTML内容 */
  10053. html?: string
  10054. /** 接口调用成功的回调函数 */
  10055. success?: SetContentsSuccessCallback
  10056. }
  10057. interface SetEnable1v1ChatOption {
  10058. /** 是否开启 */
  10059. enable: boolean
  10060. /** 窗口背景色(音频通话背景以及小窗模式背景)
  10061. *
  10062. * 可选值:
  10063. * - 0: #262930;
  10064. * - 1: #FA5151;
  10065. * - 2: #FA9D3B;
  10066. * - 3: #3D7257;
  10067. * - 4: #1485EE;
  10068. * - 5: #6467F0; */
  10069. backgroundType?: 0 | 1 | 2 | 3 | 4 | 5
  10070. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10071. complete?: SetEnable1v1ChatCompleteCallback
  10072. /** 接口调用失败的回调函数 */
  10073. fail?: SetEnable1v1ChatFailCallback
  10074. /** 小窗样式 */
  10075. minWindowType?: number
  10076. /** 接口调用成功的回调函数 */
  10077. success?: SetEnable1v1ChatSuccessCallback
  10078. }
  10079. interface SetEnableDebugOption {
  10080. /** 是否打开调试 */
  10081. enableDebug: boolean
  10082. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10083. complete?: SetEnableDebugCompleteCallback
  10084. /** 接口调用失败的回调函数 */
  10085. fail?: SetEnableDebugFailCallback
  10086. /** 接口调用成功的回调函数 */
  10087. success?: SetEnableDebugSuccessCallback
  10088. }
  10089. interface SetInnerAudioOption {
  10090. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10091. complete?: SetInnerAudioOptionCompleteCallback
  10092. /** 接口调用失败的回调函数 */
  10093. fail?: SetInnerAudioOptionFailCallback
  10094. /** 是否与其他音频混播,设置为 true 之后,不会终止其他应用或微信内的音乐 */
  10095. mixWithOther?: boolean
  10096. /** (仅在 iOS 生效)是否遵循静音开关,设置为 false 之后,即使是在静音模式下,也能播放声音 */
  10097. obeyMuteSwitch?: boolean
  10098. /** true 代表用扬声器播放,false 代表听筒播放,默认值为 true。 */
  10099. speakerOn?: boolean
  10100. /** 接口调用成功的回调函数 */
  10101. success?: SetInnerAudioOptionSuccessCallback
  10102. }
  10103. interface SetKeepScreenOnOption {
  10104. /** 是否保持屏幕常亮 */
  10105. keepScreenOn: boolean
  10106. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10107. complete?: SetKeepScreenOnCompleteCallback
  10108. /** 接口调用失败的回调函数 */
  10109. fail?: SetKeepScreenOnFailCallback
  10110. /** 接口调用成功的回调函数 */
  10111. success?: SetKeepScreenOnSuccessCallback
  10112. }
  10113. interface SetLocMarkerIconOption {
  10114. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10115. complete?: SetLocMarkerIconCompleteCallback
  10116. /** 接口调用失败的回调函数 */
  10117. fail?: SetLocMarkerIconFailCallback
  10118. /** 图标路径,支持网络路径、本地路径、代码包路径 */
  10119. iconPath?: string
  10120. /** 接口调用成功的回调函数 */
  10121. success?: SetLocMarkerIconSuccessCallback
  10122. }
  10123. interface SetMICVolumeOption {
  10124. /** 音量大小,范围是 0.0-1.0 */
  10125. volume: number
  10126. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10127. complete?: SetMICVolumeCompleteCallback
  10128. /** 接口调用失败的回调函数 */
  10129. fail?: SetMICVolumeFailCallback
  10130. /** 接口调用成功的回调函数 */
  10131. success?: SetMICVolumeSuccessCallback
  10132. }
  10133. interface SetNavigationBarColorOption {
  10134. /** 背景颜色值,有效值为十六进制颜色 */
  10135. backgroundColor: string
  10136. /** 前景颜色值,包括按钮、标题、状态栏的颜色,仅支持 #ffffff 和 #000000 */
  10137. frontColor: string
  10138. /** 动画效果 */
  10139. animation?: AnimationOption
  10140. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10141. complete?: SetNavigationBarColorCompleteCallback
  10142. /** 接口调用失败的回调函数 */
  10143. fail?: SetNavigationBarColorFailCallback
  10144. /** 接口调用成功的回调函数 */
  10145. success?: SetNavigationBarColorSuccessCallback
  10146. }
  10147. interface SetNavigationBarTitleOption {
  10148. /** 页面标题 */
  10149. title: string
  10150. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10151. complete?: SetNavigationBarTitleCompleteCallback
  10152. /** 接口调用失败的回调函数 */
  10153. fail?: SetNavigationBarTitleFailCallback
  10154. /** 接口调用成功的回调函数 */
  10155. success?: SetNavigationBarTitleSuccessCallback
  10156. }
  10157. interface SetScreenBrightnessOption {
  10158. /** 屏幕亮度值,范围 0 ~ 1,0 最暗,1 最亮。在安卓端支持传入特殊值 -1,表示屏幕亮度跟随系统变化 */
  10159. value: number
  10160. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10161. complete?: SetScreenBrightnessCompleteCallback
  10162. /** 接口调用失败的回调函数 */
  10163. fail?: SetScreenBrightnessFailCallback
  10164. /** 接口调用成功的回调函数 */
  10165. success?: SetScreenBrightnessSuccessCallback
  10166. }
  10167. interface SetStorageOption<T = any> {
  10168. /** 需要存储的内容。只支持原生类型、Date、及能够通过`JSON.stringify`序列化的对象。 */
  10169. data: T
  10170. /** 本地缓存中指定的 key */
  10171. key: string
  10172. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10173. complete?: SetStorageCompleteCallback
  10174. /** 需要基础库: `2.21.3`
  10175. *
  10176. * 是否开启加密存储。只有异步的 setStorage 接口支持开启加密存储。开启后,将会对 data 使用 AES128 加密,接口回调耗时将会增加。若开启加密存储,setStorage 和 getStorage 需要同时声明 encrypt 的值为 true。此外,由于加密后的数据会比原始数据膨胀1.4倍,因此开启 encrypt 的情况下,单个 key 允许存储的最大数据长度为 0.7MB,所有数据存储上限为 7.1MB */
  10177. encrypt?: boolean
  10178. /** 接口调用失败的回调函数 */
  10179. fail?: SetStorageFailCallback
  10180. /** 接口调用成功的回调函数 */
  10181. success?: SetStorageSuccessCallback
  10182. }
  10183. interface SetTabBarBadgeOption {
  10184. /** tabBar 的哪一项,从左边算起 */
  10185. index: number
  10186. /** 显示的文本,超过 4 个字符则显示成 ... */
  10187. text: string
  10188. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10189. complete?: SetTabBarBadgeCompleteCallback
  10190. /** 接口调用失败的回调函数 */
  10191. fail?: SetTabBarBadgeFailCallback
  10192. /** 接口调用成功的回调函数 */
  10193. success?: SetTabBarBadgeSuccessCallback
  10194. }
  10195. interface SetTabBarItemOption {
  10196. /** tabBar 的哪一项,从左边算起 */
  10197. index: number
  10198. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10199. complete?: SetTabBarItemCompleteCallback
  10200. /** 接口调用失败的回调函数 */
  10201. fail?: SetTabBarItemFailCallback
  10202. /** 图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,当 postion 为 top 时,此参数无效 */
  10203. iconPath?: string
  10204. /** 选中时的图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px ,当 postion 为 top 时,此参数无效 */
  10205. selectedIconPath?: string
  10206. /** 接口调用成功的回调函数 */
  10207. success?: SetTabBarItemSuccessCallback
  10208. /** tab 上的按钮文字 */
  10209. text?: string
  10210. }
  10211. interface SetTabBarStyleOption {
  10212. /** tab 的背景色,HexColor */
  10213. backgroundColor?: string
  10214. /** tabBar上边框的颜色, 仅支持 black/white */
  10215. borderStyle?: string
  10216. /** tab 上的文字默认颜色,HexColor */
  10217. color?: string
  10218. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10219. complete?: SetTabBarStyleCompleteCallback
  10220. /** 接口调用失败的回调函数 */
  10221. fail?: SetTabBarStyleFailCallback
  10222. /** tab 上的文字选中时的颜色,HexColor */
  10223. selectedColor?: string
  10224. /** 接口调用成功的回调函数 */
  10225. success?: SetTabBarStyleSuccessCallback
  10226. }
  10227. interface SetTimeoutOption {
  10228. /** 设置超时时间 (ms) */
  10229. timeout: number
  10230. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10231. complete?: SetTimeoutCompleteCallback
  10232. /** 接口调用失败的回调函数 */
  10233. fail?: SetTimeoutFailCallback
  10234. /** 接口调用成功的回调函数 */
  10235. success?: SetTimeoutSuccessCallback
  10236. }
  10237. interface SetTopBarTextOption {
  10238. /** 置顶栏文字 */
  10239. text: string
  10240. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10241. complete?: SetTopBarTextCompleteCallback
  10242. /** 接口调用失败的回调函数 */
  10243. fail?: SetTopBarTextFailCallback
  10244. /** 接口调用成功的回调函数 */
  10245. success?: SetTopBarTextSuccessCallback
  10246. }
  10247. interface SetVisualEffectOnCaptureOption {
  10248. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10249. complete?: SetVisualEffectOnCaptureCompleteCallback
  10250. /** 接口调用失败的回调函数 */
  10251. fail?: SetVisualEffectOnCaptureFailCallback
  10252. /** 接口调用成功的回调函数 */
  10253. success?: SetVisualEffectOnCaptureSuccessCallback
  10254. /** 截屏/录屏时的表现,仅支持 none / hidden,传入 hidden 则表示在截屏/录屏时隐藏屏幕 */
  10255. visualEffect?: string
  10256. }
  10257. interface SetWifiListOption {
  10258. /** 提供预设的 Wi-Fi 信息列表 */
  10259. wifiList: WifiData[]
  10260. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10261. complete?: SetWifiListCompleteCallback
  10262. /** 接口调用失败的回调函数 */
  10263. fail?: SetWifiListFailCallback
  10264. /** 接口调用成功的回调函数 */
  10265. success?: SetWifiListSuccessCallback
  10266. }
  10267. interface SetWindowSizeOption {
  10268. /** 窗口高度,以像素为单位 */
  10269. height: number
  10270. /** 窗口宽度,以像素为单位 */
  10271. width: number
  10272. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10273. complete?: SetWindowSizeCompleteCallback
  10274. /** 接口调用失败的回调函数 */
  10275. fail?: SetWindowSizeFailCallback
  10276. /** 接口调用成功的回调函数 */
  10277. success?: SetWindowSizeSuccessCallback
  10278. }
  10279. interface SetZoomSuccessCallbackResult {
  10280. /** 实际设置的缩放级别。由于系统限制,某些机型可能无法设置成指定值,会改用最接近的可设值。 */
  10281. zoom: number
  10282. errMsg: string
  10283. }
  10284. interface ShareFileMessageOption {
  10285. /** 要分享的文件地址,必须为本地路径或临时路径 */
  10286. filePath: string
  10287. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10288. complete?: ShareFileMessageCompleteCallback
  10289. /** 接口调用失败的回调函数 */
  10290. fail?: ShareFileMessageFailCallback
  10291. /** 自定义文件名,若留空则使用filePath中的文件名 */
  10292. fileName?: string
  10293. /** 接口调用成功的回调函数 */
  10294. success?: ShareFileMessageSuccessCallback
  10295. }
  10296. interface ShareToWeRunOption {
  10297. /** 运动数据列表 */
  10298. recordList: WxaSportRecord[]
  10299. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10300. complete?: ShareToWeRunCompleteCallback
  10301. /** 接口调用失败的回调函数 */
  10302. fail?: ShareToWeRunFailCallback
  10303. /** 接口调用成功的回调函数 */
  10304. success?: ShareToWeRunSuccessCallback
  10305. }
  10306. interface ShareVideoMessageOption {
  10307. /** 要分享的视频地址,必须为本地路径或临时路径 */
  10308. videoPath: string
  10309. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10310. complete?: ShareVideoMessageCompleteCallback
  10311. /** 接口调用失败的回调函数 */
  10312. fail?: ShareVideoMessageFailCallback
  10313. /** 接口调用成功的回调函数 */
  10314. success?: ShareVideoMessageSuccessCallback
  10315. /** 缩略图路径,若留空则使用视频首帧 */
  10316. thumbPath?: string
  10317. }
  10318. interface ShowActionSheetOption {
  10319. /** 按钮的文字数组,数组长度最大为 6 */
  10320. itemList: string[]
  10321. /** 需要基础库: `2.14.0`
  10322. *
  10323. * 警示文案 */
  10324. alertText?: string
  10325. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10326. complete?: ShowActionSheetCompleteCallback
  10327. /** 接口调用失败的回调函数 */
  10328. fail?: ShowActionSheetFailCallback
  10329. /** 按钮的文字颜色 */
  10330. itemColor?: string
  10331. /** 接口调用成功的回调函数 */
  10332. success?: ShowActionSheetSuccessCallback
  10333. }
  10334. interface ShowActionSheetSuccessCallbackResult {
  10335. /** 用户点击的按钮序号,从上到下的顺序,从0开始 */
  10336. tapIndex: number
  10337. errMsg: string
  10338. }
  10339. interface ShowLoadingOption {
  10340. /** 提示的内容 */
  10341. title: string
  10342. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10343. complete?: ShowLoadingCompleteCallback
  10344. /** 接口调用失败的回调函数 */
  10345. fail?: ShowLoadingFailCallback
  10346. /** 是否显示透明蒙层,防止触摸穿透 */
  10347. mask?: boolean
  10348. /** 接口调用成功的回调函数 */
  10349. success?: ShowLoadingSuccessCallback
  10350. }
  10351. interface ShowModalOption {
  10352. /** 取消按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
  10353. cancelColor?: string
  10354. /** 取消按钮的文字,最多 4 个字符 */
  10355. cancelText?: string
  10356. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10357. complete?: ShowModalCompleteCallback
  10358. /** 确认按钮的文字颜色,必须是 16 进制格式的颜色字符串 */
  10359. confirmColor?: string
  10360. /** 确认按钮的文字,最多 4 个字符 */
  10361. confirmText?: string
  10362. /** 提示的内容 */
  10363. content?: string
  10364. /** 需要基础库: `2.17.1`
  10365. *
  10366. * 是否显示输入框 */
  10367. editable?: boolean
  10368. /** 接口调用失败的回调函数 */
  10369. fail?: ShowModalFailCallback
  10370. /** 需要基础库: `2.17.1`
  10371. *
  10372. * 显示输入框时的提示文本 */
  10373. placeholderText?: string
  10374. /** 是否显示取消按钮 */
  10375. showCancel?: boolean
  10376. /** 接口调用成功的回调函数 */
  10377. success?: ShowModalSuccessCallback
  10378. /** 提示的标题 */
  10379. title?: string
  10380. }
  10381. interface ShowModalSuccessCallbackResult {
  10382. /** 需要基础库: `1.1.0`
  10383. *
  10384. * 为 true 时,表示用户点击了取消(用于 Android 系统区分点击蒙层关闭还是点击取消按钮关闭) */
  10385. cancel: boolean
  10386. /** 为 true 时,表示用户点击了确定按钮 */
  10387. confirm: boolean
  10388. /** editable 为 true 时,用户输入的文本 */
  10389. content: string
  10390. errMsg: string
  10391. }
  10392. interface ShowNavigationBarLoadingOption {
  10393. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10394. complete?: ShowNavigationBarLoadingCompleteCallback
  10395. /** 接口调用失败的回调函数 */
  10396. fail?: ShowNavigationBarLoadingFailCallback
  10397. /** 接口调用成功的回调函数 */
  10398. success?: ShowNavigationBarLoadingSuccessCallback
  10399. }
  10400. interface ShowRedPackageOption {
  10401. /** 封面地址 */
  10402. url: string
  10403. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10404. complete?: ShowRedPackageCompleteCallback
  10405. /** 接口调用失败的回调函数 */
  10406. fail?: ShowRedPackageFailCallback
  10407. /** 接口调用成功的回调函数 */
  10408. success?: ShowRedPackageSuccessCallback
  10409. }
  10410. interface ShowShareImageMenuOption {
  10411. /** 要分享的图片地址,必须为本地路径或临时路径 */
  10412. path: string
  10413. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10414. complete?: ShowShareImageMenuCompleteCallback
  10415. /** 需要基础库: `3.2.0`
  10416. *
  10417. * 从消息小程序入口打开小程序的路径,如果当前页面允许分享给朋友,则默认为当前页面路径,否则默认为小程序首页 */
  10418. entrancePath?: string
  10419. /** 接口调用失败的回调函数 */
  10420. fail?: ShowShareImageMenuFailCallback
  10421. /** 需要基础库: `3.2.0`
  10422. *
  10423. * 分享的图片消息是否要带小程序入口 */
  10424. needShowEntrance?: string
  10425. /** 需要基础库: `3.2.0`
  10426. *
  10427. * 分享样式,可选 v2 */
  10428. style?: string
  10429. /** 接口调用成功的回调函数 */
  10430. success?: ShowShareImageMenuSuccessCallback
  10431. }
  10432. interface ShowShareMenuOption {
  10433. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10434. complete?: ShowShareMenuCompleteCallback
  10435. /** 接口调用失败的回调函数 */
  10436. fail?: ShowShareMenuFailCallback
  10437. /** 需要基础库: `2.11.3`
  10438. *
  10439. * 本接口为 Beta 版本,暂只在 Android 平台支持。需要显示的转发按钮名称列表,默认['shareAppMessage']。按钮名称合法值包含 "shareAppMessage"、"shareTimeline" 两种 */
  10440. menus?: string[]
  10441. /** 接口调用成功的回调函数 */
  10442. success?: ShowShareMenuSuccessCallback
  10443. /** 是否使用带 shareTicket 的转发[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
  10444. withShareTicket?: boolean
  10445. }
  10446. interface ShowTabBarOption {
  10447. /** 是否需要动画效果 */
  10448. animation?: boolean
  10449. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10450. complete?: ShowTabBarCompleteCallback
  10451. /** 接口调用失败的回调函数 */
  10452. fail?: ShowTabBarFailCallback
  10453. /** 接口调用成功的回调函数 */
  10454. success?: ShowTabBarSuccessCallback
  10455. }
  10456. interface ShowTabBarRedDotOption {
  10457. /** tabBar 的哪一项,从左边算起 */
  10458. index: number
  10459. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10460. complete?: ShowTabBarRedDotCompleteCallback
  10461. /** 接口调用失败的回调函数 */
  10462. fail?: ShowTabBarRedDotFailCallback
  10463. /** 接口调用成功的回调函数 */
  10464. success?: ShowTabBarRedDotSuccessCallback
  10465. }
  10466. interface ShowToastOption {
  10467. /** 提示的内容 */
  10468. title: string
  10469. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10470. complete?: ShowToastCompleteCallback
  10471. /** 提示的延迟时间 */
  10472. duration?: number
  10473. /** 接口调用失败的回调函数 */
  10474. fail?: ShowToastFailCallback
  10475. /** 图标
  10476. *
  10477. * 可选值:
  10478. * - 'success': 显示成功图标,此时 title 文本最多显示 7 个汉字长度;
  10479. * - 'error': 显示失败图标,此时 title 文本最多显示 7 个汉字长度;
  10480. * - 'loading': 显示加载图标,此时 title 文本最多显示 7 个汉字长度;
  10481. * - 'none': 不显示图标,此时 title 文本最多可显示两行,[1.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)及以上版本支持; */
  10482. icon?: 'success' | 'error' | 'loading' | 'none'
  10483. /** 需要基础库: `1.1.0`
  10484. *
  10485. * 自定义图标的本地路径,image 的优先级高于 icon */
  10486. image?: string
  10487. /** 是否显示透明蒙层,防止触摸穿透 */
  10488. mask?: boolean
  10489. /** 接口调用成功的回调函数 */
  10490. success?: ShowToastSuccessCallback
  10491. }
  10492. /** 具体支付参数见signData, 该参数需以string形式传递, 例如signData: '{"offerId":"123","buyQuantity":1,"env":0,"currencyType":"CNY","platform":"android","productId":"testproductId","goodsPrice":10,"outTradeNo":"xxxxxx","attach":"testdata"}' */
  10493. interface SignData {
  10494. /** 透传数据, 发货通知时会透传给开发者 */
  10495. attach: string
  10496. /** 购买数量 */
  10497. buyQuantity: number
  10498. /** 币种
  10499. *
  10500. * 可选值:
  10501. * - 'CNY': 人民币; */
  10502. currencyType: 'CNY'
  10503. /** 道具单价(分), **该字段仅mode=short_series_goods时可用**, 用来校验价格与后台道具价格是否一致, 避免用户在业务商城页看到的价格与实际价格不一致导致投诉 */
  10504. goodsPrice: number
  10505. /** 在米大师侧申请的应用 id, mp-支付基础配置中的offerid */
  10506. offerId: string
  10507. /** 业务订单号, 每个订单号只能使用一次, 重复使用会失败(极端情况不保证唯一, 不建议业务强依赖唯一性). 要求8-32个字符内, 只能是数字、大小写字母、符号 _-|*@组成, 不能以下划线(_)开头 */
  10508. outTradeNo: string
  10509. /** 道具ID, **该字段仅mode=short_series_goods时可用** */
  10510. productId: string
  10511. /** 环境配置, 0 米大师正式环境, 1 米大师沙箱环境, 默认为 0 */
  10512. env?: number
  10513. /** 申请接入时的平台, platform 与应用id有关
  10514. *
  10515. * 可选值:
  10516. * - 'android': 安卓平台; */
  10517. platform?: 'android'
  10518. }
  10519. interface Size {
  10520. /** 变化后的窗口高度,单位 px */
  10521. windowHeight: number
  10522. /** 变化后的窗口宽度,单位 px */
  10523. windowWidth: number
  10524. }
  10525. /** 当前运行环境对于 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 的支持情况 */
  10526. interface SkylineInfo {
  10527. /** 当前运行环境是否支持 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) */
  10528. isSupported: boolean
  10529. /** 当前运行环境 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 的版本号,形如 `0.9.7` */
  10530. version: string
  10531. /** 当前运行环境不支持 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 的原因,仅在 `isSupported` 为 `false` 时出现
  10532. *
  10533. * 可选值:
  10534. * - 'client not supported)) 当前微信客户端不支持 [Skyline 渲染引擎]((skyline/introduction': ,可以尝试通过升级微信客户端解决;
  10535. * - 'baselib not supported)) 当前基础库不支持 [Skyline 渲染引擎]((skyline/introduction': ,基础库会自动更新到当前客户端所能支持的最新的版本,基础库不支持时也可以尝试通过升级微信客户端解决;
  10536. * - 'a-b test not enabled)) 命中了 _We 分析_ 平台上的 AB 实验关闭的情况。详细可以查看 [Skyline 起步 > 配置 We 分析 AB 实验]((skyline/migration#%E9%85%8D%E7%BD%AE-We-%E5%88%86%E6%9E%90-AB-%E5%AE%9E%E9%AA%8C': 一节;
  10537. * - 'SwitchRender option set to webview)) 本地调试的快捷切换入口被设置为了强制使用 Webview. 详情可以查看 [Skyline 起步 > 快捷切换入口]((skyline/migration#快捷切换入口': 一节; */
  10538. reason?:
  10539. | 'client not supported)) 当前微信客户端不支持 [Skyline 渲染引擎]((skyline/introduction'
  10540. | 'baselib not supported)) 当前基础库不支持 [Skyline 渲染引擎]((skyline/introduction'
  10541. | 'a-b test not enabled)) 命中了 _We 分析_ 平台上的 AB 实验关闭的情况。详细可以查看 [Skyline 起步 > 配置 We 分析 AB 实验]((skyline/migration#%E9%85%8D%E7%BD%AE-We-%E5%88%86%E6%9E%90-AB-%E5%AE%9E%E9%AA%8C'
  10542. | 'SwitchRender option set to webview)) 本地调试的快捷切换入口被设置为了强制使用 Webview. 详情可以查看 [Skyline 起步 > 快捷切换入口]((skyline/migration#快捷切换入口'
  10543. }
  10544. /** Snapshot 实例,可通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取。
  10545. *
  10546. * [Snapshot](https://developers.weixin.qq.com/miniprogram/dev/api/skyline/Snapshot.html) 通过 `id` 跟一个 [snapshot](https://developers.weixin.qq.com/miniprogram/dev/component/snapshot.html) 组件绑定,操作对应的 [snapshot](https://developers.weixin.qq.com/miniprogram/dev/component/snapshot.html) 组件。
  10547. *
  10548. * **示例代码**
  10549. *
  10550. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/jdkplEm17hJP) */
  10551. interface Snapshot {
  10552. /** 画布高度 */
  10553. height: number
  10554. /** 画布宽度 */
  10555. width: number
  10556. /** [Snapshot.takeSnapshot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/skyline/Snapshot.takeSnapshot.html)
  10557. *
  10558. * 需要基础库: `3.0.0`
  10559. *
  10560. * 在插件中使用:支持
  10561. *
  10562. * 对 snapshot 组件子树进行截图 */
  10563. takeSnapshot(option: TakeSnapshotOption): void
  10564. }
  10565. /** 需要基础库: `2.10.4`
  10566. *
  10567. * 网络请求过程中一些调试信息 */
  10568. interface SocketProfile {
  10569. /** 完成建立连接的时间(完成握手),如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接完成的时间。注意这里握手结束,包括安全连接建立完成、SOCKS 授权通过 */
  10570. connectEnd: number
  10571. /** 开始建立连接的时间,如果是持久连接,则与 fetchStart 值相等。注意如果在传输层发生了错误且重新建立连接,则这里显示的是新建立的连接开始的时间 */
  10572. connectStart: number
  10573. /** 上层请求到返回的耗时 */
  10574. cost: number
  10575. /** DNS 域名查询完成的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
  10576. domainLookupEnd: number
  10577. /** DNS 域名查询开始的时间,如果使用了本地缓存(即无 DNS 查询)或持久连接,则与 fetchStart 值相等 */
  10578. domainLookupStart: number
  10579. /** 组件准备好使用 SOCKET 建立请求的时间,这发生在检查本地缓存之前 */
  10580. fetchStart: number
  10581. /** 握手耗时 */
  10582. handshakeCost: number
  10583. /** 单次连接的耗时,包括 connect ,tls */
  10584. rtt: number
  10585. }
  10586. interface SocketTaskCloseOption {
  10587. /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */
  10588. code?: number
  10589. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10590. complete?: SocketTaskCloseCompleteCallback
  10591. /** 接口调用失败的回调函数 */
  10592. fail?: SocketTaskCloseFailCallback
  10593. /** 一个可读的字符串,表示连接被关闭的原因。这个字符串必须是不长于 123 字节的 UTF-8 文本(不是字符)。 */
  10594. reason?: string
  10595. /** 接口调用成功的回调函数 */
  10596. success?: SocketTaskCloseSuccessCallback
  10597. }
  10598. interface SocketTaskOnCloseListenerResult {
  10599. /** 一个数字值表示关闭连接的状态号,表示连接被关闭的原因。 */
  10600. code: number
  10601. /** 一个可读的字符串,表示连接被关闭的原因。 */
  10602. reason: string
  10603. }
  10604. interface SocketTaskOnMessageListenerResult {
  10605. /** 服务器返回的消息 */
  10606. data: string | ArrayBuffer
  10607. }
  10608. interface SocketTaskSendOption {
  10609. /** 需要发送的内容 */
  10610. data: string | ArrayBuffer
  10611. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10612. complete?: SendCompleteCallback
  10613. /** 接口调用失败的回调函数 */
  10614. fail?: SendFailCallback
  10615. /** 接口调用成功的回调函数 */
  10616. success?: SendSuccessCallback
  10617. }
  10618. /** 动画配置 */
  10619. interface SpringOption {
  10620. /** 阻尼系数 */
  10621. damping?: number
  10622. /** 重量系数,值越大移动越慢 */
  10623. mass?: number
  10624. /** 动画是否可以在指定值上反弹 */
  10625. overshootClamping?: boolean
  10626. /** 弹簧静止时的位移 */
  10627. restDisplacementThreshold?: number
  10628. /** 弹簧静止的速度 */
  10629. restSpeedThreshold?: number
  10630. /** 弹性系数 */
  10631. stiffness?: number
  10632. /** 速度 */
  10633. velocity?: number
  10634. }
  10635. interface StartAccelerometerOption {
  10636. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10637. complete?: StartAccelerometerCompleteCallback
  10638. /** 接口调用失败的回调函数 */
  10639. fail?: StartAccelerometerFailCallback
  10640. /** 需要基础库: `2.1.0`
  10641. *
  10642. * 监听加速度数据回调函数的执行频率
  10643. *
  10644. * 可选值:
  10645. * - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右;
  10646. * - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右;
  10647. * - 'normal': 普通的回调频率,在 200ms/次 左右; */
  10648. interval?: 'game' | 'ui' | 'normal'
  10649. /** 接口调用成功的回调函数 */
  10650. success?: StartAccelerometerSuccessCallback
  10651. }
  10652. interface StartAdvertisingObject {
  10653. /** 广播自定义参数 */
  10654. advertiseRequest: AdvertiseReqObj
  10655. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10656. complete?: StartAdvertisingCompleteCallback
  10657. /** 接口调用失败的回调函数 */
  10658. fail?: StartAdvertisingFailCallback
  10659. /** 广播功率
  10660. *
  10661. * 可选值:
  10662. * - 'low': 功率低;
  10663. * - 'medium': 功率适中;
  10664. * - 'high': 功率高; */
  10665. powerLevel?: 'low' | 'medium' | 'high'
  10666. /** 接口调用成功的回调函数 */
  10667. success?: StartAdvertisingSuccessCallback
  10668. }
  10669. interface StartBeaconDiscoveryOption {
  10670. /** Beacon 设备广播的 UUID 列表 */
  10671. uuids: string[]
  10672. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10673. complete?: StartBeaconDiscoveryCompleteCallback
  10674. /** 接口调用失败的回调函数 */
  10675. fail?: StartBeaconDiscoveryFailCallback
  10676. /** 是否校验蓝牙开关,仅在 iOS 下有效。iOS 11 起,控制面板里关掉蓝牙,还是能继续使用 Beacon 服务。 */
  10677. ignoreBluetoothAvailable?: boolean
  10678. /** 接口调用成功的回调函数 */
  10679. success?: StartBeaconDiscoverySuccessCallback
  10680. }
  10681. interface StartBluetoothDevicesDiscoveryOption {
  10682. /** 是否允许重复上报同一设备。如果允许重复上报,则 [wx.onBlueToothDeviceFound](#) 方法会多次上报同一设备,但是 RSSI 值会有不同。 */
  10683. allowDuplicatesKey?: boolean
  10684. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10685. complete?: StartBluetoothDevicesDiscoveryCompleteCallback
  10686. /** 接口调用失败的回调函数 */
  10687. fail?: StartBluetoothDevicesDiscoveryFailCallback
  10688. /** 上报设备的间隔,单位 ms。0 表示找到新设备立即上报,其他数值根据传入的间隔上报。 */
  10689. interval?: number
  10690. /** 扫描模式,越高扫描越快,也越耗电。仅安卓微信客户端 7.0.12 及以上支持。
  10691. *
  10692. * 可选值:
  10693. * - 'low': 低;
  10694. * - 'medium': 中;
  10695. * - 'high': 高; */
  10696. powerLevel?: 'low' | 'medium' | 'high'
  10697. /** 要搜索的蓝牙设备主服务的 UUID 列表(支持 16/32/128 位 UUID)。某些蓝牙设备会广播自己的主 service 的 UUID。如果设置此参数,则只搜索广播包有对应 UUID 的主服务的蓝牙设备。建议通过该参数过滤掉周边不需要处理的其他蓝牙设备。 */
  10698. services?: string[]
  10699. /** 接口调用成功的回调函数 */
  10700. success?: StartBluetoothDevicesDiscoverySuccessCallback
  10701. }
  10702. interface StartCastingOption {
  10703. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10704. complete?: StartCastingCompleteCallback
  10705. /** 接口调用失败的回调函数 */
  10706. fail?: StartCastingFailCallback
  10707. /** 接口调用成功的回调函数 */
  10708. success?: StartCastingSuccessCallback
  10709. }
  10710. interface StartCompassOption {
  10711. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10712. complete?: StartCompassCompleteCallback
  10713. /** 接口调用失败的回调函数 */
  10714. fail?: StartCompassFailCallback
  10715. /** 接口调用成功的回调函数 */
  10716. success?: StartCompassSuccessCallback
  10717. }
  10718. interface StartDeviceMotionListeningOption {
  10719. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10720. complete?: StartDeviceMotionListeningCompleteCallback
  10721. /** 接口调用失败的回调函数 */
  10722. fail?: StartDeviceMotionListeningFailCallback
  10723. /** 监听设备方向的变化回调函数的执行频率
  10724. *
  10725. * 可选值:
  10726. * - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右;
  10727. * - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右;
  10728. * - 'normal': 普通的回调频率,在 200ms/次 左右; */
  10729. interval?: 'game' | 'ui' | 'normal'
  10730. /** 接口调用成功的回调函数 */
  10731. success?: StartDeviceMotionListeningSuccessCallback
  10732. }
  10733. interface StartDiscoveryOption {
  10734. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10735. complete?: StartDiscoveryCompleteCallback
  10736. /** 接口调用失败的回调函数 */
  10737. fail?: StartDiscoveryFailCallback
  10738. /** 接口调用成功的回调函数 */
  10739. success?: StartDiscoverySuccessCallback
  10740. }
  10741. interface StartGyroscopeOption {
  10742. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10743. complete?: StartGyroscopeCompleteCallback
  10744. /** 接口调用失败的回调函数 */
  10745. fail?: StartGyroscopeFailCallback
  10746. /** 监听陀螺仪数据回调函数的执行频率
  10747. *
  10748. * 可选值:
  10749. * - 'game': 适用于更新游戏的回调频率,在 20ms/次 左右;
  10750. * - 'ui': 适用于更新 UI 的回调频率,在 60ms/次 左右;
  10751. * - 'normal': 普通的回调频率,在 200ms/次 左右; */
  10752. interval?: 'game' | 'ui' | 'normal'
  10753. /** 接口调用成功的回调函数 */
  10754. success?: StartGyroscopeSuccessCallback
  10755. }
  10756. interface StartHCEOption {
  10757. /** 需要注册到系统的 AID 列表 */
  10758. aid_list: string[]
  10759. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10760. complete?: StartHCECompleteCallback
  10761. /** 接口调用失败的回调函数 */
  10762. fail?: StartHCEFailCallback
  10763. /** 接口调用成功的回调函数 */
  10764. success?: StartHCESuccessCallback
  10765. }
  10766. interface StartLocalServiceDiscoveryFailCallbackResult {
  10767. /** 错误信息
  10768. *
  10769. * 可选值:
  10770. * - 'invalid param': serviceType 为空;
  10771. * - 'scan task already exist': 在当前 startLocalServiceDiscovery 发起的搜索未停止的情况下,再次调用 startLocalServiceDiscovery; */
  10772. errMsg: string
  10773. }
  10774. interface StartLocalServiceDiscoveryOption {
  10775. /** 要搜索的服务类型 */
  10776. serviceType: string
  10777. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10778. complete?: StartLocalServiceDiscoveryCompleteCallback
  10779. /** 接口调用失败的回调函数 */
  10780. fail?: StartLocalServiceDiscoveryFailCallback
  10781. /** 接口调用成功的回调函数 */
  10782. success?: StartLocalServiceDiscoverySuccessCallback
  10783. }
  10784. interface StartLocationUpdateBackgroundOption {
  10785. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10786. complete?: StartLocationUpdateBackgroundCompleteCallback
  10787. /** 接口调用失败的回调函数 */
  10788. fail?: StartLocationUpdateBackgroundFailCallback
  10789. /** 接口调用成功的回调函数 */
  10790. success?: StartLocationUpdateBackgroundSuccessCallback
  10791. /** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标 */
  10792. type?: string
  10793. }
  10794. interface StartLocationUpdateOption {
  10795. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10796. complete?: StartLocationUpdateCompleteCallback
  10797. /** 接口调用失败的回调函数 */
  10798. fail?: StartLocationUpdateFailCallback
  10799. /** 接口调用成功的回调函数 */
  10800. success?: StartLocationUpdateSuccessCallback
  10801. /** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标 */
  10802. type?: string
  10803. }
  10804. interface StartPreviewOption {
  10805. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10806. complete?: StartPreviewCompleteCallback
  10807. /** 接口调用失败的回调函数 */
  10808. fail?: StartPreviewFailCallback
  10809. /** 接口调用成功的回调函数 */
  10810. success?: StartPreviewSuccessCallback
  10811. }
  10812. interface StartPullDownRefreshOption {
  10813. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10814. complete?: StartPullDownRefreshCompleteCallback
  10815. /** 接口调用失败的回调函数 */
  10816. fail?: StartPullDownRefreshFailCallback
  10817. /** 接口调用成功的回调函数 */
  10818. success?: StartPullDownRefreshSuccessCallback
  10819. }
  10820. interface StartRecordSuccessCallbackResult {
  10821. /** 录音文件的临时路径 (本地路径) */
  10822. tempFilePath: string
  10823. errMsg: string
  10824. }
  10825. interface StartRecordTimeoutCallbackResult {
  10826. /** 封面图片文件的临时路径 (本地路径) */
  10827. tempThumbPath: string
  10828. /** 视频的文件的临时路径 (本地路径) */
  10829. tempVideoPath: string
  10830. }
  10831. interface StartSoterAuthenticationOption {
  10832. /** 挑战因子。挑战因子为调用者为此次生物鉴权准备的用于签名的字符串关键识别信息,将作为 `resultJSON` 的一部分,供调用者识别本次请求。例如:如果场景为请求用户对某订单进行授权确认,则可以将订单号填入此参数。 */
  10833. challenge: string
  10834. /** 请求使用的可接受的生物认证方式
  10835. *
  10836. * 可选值:
  10837. * - 'fingerPrint': 指纹识别;
  10838. * - 'facial': 人脸识别;
  10839. * - 'speech': 声纹识别(暂未支持); */
  10840. requestAuthModes: Array<'fingerPrint' | 'facial' | 'speech'>
  10841. /** 验证描述,即识别过程中显示在界面上的对话框提示内容 */
  10842. authContent?: string
  10843. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10844. complete?: StartSoterAuthenticationCompleteCallback
  10845. /** 接口调用失败的回调函数 */
  10846. fail?: StartSoterAuthenticationFailCallback
  10847. /** 接口调用成功的回调函数 */
  10848. success?: StartSoterAuthenticationSuccessCallback
  10849. }
  10850. interface StartSoterAuthenticationSuccessCallbackResult {
  10851. /** 生物认证方式 */
  10852. authMode: string
  10853. /** 错误码 */
  10854. errCode: number
  10855. /** 错误信息 */
  10856. errMsg: string
  10857. /** 在设备安全区域(TEE)内获得的本机安全信息(如TEE名称版本号等以及防重放参数)以及本次认证信息(仅Android支持,本次认证的指纹ID)。具体说明见下文 */
  10858. resultJSON: string
  10859. /** 用SOTER安全密钥对 `resultJSON` 的签名(SHA256 with RSA/PSS, saltlen=20) */
  10860. resultJSONSignature: string
  10861. }
  10862. interface StartWifiOption {
  10863. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10864. complete?: StartWifiCompleteCallback
  10865. /** 接口调用失败的回调函数 */
  10866. fail?: StartWifiFailCallback
  10867. /** 接口调用成功的回调函数 */
  10868. success?: StartWifiSuccessCallback
  10869. }
  10870. interface StatOption {
  10871. /** 文件/目录路径 (本地路径) */
  10872. path: string
  10873. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  10874. complete?: StatCompleteCallback
  10875. /** 接口调用失败的回调函数 */
  10876. fail?: StatFailCallback
  10877. /** 需要基础库: `2.3.0`
  10878. *
  10879. * 是否递归获取目录下的每个文件的 Stats 信息 */
  10880. recursive?: boolean
  10881. /** 接口调用成功的回调函数 */
  10882. success?: StatSuccessCallback
  10883. }
  10884. interface StatSuccessCallbackResult {
  10885. /** [Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)|Array.&lt;[FileStats](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileStats.html)&gt;
  10886. *
  10887. * 当 recursive 为 false 时,res.stats 是一个 Stats 对象。当 recursive 为 true 且 path 是一个目录的路径时,res.stats 是一个 Array,数组的每一项是一个对象,每个对象包含 path 和 stats。 */
  10888. stats: Stats | FileStats[]
  10889. errMsg: string
  10890. }
  10891. /** 描述文件状态的对象 */
  10892. interface Stats {
  10893. /** 文件最近一次被存取或被执行的时间,UNIX 时间戳,对应 POSIX stat.st_atime */
  10894. lastAccessedTime: number
  10895. /** 文件最后一次被修改的时间,UNIX 时间戳,对应 POSIX stat.st_mtime */
  10896. lastModifiedTime: number
  10897. /** 文件的类型和存取的权限,对应 POSIX stat.st_mode */
  10898. mode: number
  10899. /** 文件大小,单位:B,对应 POSIX stat.st_size */
  10900. size: number
  10901. /** [boolean Stats.isDirectory()](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.isDirectory.html)
  10902. *
  10903. * 在插件中使用:需要基础库 `2.19.2`
  10904. *
  10905. * 判断当前文件是否一个目录 */
  10906. isDirectory(): boolean
  10907. /** [boolean Stats.isFile()](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.isFile.html)
  10908. *
  10909. * 在插件中使用:需要基础库 `2.19.2`
  10910. *
  10911. * 判断当前文件是否一个普通文件 */
  10912. isFile(): boolean
  10913. }
  10914. interface StepOption {
  10915. /** 动画延迟时间,单位 ms */
  10916. delay?: number
  10917. /** 动画持续时间,单位 ms */
  10918. duration?: number
  10919. /** 动画的效果
  10920. *
  10921. * 可选值:
  10922. * - 'linear': 动画从头到尾的速度是相同的;
  10923. * - 'ease': 动画以低速开始,然后加快,在结束前变慢;
  10924. * - 'ease-in': 动画以低速开始;
  10925. * - 'ease-in-out': 动画以低速开始和结束;
  10926. * - 'ease-out': 动画以低速结束;
  10927. * - 'step-start': 动画第一帧就跳至结束状态直到结束;
  10928. * - 'step-end': 动画一直保持开始状态,最后一帧跳到结束状态; */
  10929. timingFunction?:
  10930. | 'linear'
  10931. | 'ease'
  10932. | 'ease-in'
  10933. | 'ease-in-out'
  10934. | 'ease-out'
  10935. | 'step-start'
  10936. | 'step-end'
  10937. transformOrigin?: string
  10938. }
  10939. /** 贴纸类型 */
  10940. interface Sticker {
  10941. /** 贴纸帧数 */
  10942. len: number
  10943. /** 贴纸资源路径。资源必须为一个资源文件夹路径或一个压缩包路径,文件夹或压缩包内的贴纸资源必须按照 `{title}_{index}.{ext}` 格式命名。其中 `{title}` 为贴纸名称;`{index}` 为帧序号,从0开始;`{ext}` 为拓展名。 */
  10944. path: string
  10945. /** 贴纸名称 */
  10946. title: string
  10947. /** 贴纸触发动作
  10948. *
  10949. * 可选值:
  10950. * - -1: 循环播放;
  10951. * - 10: 张嘴;
  10952. * - 11: 噘嘴/kiss;
  10953. * - 12: 眨/闭左眼;
  10954. * - 13: 眨/闭右眼;
  10955. * - 14: 眨/闭眼;
  10956. * - 15: 挑眉毛;
  10957. * - 16: 左右摇头;
  10958. * - 17: 上下点头;
  10959. * - 100: 比心;
  10960. * - 101: 张开手掌;
  10961. * - 102: 剪刀手/比耶/胜利;
  10962. * - 103: 握拳;
  10963. * - 104: 数字1;
  10964. * - 105: 我爱你;
  10965. * - 106: 点赞;
  10966. * - 107: OK;
  10967. * - 108: Rock&Roll;
  10968. * - 109: 数字6;
  10969. * - 110: 数字8;
  10970. * - 111: 暂不支持(留空);
  10971. * - 112: 双手抱拳/恭喜发财; */
  10972. active?:
  10973. | -1
  10974. | 10
  10975. | 11
  10976. | 12
  10977. | 13
  10978. | 14
  10979. | 15
  10980. | 16
  10981. | 17
  10982. | 100
  10983. | 101
  10984. | 102
  10985. | 103
  10986. | 104
  10987. | 105
  10988. | 106
  10989. | 107
  10990. | 108
  10991. | 109
  10992. | 110
  10993. | 111
  10994. | 112
  10995. /** 贴纸ID */
  10996. id?: string
  10997. /** 贴纸资源 md5 */
  10998. md5?: string
  10999. /** 贴纸位置,格式为 [x1,y1,x2,y2] 。当 `type` 为 `'2D'` 或 `'front'` 时必填。仅 2D 贴纸和前景贴纸有效 */
  11000. pos?: string[]
  11001. /** 背景贴纸展示位置。仅背景贴纸有效
  11002. *
  11003. * 可选值:
  11004. * - 0: 背景贴纸;
  11005. * - 1: 只在人像区域显示的贴纸; */
  11006. segtype?: 0 | 1
  11007. }
  11008. interface StopAccelerometerOption {
  11009. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11010. complete?: StopAccelerometerCompleteCallback
  11011. /** 接口调用失败的回调函数 */
  11012. fail?: StopAccelerometerFailCallback
  11013. /** 接口调用成功的回调函数 */
  11014. success?: StopAccelerometerSuccessCallback
  11015. }
  11016. interface StopAdvertisingOption {
  11017. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11018. complete?: StopAdvertisingCompleteCallback
  11019. /** 接口调用失败的回调函数 */
  11020. fail?: StopAdvertisingFailCallback
  11021. /** 接口调用成功的回调函数 */
  11022. success?: StopAdvertisingSuccessCallback
  11023. }
  11024. interface StopBGMOption {
  11025. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11026. complete?: StopBGMCompleteCallback
  11027. /** 接口调用失败的回调函数 */
  11028. fail?: StopBGMFailCallback
  11029. /** 接口调用成功的回调函数 */
  11030. success?: StopBGMSuccessCallback
  11031. }
  11032. interface StopBackgroundAudioOption {
  11033. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11034. complete?: StopBackgroundAudioCompleteCallback
  11035. /** 接口调用失败的回调函数 */
  11036. fail?: StopBackgroundAudioFailCallback
  11037. /** 接口调用成功的回调函数 */
  11038. success?: StopBackgroundAudioSuccessCallback
  11039. }
  11040. interface StopBeaconDiscoveryOption {
  11041. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11042. complete?: StopBeaconDiscoveryCompleteCallback
  11043. /** 接口调用失败的回调函数 */
  11044. fail?: StopBeaconDiscoveryFailCallback
  11045. /** 接口调用成功的回调函数 */
  11046. success?: StopBeaconDiscoverySuccessCallback
  11047. }
  11048. interface StopBluetoothDevicesDiscoveryOption {
  11049. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11050. complete?: StopBluetoothDevicesDiscoveryCompleteCallback
  11051. /** 接口调用失败的回调函数 */
  11052. fail?: StopBluetoothDevicesDiscoveryFailCallback
  11053. /** 接口调用成功的回调函数 */
  11054. success?: StopBluetoothDevicesDiscoverySuccessCallback
  11055. }
  11056. interface StopCompassOption {
  11057. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11058. complete?: StopCompassCompleteCallback
  11059. /** 接口调用失败的回调函数 */
  11060. fail?: StopCompassFailCallback
  11061. /** 接口调用成功的回调函数 */
  11062. success?: StopCompassSuccessCallback
  11063. }
  11064. interface StopDeviceMotionListeningOption {
  11065. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11066. complete?: StopDeviceMotionListeningCompleteCallback
  11067. /** 接口调用失败的回调函数 */
  11068. fail?: StopDeviceMotionListeningFailCallback
  11069. /** 接口调用成功的回调函数 */
  11070. success?: StopDeviceMotionListeningSuccessCallback
  11071. }
  11072. interface StopDiscoveryOption {
  11073. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11074. complete?: StopDiscoveryCompleteCallback
  11075. /** 接口调用失败的回调函数 */
  11076. fail?: StopDiscoveryFailCallback
  11077. /** 接口调用成功的回调函数 */
  11078. success?: StopDiscoverySuccessCallback
  11079. }
  11080. interface StopFaceDetectOption {
  11081. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11082. complete?: StopFaceDetectCompleteCallback
  11083. /** 接口调用失败的回调函数 */
  11084. fail?: StopFaceDetectFailCallback
  11085. /** 接口调用成功的回调函数 */
  11086. success?: StopFaceDetectSuccessCallback
  11087. }
  11088. interface StopGyroscopeOption {
  11089. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11090. complete?: StopGyroscopeCompleteCallback
  11091. /** 接口调用失败的回调函数 */
  11092. fail?: StopGyroscopeFailCallback
  11093. /** 接口调用成功的回调函数 */
  11094. success?: StopGyroscopeSuccessCallback
  11095. }
  11096. interface StopHCEOption {
  11097. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11098. complete?: StopHCECompleteCallback
  11099. /** 接口调用失败的回调函数 */
  11100. fail?: StopHCEFailCallback
  11101. /** 接口调用成功的回调函数 */
  11102. success?: StopHCESuccessCallback
  11103. }
  11104. interface StopLocalServiceDiscoveryFailCallbackResult {
  11105. /** 错误信息
  11106. *
  11107. * 可选值:
  11108. * - 'task not found': 在当前没有处在搜索服务中的情况下调用 stopLocalServiceDiscovery; */
  11109. errMsg: string
  11110. }
  11111. interface StopLocalServiceDiscoveryOption {
  11112. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11113. complete?: StopLocalServiceDiscoveryCompleteCallback
  11114. /** 接口调用失败的回调函数 */
  11115. fail?: StopLocalServiceDiscoveryFailCallback
  11116. /** 接口调用成功的回调函数 */
  11117. success?: StopLocalServiceDiscoverySuccessCallback
  11118. }
  11119. interface StopLocationUpdateOption {
  11120. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11121. complete?: StopLocationUpdateCompleteCallback
  11122. /** 接口调用失败的回调函数 */
  11123. fail?: StopLocationUpdateFailCallback
  11124. /** 接口调用成功的回调函数 */
  11125. success?: StopLocationUpdateSuccessCallback
  11126. }
  11127. interface StopOption {
  11128. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11129. complete?: StopCompleteCallback
  11130. /** 接口调用失败的回调函数 */
  11131. fail?: StopFailCallback
  11132. /** 接口调用成功的回调函数 */
  11133. success?: StopSuccessCallback
  11134. }
  11135. interface StopPreviewOption {
  11136. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11137. complete?: StopPreviewCompleteCallback
  11138. /** 接口调用失败的回调函数 */
  11139. fail?: StopPreviewFailCallback
  11140. /** 接口调用成功的回调函数 */
  11141. success?: StopPreviewSuccessCallback
  11142. }
  11143. interface StopPullDownRefreshOption {
  11144. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11145. complete?: StopPullDownRefreshCompleteCallback
  11146. /** 接口调用失败的回调函数 */
  11147. fail?: StopPullDownRefreshFailCallback
  11148. /** 接口调用成功的回调函数 */
  11149. success?: StopPullDownRefreshSuccessCallback
  11150. }
  11151. interface StopRecordSuccessCallbackResult {
  11152. /** 封面图片文件的临时路径 (本地路径) */
  11153. tempThumbPath: string
  11154. /** 视频的文件的临时路径 (本地路径) */
  11155. tempVideoPath: string
  11156. errMsg: string
  11157. }
  11158. interface StopVoiceOption {
  11159. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11160. complete?: StopVoiceCompleteCallback
  11161. /** 接口调用失败的回调函数 */
  11162. fail?: StopVoiceFailCallback
  11163. /** 接口调用成功的回调函数 */
  11164. success?: StopVoiceSuccessCallback
  11165. }
  11166. interface StopWifiOption {
  11167. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11168. complete?: StopWifiCompleteCallback
  11169. /** 接口调用失败的回调函数 */
  11170. fail?: StopWifiFailCallback
  11171. /** 接口调用成功的回调函数 */
  11172. success?: StopWifiSuccessCallback
  11173. }
  11174. interface SubscribeVoIPVideoMembersOption {
  11175. /** 订阅的成员列表 */
  11176. openIdList: string[]
  11177. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11178. complete?: SubscribeVoIPVideoMembersCompleteCallback
  11179. /** 接口调用失败的回调函数 */
  11180. fail?: SubscribeVoIPVideoMembersFailCallback
  11181. /** 接口调用成功的回调函数 */
  11182. success?: SubscribeVoIPVideoMembersSuccessCallback
  11183. }
  11184. /** 订阅消息设置
  11185. *
  11186. * **示例代码**
  11187. *
  11188. * ```javascript
  11189. wx.getSetting({
  11190. withSubscriptions: true,
  11191. success (res) {
  11192. console.log(res.authSetting)
  11193. // res.authSetting = {
  11194. // "scope.userInfo": true,
  11195. // "scope.userLocation": true
  11196. // }
  11197. console.log(res.subscriptionsSetting)
  11198. // res.subscriptionsSetting = {
  11199. // mainSwitch: true, // 订阅消息总开关
  11200. // itemSettings: { // 每一项开关
  11201. // SYS_MSG_TYPE_INTERACTIVE: 'accept', // 小游戏系统订阅消息
  11202. // SYS_MSG_TYPE_RANK: 'accept'
  11203. // zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: 'reject', // 普通一次性订阅消息
  11204. // ke_OZC_66gZxALLcsuI7ilCJSP2OJ2vWo2ooUPpkWrw: 'ban',
  11205. // }
  11206. // }
  11207. }
  11208. })
  11209. ``` */
  11210. interface SubscriptionsSetting {
  11211. /** 订阅消息总开关,true为开启,false为关闭 */
  11212. mainSwitch: boolean
  11213. /** 每一项订阅消息的订阅状态。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](https://developers.weixin.qq.com/minigame/dev/api/open-api/subscribe-message/wx.requestSubscribeSystemMessage.html)
  11214. * ## 注意事项
  11215. * - itemSettings 只返回用户勾选过订阅面板中的“总是保持以上选择,不再询问”的订阅消息。 */
  11216. itemSettings?: IAnyObject
  11217. }
  11218. interface SwitchCameraOption {
  11219. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11220. complete?: SwitchCameraCompleteCallback
  11221. /** 接口调用失败的回调函数 */
  11222. fail?: SwitchCameraFailCallback
  11223. /** 接口调用成功的回调函数 */
  11224. success?: SwitchCameraSuccessCallback
  11225. }
  11226. interface SwitchCastingOption {
  11227. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11228. complete?: SwitchCastingCompleteCallback
  11229. /** 接口调用失败的回调函数 */
  11230. fail?: SwitchCastingFailCallback
  11231. /** 接口调用成功的回调函数 */
  11232. success?: SwitchCastingSuccessCallback
  11233. }
  11234. interface SwitchTabOption {
  11235. /** 需要跳转的 tabBar 页面的路径 (代码包路径)(需在 app.json 的 [tabBar](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#tabbar) 字段定义的页面),路径后不能带参数。 */
  11236. url: string
  11237. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11238. complete?: SwitchTabCompleteCallback
  11239. /** 接口调用失败的回调函数 */
  11240. fail?: SwitchTabFailCallback
  11241. /** 接口调用成功的回调函数 */
  11242. success?: SwitchTabSuccessCallback
  11243. }
  11244. interface SystemInfo {
  11245. /** 需要基础库: `1.1.0`
  11246. *
  11247. * 客户端基础库版本 */
  11248. SDKVersion: string
  11249. /** 需要基础库: `2.6.0`
  11250. *
  11251. * 允许微信使用相册的开关(仅 iOS 有效) */
  11252. albumAuthorized: boolean
  11253. /** 需要基础库: `1.8.0`
  11254. *
  11255. * 设备性能等级(仅 Android)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好)<br> 注意:性能等级当前仅反馈真机机型,暂不支持 IDE 模拟器机型 */
  11256. benchmarkLevel: number
  11257. /** 需要基础库: `2.6.0`
  11258. *
  11259. * 蓝牙的系统开关 */
  11260. bluetoothEnabled: boolean
  11261. /** 需要基础库: `1.5.0`
  11262. *
  11263. * 设备品牌 */
  11264. brand: string
  11265. /** 需要基础库: `2.6.0`
  11266. *
  11267. * 允许微信使用摄像头的开关 */
  11268. cameraAuthorized: boolean
  11269. /** 设备方向
  11270. *
  11271. * 可选值:
  11272. * - 'portrait': 竖屏;
  11273. * - 'landscape': 横屏; */
  11274. deviceOrientation: 'portrait' | 'landscape'
  11275. /** 需要基础库: `2.15.0`
  11276. *
  11277. * 是否已打开调试。可通过右上角菜单或 [wx.setEnableDebug](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html) 打开调试。 */
  11278. enableDebug: boolean
  11279. /** 需要基础库: `1.5.0`
  11280. *
  11281. * 用户字体大小(单位px)。以微信客户端「我-设置-通用-字体大小」中的设置为准 */
  11282. fontSizeSetting: number
  11283. /** 需要基础库: `2.12.3`
  11284. *
  11285. * 当前小程序运行的宿主环境 */
  11286. host: SystemInfoHost
  11287. /** 微信设置的语言 */
  11288. language: string
  11289. /** 需要基础库: `2.6.0`
  11290. *
  11291. * 允许微信使用定位的开关 */
  11292. locationAuthorized: boolean
  11293. /** 需要基础库: `2.6.0`
  11294. *
  11295. * 地理位置的系统开关 */
  11296. locationEnabled: boolean
  11297. /** `true` 表示模糊定位,`false` 表示精确定位,仅 iOS 支持 */
  11298. locationReducedAccuracy: boolean
  11299. /** 需要基础库: `2.6.0`
  11300. *
  11301. * 允许微信使用麦克风的开关 */
  11302. microphoneAuthorized: boolean
  11303. /** 设备型号。新机型刚推出一段时间会显示unknown,微信会尽快进行适配。 */
  11304. model: string
  11305. /** 需要基础库: `2.6.0`
  11306. *
  11307. * 允许微信通知带有提醒的开关(仅 iOS 有效) */
  11308. notificationAlertAuthorized: boolean
  11309. /** 需要基础库: `2.6.0`
  11310. *
  11311. * 允许微信通知的开关 */
  11312. notificationAuthorized: boolean
  11313. /** 需要基础库: `2.6.0`
  11314. *
  11315. * 允许微信通知带有标记的开关(仅 iOS 有效) */
  11316. notificationBadgeAuthorized: boolean
  11317. /** 需要基础库: `2.6.0`
  11318. *
  11319. * 允许微信通知带有声音的开关(仅 iOS 有效) */
  11320. notificationSoundAuthorized: boolean
  11321. /** 需要基础库: `2.19.3`
  11322. *
  11323. * 允许微信使用日历的开关 */
  11324. phoneCalendarAuthorized: boolean
  11325. /** 设备像素比 */
  11326. pixelRatio: number
  11327. /** 客户端平台
  11328. *
  11329. * 可选值:
  11330. * - 'ios': iOS微信(包含 iPhone、iPad);
  11331. * - 'android': Android微信;
  11332. * - 'windows': Windows微信;
  11333. * - 'mac': macOS微信;
  11334. * - 'devtools': 微信开发者工具; */
  11335. platform: 'ios' | 'android' | 'windows' | 'mac' | 'devtools'
  11336. /** 需要基础库: `2.7.0`
  11337. *
  11338. * 在竖屏正方向下的安全区域。部分机型没有安全区域概念,也不会返回 safeArea 字段,开发者需自行兼容。 */
  11339. safeArea: SafeArea
  11340. /** 需要基础库: `1.1.0`
  11341. *
  11342. * 屏幕高度,单位px */
  11343. screenHeight: number
  11344. /** 需要基础库: `1.1.0`
  11345. *
  11346. * 屏幕宽度,单位px */
  11347. screenWidth: number
  11348. /** 需要基础库: `1.9.0`
  11349. *
  11350. * 状态栏的高度,单位px */
  11351. statusBarHeight: number
  11352. /** 操作系统及版本 */
  11353. system: string
  11354. /** 微信版本号 */
  11355. version: string
  11356. /** 需要基础库: `2.6.0`
  11357. *
  11358. * Wi-Fi 的系统开关 */
  11359. wifiEnabled: boolean
  11360. /** 可使用窗口高度,单位px */
  11361. windowHeight: number
  11362. /** 可使用窗口宽度,单位px */
  11363. windowWidth: number
  11364. /** 需要基础库: `2.11.0`
  11365. *
  11366. * 系统当前主题,取值为`light`或`dark`,全局配置`"darkmode":true`时才能获取,否则为 undefined (不支持小游戏)
  11367. *
  11368. * 可选值:
  11369. * - 'dark': 深色主题;
  11370. * - 'light': 浅色主题; */
  11371. theme?: 'dark' | 'light'
  11372. }
  11373. /** 需要基础库: `2.12.3`
  11374. *
  11375. * 当前小程序运行的宿主环境 */
  11376. interface SystemInfoHost {
  11377. /** 宿主 app 对应的 appId */
  11378. appId: string
  11379. }
  11380. interface SystemSetting {
  11381. /** 蓝牙的系统开关 */
  11382. bluetoothEnabled: boolean
  11383. /** 设备方向
  11384. *
  11385. * 可选值:
  11386. * - 'portrait': 竖屏;
  11387. * - 'landscape': 横屏; */
  11388. deviceOrientation: 'portrait' | 'landscape'
  11389. /** 地理位置的系统开关 */
  11390. locationEnabled: boolean
  11391. /** Wi-Fi 的系统开关 */
  11392. wifiEnabled: boolean
  11393. }
  11394. interface TCPSocketConnectOption {
  11395. /** 套接字要连接的地址 */
  11396. address: string
  11397. /** 套接字要连接的端口 */
  11398. port: number
  11399. /** 套接字要连接的超时时间,默认为 2s */
  11400. timeout?: number
  11401. }
  11402. interface TCPSocketOnMessageListenerResult {
  11403. /** 接收端地址信息 */
  11404. localInfo: LocalInfo
  11405. /** 收到的消息 */
  11406. message: ArrayBuffer
  11407. /** 发送端地址信息 */
  11408. remoteInfo: RemoteInfo
  11409. }
  11410. interface TakePhotoOption {
  11411. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11412. complete?: TakePhotoCompleteCallback
  11413. /** 接口调用失败的回调函数 */
  11414. fail?: TakePhotoFailCallback
  11415. /** 成像质量
  11416. *
  11417. * 可选值:
  11418. * - 'high': 高质量;
  11419. * - 'normal': 普通质量;
  11420. * - 'low': 低质量;
  11421. * - 'original': 原图; */
  11422. quality?: 'high' | 'normal' | 'low' | 'original'
  11423. /** 需要基础库: `2.22.0`
  11424. *
  11425. * 是否开启镜像 */
  11426. selfieMirror?: boolean
  11427. /** 接口调用成功的回调函数 */
  11428. success?: TakePhotoSuccessCallback
  11429. }
  11430. interface TakePhotoSuccessCallbackResult {
  11431. /** 照片文件的临时路径 (本地路径),安卓是jpg图片格式,ios是png */
  11432. tempImagePath: string
  11433. errMsg: string
  11434. }
  11435. interface TakeSnapshotOption {
  11436. /** 截图文件格式,'rgba' 或 'png',默认值为 'png' */
  11437. format: string
  11438. /** 截图导出类型,'file' 保存到临时文件目录或 'arraybuffer' 返回图片二进制数据,默认值为 'file' */
  11439. type: string
  11440. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11441. complete?: TakeSnapshotCompleteCallback
  11442. /** 接口调用失败的回调函数 */
  11443. fail?: TakeSnapshotFailCallback
  11444. /** 接口调用成功的回调函数 */
  11445. success?: TakeSnapshotSuccessCallback
  11446. }
  11447. interface TakeSnapshotSuccessCallbackResult {
  11448. /** 截图对应的二进制数据,当 type 为 arraybuffer 该字段生效 */
  11449. data: ArrayBuffer
  11450. /** 截图保存的临时文件路径,当 type 为 file 该字段生效 */
  11451. tempFilePath: string
  11452. errMsg: string
  11453. }
  11454. /** 标签类型枚举 */
  11455. interface TechType {
  11456. /** 对应IsoDep实例,实例支持ISO-DEP (ISO 14443-4)标准的读写 */
  11457. isoDep: string
  11458. /** 对应MifareClassic实例,实例支持MIFARE Classic标签的读写 */
  11459. mifareClassic: string
  11460. /** 对应MifareUltralight实例,实例支持MIFARE Ultralight标签的读写 */
  11461. mifareUltralight: string
  11462. /** 对应Ndef实例,实例支持对NDEF格式的NFC标签上的NDEF数据的读写 */
  11463. ndef: string
  11464. /** 对应NfcA实例,实例支持NFC-A (ISO 14443-3A)标准的读写 */
  11465. nfcA: string
  11466. /** 对应NfcB实例,实例支持NFC-B (ISO 14443-3B)标准的读写 */
  11467. nfcB: string
  11468. /** 对应NfcF实例,实例支持NFC-F (JIS 6319-4)标准的读写 */
  11469. nfcF: string
  11470. /** 对应NfcV实例,实例支持NFC-V (ISO 15693)标准的读写 */
  11471. nfcV: string
  11472. }
  11473. /** 需要基础库: `2.30.0`
  11474. *
  11475. * 在插件中使用:需要基础库 `2.30.0`
  11476. *
  11477. * Tensor
  11478. *
  11479. * ****
  11480. *
  11481. * ```js
  11482. session.run({
  11483. input1: {
  11484. type: 'float32',
  11485. data: new Float32Array(3 * 224 * 224).buffer,
  11486. shape: [1, 3, 224, 224] // NCHW 顺序
  11487. },
  11488. input2: {
  11489. type: 'uint8',
  11490. data: new Uint8Array(224 * 224).buffer,
  11491. shape: [1, 1, 224, 224]
  11492. },
  11493. }).then(res => {
  11494. console.log(res.output0)
  11495. // output0 结构如下:
  11496. // {
  11497. // type: 'uint8',
  11498. // data: new Uint8Array(224 * 224).buffer,
  11499. // shape: [1, 1, 224, 224]
  11500. // }
  11501. })
  11502. ``` */
  11503. interface Tensor {
  11504. /** Tensor 值,一段 ArrayBuffer */
  11505. data: ArrayBuffer
  11506. /** Tensor shape (Tensor 形状,例如 `[1, 3, 224, 224]` 即表示一个4唯Tensor,每个维度的长度分别为1, 3, 224, 224) */
  11507. shape: number[]
  11508. /** ArrayBuffer 值的类型,合法值有 `uint8`, `int8`, `uint32`, `int32`, `float32` */
  11509. type: string
  11510. }
  11511. /** 需要基础库: `2.30.0`
  11512. *
  11513. * 在插件中使用:需要基础库 `2.30.0`
  11514. *
  11515. * Tensors 是 key-value 形式的对象,对象的 key 会作为 input/output name,对象的 value 则是 Tensor。 Tensor 结构如下。
  11516. *
  11517. * ****
  11518. *
  11519. * ```js
  11520. session.run({
  11521. input1: {
  11522. type: 'float32',
  11523. data: new Float32Array(3 * 224 * 224).buffer,
  11524. shape: [1, 3, 224, 224] // NCHW 顺序
  11525. },
  11526. input2: {
  11527. type: 'uint8',
  11528. data: new Uint8Array(224 * 224).buffer,
  11529. shape: [1, 1, 224, 224]
  11530. },
  11531. }).then(res => {
  11532. console.log(res.output0)
  11533. // output0 结构如下:
  11534. // {
  11535. // type: 'uint8',
  11536. // data: new Uint8Array(224 * 224).buffer,
  11537. // shape: [1, 1, 224, 224]
  11538. // }
  11539. })
  11540. ``` */
  11541. interface Tensors {
  11542. /** [Tensor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/Tensor.html)
  11543. *
  11544. * Tensor,每个 Tensor 包含 shape、data、type 字段。 */
  11545. key: Tensor
  11546. }
  11547. interface TextMetrics {
  11548. /** 文本的宽度 */
  11549. width: number
  11550. }
  11551. /** 动画配置 */
  11552. interface TimingOption {
  11553. /** 动画时长 */
  11554. duration?: number
  11555. /** 动画曲线,参考 [Easing](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html) 模块。 */
  11556. easing?: (...args: any[]) => any
  11557. }
  11558. interface ToScreenLocationOption {
  11559. /** 纬度 */
  11560. latitude: number
  11561. /** 经度 */
  11562. longitude: number
  11563. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11564. complete?: ToScreenLocationCompleteCallback
  11565. /** 接口调用失败的回调函数 */
  11566. fail?: ToScreenLocationFailCallback
  11567. /** 接口调用成功的回调函数 */
  11568. success?: ToScreenLocationSuccessCallback
  11569. }
  11570. interface ToScreenLocationSuccessCallbackResult {
  11571. /** x 坐标值 */
  11572. x: number
  11573. /** y 坐标值 */
  11574. y: number
  11575. errMsg: string
  11576. }
  11577. interface ToggleTorchOption {
  11578. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11579. complete?: ToggleTorchCompleteCallback
  11580. /** 接口调用失败的回调函数 */
  11581. fail?: ToggleTorchFailCallback
  11582. /** 接口调用成功的回调函数 */
  11583. success?: ToggleTorchSuccessCallback
  11584. }
  11585. /** 跟踪能力配置,目前不同的跟踪能力之间是互斥的,默认使用平面跟踪能力。需要注意目前 track 中不同的跟踪配置存在互斥关系(比如 marker 跟踪配置和 OSD 跟踪配置不能同时存在),请按需配置。 */
  11586. interface Track {
  11587. /** 平面跟踪配置 */
  11588. plane: PlaneTrack
  11589. /** 需要基础库: `2.27.0`
  11590. *
  11591. * OCR检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/ocr.html)。 */
  11592. OCR?: OCRTrack
  11593. /** 需要基础库: `2.24.5`
  11594. *
  11595. * OSD 跟踪配置 */
  11596. OSD?: boolean
  11597. /** 需要基础库: `2.28.0`
  11598. *
  11599. * 人体检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/body.html)。 */
  11600. body?: BodyTrack
  11601. /** 需要基础库: `3.0.0`
  11602. *
  11603. * 深度识别配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/depth.html)。 */
  11604. depth?: DepthTrack
  11605. /** 需要基础库: `2.25.0`
  11606. *
  11607. * 人脸检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/face.html)。安卓微信8.0.25开始支持,iOS微信8.0.24开始支持。 */
  11608. face?: FaceTrack
  11609. /** 需要基础库: `2.28.0`
  11610. *
  11611. * 手势检测配置。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/hand.html)。 */
  11612. hand?: HandTrack
  11613. /** 需要基础库: `2.24.5`
  11614. *
  11615. * marker 跟踪配置,基础库(3.0.0)开始允许同时支持v2的水平面检测能力 */
  11616. marker?: boolean
  11617. /** 需要基础库: `2.28.0`
  11618. *
  11619. * 提供基础AR功能,输出相机旋转的3个自由度的位姿,利用手机陀螺仪传感器,实现快速稳定的AR定位能力,适用于简单AR场景。 */
  11620. threeDof?: boolean
  11621. }
  11622. interface TransceiveOption {
  11623. /** 需要传递的二进制数据 */
  11624. data: ArrayBuffer
  11625. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11626. complete?: TransceiveCompleteCallback
  11627. /** 接口调用失败的回调函数 */
  11628. fail?: TransceiveFailCallback
  11629. /** 接口调用成功的回调函数 */
  11630. success?: TransceiveSuccessCallback
  11631. }
  11632. interface TransceiveSuccessCallbackResult {
  11633. data: ArrayBuffer
  11634. errMsg: string
  11635. }
  11636. interface TranslateMarkerOption {
  11637. /** 移动过程中是否自动旋转 marker */
  11638. autoRotate: boolean
  11639. /** 指定 marker 移动到的目标点 */
  11640. destination: DestinationOption
  11641. /** 指定 marker */
  11642. markerId: number
  11643. /** marker 的旋转角度 */
  11644. rotate: number
  11645. /** 动画结束回调函数 */
  11646. animationEnd?: (...args: any[]) => any
  11647. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11648. complete?: TranslateMarkerCompleteCallback
  11649. /** 动画持续时长,平移与旋转分别计算 */
  11650. duration?: number
  11651. /** 接口调用失败的回调函数 */
  11652. fail?: TranslateMarkerFailCallback
  11653. /** 需要基础库: `2.13.0`
  11654. *
  11655. * 平移和旋转同时进行 */
  11656. moveWithRotate?: boolean
  11657. /** 接口调用成功的回调函数 */
  11658. success?: TranslateMarkerSuccessCallback
  11659. }
  11660. interface TriggerRefreshOption {
  11661. /** 动画时长 */
  11662. duration?: number
  11663. /** [动画曲线](#) */
  11664. easingFunction?: string
  11665. }
  11666. interface TruncateOption {
  11667. /** 要截断的文件路径 (本地路径) */
  11668. filePath: string
  11669. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11670. complete?: TruncateCompleteCallback
  11671. /** 接口调用失败的回调函数 */
  11672. fail?: TruncateFailCallback
  11673. /** 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,则会对其进行扩展,并且扩展部分将填充空字节('\0') */
  11674. length?: number
  11675. /** 接口调用成功的回调函数 */
  11676. success?: TruncateSuccessCallback
  11677. }
  11678. interface TruncateSyncOption {
  11679. /** 要截断的文件路径 (本地路径) */
  11680. filePath: string
  11681. /** 截断位置,默认0。如果 length 小于文件长度(字节),则只有前面 length 个字节会保留在文件中,其余内容会被删除;如果 length 大于文件长度,则会对其进行扩展,并且扩展部分将填充空字节('\0') */
  11682. length?: number
  11683. }
  11684. interface UDPSocketConnectOption {
  11685. /** 要发消息的地址 */
  11686. address: string
  11687. /** 要发送消息的端口号 */
  11688. port: number
  11689. }
  11690. interface UDPSocketOnMessageListenerResult {
  11691. /** 接收端地址信息,2.18.0 起支持 */
  11692. localInfo: LocalInfo
  11693. /** 收到的消息。消息长度需要小于4096。 */
  11694. message: ArrayBuffer
  11695. /** 发送端地址信息 */
  11696. remoteInfo: RemoteInfo
  11697. }
  11698. interface UDPSocketSendOption {
  11699. /** 要发消息的地址。在基础库 <= 2.9.3 版本必须是和本机同网段的 IP 地址,或安全域名列表内的域名地址;之后版本可以是任意 IP 和域名 */
  11700. address: string
  11701. /** 要发送的数据 */
  11702. message: string | ArrayBuffer
  11703. /** 要发送消息的端口号 */
  11704. port: number
  11705. /** 发送数据的长度,仅当 message 为 ArrayBuffer 类型时有效 */
  11706. length?: number
  11707. /** 发送数据的偏移量,仅当 message 为 ArrayBuffer 类型时有效 */
  11708. offset?: number
  11709. /** 向指定地址发消息时,是否要开启广播,基础库 2.24.0 开始支持 */
  11710. setBroadcast?: boolean
  11711. }
  11712. interface UndoOption {
  11713. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11714. complete?: UndoCompleteCallback
  11715. /** 接口调用失败的回调函数 */
  11716. fail?: UndoFailCallback
  11717. /** 接口调用成功的回调函数 */
  11718. success?: UndoSuccessCallback
  11719. }
  11720. interface UnlinkOption {
  11721. /** 要删除的文件路径 (本地路径) */
  11722. filePath: string
  11723. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11724. complete?: UnlinkCompleteCallback
  11725. /** 接口调用失败的回调函数 */
  11726. fail?: UnlinkFailCallback
  11727. /** 接口调用成功的回调函数 */
  11728. success?: UnlinkSuccessCallback
  11729. }
  11730. interface UnzipOption {
  11731. /** 目标目录路径, 支持本地路径 */
  11732. targetPath: string
  11733. /** 源文件路径,支持本地路径, 只可以是 zip 压缩文件 */
  11734. zipFilePath: string
  11735. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11736. complete?: UnzipCompleteCallback
  11737. /** 接口调用失败的回调函数 */
  11738. fail?: UnzipFailCallback
  11739. /** 接口调用成功的回调函数 */
  11740. success?: UnzipSuccessCallback
  11741. }
  11742. /** 参数列表 */
  11743. interface UpdatableMessageFrontEndParameter {
  11744. /** 参数名 */
  11745. name: string
  11746. /** 参数值 */
  11747. value: string
  11748. }
  11749. /** 需要基础库: `2.4.0`
  11750. *
  11751. * 动态消息的模板信息 */
  11752. interface UpdatableMessageFrontEndTemplateInfo {
  11753. /** 参数列表 */
  11754. parameterList: UpdatableMessageFrontEndParameter[]
  11755. }
  11756. interface UpdateGroundOverlayOption {
  11757. /** 图片覆盖的经纬度范围 */
  11758. bounds: MapBounds
  11759. /** 图片图层 id */
  11760. id: string
  11761. /** 图片路径,支持网络图片、临时路径、代码包路径 */
  11762. src: string
  11763. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11764. complete?: UpdateGroundOverlayCompleteCallback
  11765. /** 接口调用失败的回调函数 */
  11766. fail?: UpdateGroundOverlayFailCallback
  11767. /** 图层透明度 */
  11768. opacity?: number
  11769. /** 接口调用成功的回调函数 */
  11770. success?: UpdateGroundOverlaySuccessCallback
  11771. /** 是否可见 */
  11772. visible?: boolean
  11773. /** 图层绘制顺序 */
  11774. zIndex?: number
  11775. }
  11776. interface UpdateShareMenuOption {
  11777. /** 需要基础库: `2.4.0`
  11778. *
  11779. * 动态消息的 activityId。通过 [updatableMessage.createActivityId](#) 接口获取 */
  11780. activityId?: string
  11781. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11782. complete?: UpdateShareMenuCompleteCallback
  11783. /** 接口调用失败的回调函数 */
  11784. fail?: UpdateShareMenuFailCallback
  11785. /** 需要基础库: `2.13.0`
  11786. *
  11787. * 是否是私密消息。详见 [小程序私密消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share/private-message.html) */
  11788. isPrivateMessage?: boolean
  11789. /** 需要基础库: `2.4.0`
  11790. *
  11791. * 是否是动态消息,详见[动态消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share/updatable-message.html) */
  11792. isUpdatableMessage?: boolean
  11793. /** 接口调用成功的回调函数 */
  11794. success?: UpdateShareMenuSuccessCallback
  11795. /** 需要基础库: `2.4.0`
  11796. *
  11797. * 动态消息的模板信息 */
  11798. templateInfo?: UpdatableMessageFrontEndTemplateInfo
  11799. /** 需要基础库: `2.11.0`
  11800. *
  11801. * 群待办消息的id,通过toDoActivityId可以把多个群待办消息聚合为同一个。通过 [updatableMessage.createActivityId](#) 接口获取。详见[群待办消息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
  11802. toDoActivityId?: string
  11803. /** 是否使用带 shareTicket 的转发[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
  11804. withShareTicket?: boolean
  11805. }
  11806. interface UpdateVoIPChatMuteConfigOption {
  11807. /** 静音设置 */
  11808. muteConfig: MuteConfig
  11809. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11810. complete?: UpdateVoIPChatMuteConfigCompleteCallback
  11811. /** 接口调用失败的回调函数 */
  11812. fail?: UpdateVoIPChatMuteConfigFailCallback
  11813. /** 接口调用成功的回调函数 */
  11814. success?: UpdateVoIPChatMuteConfigSuccessCallback
  11815. }
  11816. interface UpdateWeChatAppOption {
  11817. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11818. complete?: UpdateWeChatAppCompleteCallback
  11819. /** 接口调用失败的回调函数 */
  11820. fail?: UpdateWeChatAppFailCallback
  11821. /** 接口调用成功的回调函数 */
  11822. success?: UpdateWeChatAppSuccessCallback
  11823. }
  11824. interface UploadFileOption {
  11825. /** 要上传文件资源的路径 (本地路径) */
  11826. filePath: string
  11827. /** 文件对应的 key,开发者在服务端可以通过这个 key 获取文件的二进制内容 */
  11828. name: string
  11829. /** 开发者服务器地址 */
  11830. url: string
  11831. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  11832. complete?: UploadFileCompleteCallback
  11833. /** 接口调用失败的回调函数 */
  11834. fail?: UploadFileFailCallback
  11835. /** HTTP 请求中其他额外的 form data */
  11836. formData?: IAnyObject
  11837. /** HTTP 请求 Header,Header 中不能设置 Referer */
  11838. header?: IAnyObject
  11839. /** 接口调用成功的回调函数 */
  11840. success?: UploadFileSuccessCallback
  11841. /** 需要基础库: `2.10.0`
  11842. *
  11843. * 超时时间,单位为毫秒 */
  11844. timeout?: number
  11845. }
  11846. interface UploadFileSuccessCallbackResult {
  11847. /** 开发者服务器返回的数据 */
  11848. data: string
  11849. /** 开发者服务器返回的 HTTP 状态码 */
  11850. statusCode: number
  11851. errMsg: string
  11852. }
  11853. interface UploadTaskOnProgressUpdateListenerResult {
  11854. /** 上传进度百分比 */
  11855. progress: number
  11856. /** 预期需要上传的数据总长度,单位 Bytes */
  11857. totalBytesExpectedToSend: number
  11858. /** 已经上传的数据长度,单位 Bytes */
  11859. totalBytesSent: number
  11860. }
  11861. /** @warning **用户头像昵称获取规则已调整,参考 [用户信息接口调整说明](https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801)、[小程序用户头像昵称获取规则调整公告](https://developers.weixin.qq.com/community/develop/doc/00022c683e8a80b29bed2142b56c01)**
  11862. *
  11863. * 用户信息 */
  11864. interface UserInfo {
  11865. /** 用户头像图片的 URL。URL 最后一个数值代表正方形头像大小(有 0、46、64、96、132 数值可选,0 代表 640x640 的正方形头像,46 表示 46x46 的正方形头像,剩余数值以此类推。默认132),用户没有头像时该项为空。若用户更换头像,原有头像 URL 将失效。 */
  11866. avatarUrl: string
  11867. /** 用户所在城市。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
  11868. city: string
  11869. /** 用户所在国家。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
  11870. country: string
  11871. /** 用户性别。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801)
  11872. *
  11873. * 可选值:
  11874. * - 0: 未知;
  11875. * - 1: 男性;
  11876. * - 2: 女性; */
  11877. gender: 0 | 1 | 2
  11878. /** 显示 country,province,city 所用的语言。强制返回 “zh_CN”,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801)
  11879. *
  11880. * 可选值:
  11881. * - 'en': 英文;
  11882. * - 'zh_CN': 简体中文;
  11883. * - 'zh_TW': 繁体中文; */
  11884. language: 'en' | 'zh_CN' | 'zh_TW'
  11885. /** 用户昵称 */
  11886. nickName: string
  11887. /** 用户所在省份。不再返回,参考 [相关公告](https://developers.weixin.qq.com/community/develop/doc/00028edbe3c58081e7cc834705b801) */
  11888. province: string
  11889. }
  11890. /** 需要基础库: `2.28.0`
  11891. *
  11892. * 人体 anchor
  11893. *
  11894. * **示例代码**
  11895. *
  11896. * [静态图像body检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/photo-body-detect)
  11897. *
  11898. * [实时摄像头body检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/body-detect) */
  11899. interface VKBodyAnchor {
  11900. /** 关键点的置信度 */
  11901. confidence: number[]
  11902. /** 识别序号 */
  11903. detectId: number
  11904. /** 唯一标识 */
  11905. id: number
  11906. /** 相对视窗的位置信息,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
  11907. origin: VKOrigin
  11908. /** 关键点 */
  11909. points: VKOrigin[]
  11910. /** 总体置信值 */
  11911. score: number
  11912. /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
  11913. size: VKSize
  11914. /** 类型
  11915. *
  11916. * 可选值:
  11917. * - 5: 人体; */
  11918. type: 5
  11919. }
  11920. /** 需要基础库: `2.20.0`
  11921. *
  11922. * 相机对象 */
  11923. interface VKCamera {
  11924. /** 需要基础库: `2.22.0`
  11925. *
  11926. * 相机内参,只有 v2 版本支持 */
  11927. intrinsics: Float32Array
  11928. /** 视图矩阵 */
  11929. viewMatrix: Float32Array
  11930. /** [Float32Array VKCamera.getProjectionMatrix(number near, number far)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKCamera.getProjectionMatrix.html)
  11931. *
  11932. * 需要基础库: `2.20.0`
  11933. *
  11934. * 在插件中使用:需要基础库 `2.20.0`
  11935. *
  11936. * 获取投影矩阵 */
  11937. getProjectionMatrix(
  11938. /** 近视点 */
  11939. near: number,
  11940. /** 远视点 */
  11941. far: number
  11942. ): Float32Array
  11943. }
  11944. interface VKConfig {
  11945. /** 跟踪能力配置,目前不同的跟踪能力之间是互斥的,默认使用平面跟踪能力。需要注意目前 track 中不同的跟踪配置存在互斥关系(比如 marker 跟踪配置和 OSD 跟踪配置不能同时存在),请按需配置。 */
  11946. track: Track
  11947. /** 需要基础库: `2.23.0`
  11948. *
  11949. * 绑定的 WebGLRenderingContext 对象 */
  11950. gl?: WebGLRenderingContext
  11951. /** 需要基础库: `2.22.0`
  11952. *
  11953. * vision kit 版本。
  11954. *
  11955. * 可选值:
  11956. * - 'v1': v1适用于用户在平面场景下,例如桌面,地面,泛平面场景,放置虚拟物体,不提供真实世界距离。用户放置物体时,手机相机倾斜向下对着目标平面点击即可,具有广泛的机型支持;
  11957. * - 'v2': v2提供真实物理距离的 ar 定位功能,提供平面识别功能,用户在平面范围点击放置虚拟物体的功能,具有[有限的机型支持](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/plane.html#%E9%99%84%E5%BD%95)。iOS 设备在基础库 2.22.0 开始支持v2。安卓设备在基础库 2.25.1 开始支持v2,另外,安卓v2不支持竖直平面。**使用v2算法需要初始化,移动手机进行左右平移初始化效果最佳。**; */
  11958. version?: 'v1' | 'v2'
  11959. }
  11960. /** 需要基础库: `2.33.0`
  11961. *
  11962. * depth anchor
  11963. *
  11964. * **示例代码**
  11965. *
  11966. * [深度估计能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/depth-detect) */
  11967. interface VKDepthAnchor {
  11968. /** 包含深度信息的数组 */
  11969. depthArray: number[]
  11970. /** 唯一标识 */
  11971. id: number
  11972. /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
  11973. size: VKSize
  11974. /** 类型
  11975. *
  11976. * 可选值:
  11977. * - 8: DEPTH; */
  11978. type: 8
  11979. }
  11980. /** 需要基础库: `2.25.0`
  11981. *
  11982. * 人脸 anchor
  11983. *
  11984. * **示例代码**
  11985. *
  11986. * [静态图像人脸检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/photo-face-detect)
  11987. *
  11988. * [实时摄像头人脸检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/face-detect) */
  11989. interface VKFaceAnchor {
  11990. /** 人脸角度信息 */
  11991. angle: number[]
  11992. /** 关键点的置信度 */
  11993. confidence: number[]
  11994. /** 识别序号 */
  11995. detectId: number
  11996. /** 唯一标识 */
  11997. id: number
  11998. /** 相对视窗的位置信息,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
  11999. origin: VKOrigin
  12000. /** 人脸 106 个关键点的坐标 */
  12001. points: VKPoint[]
  12002. /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
  12003. size: VKSize
  12004. /** 类型
  12005. *
  12006. * 可选值:
  12007. * - 3: 人脸; */
  12008. type: 3
  12009. }
  12010. /** 需要基础库: `2.20.0`
  12011. *
  12012. * vision kit 会话对象。 */
  12013. interface VKFrame {
  12014. /** [VKCamera](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKCamera.html)
  12015. *
  12016. * 相机对象 */
  12017. camera: VKCamera
  12018. /** 生成时间,单位:纳秒(ns) */
  12019. timestamp: number
  12020. /** [ArrayBuffer VKFrame.getCameraBuffer(number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getCameraBuffer.html)
  12021. *
  12022. * 需要基础库: `2.24.0`
  12023. *
  12024. * 在插件中使用:不支持
  12025. *
  12026. * 获取当前帧 rgba buffer。iOS 端微信在 v8.0.20 开始支持,安卓端微信在 v8.0.30 开始支持。按 aspect-fill 规则裁剪,此接口要求在创建 VKSession 对象时必须传入 gl 参数。此接口仅建议拿来做帧分析使用,上屏请使用 getCameraTexture 来代替。 */
  12027. getCameraBuffer(
  12028. /** 宽度,受系统限制,必须是 16 的整数倍 */
  12029. width: number,
  12030. /** 高度 */
  12031. height: number
  12032. ): ArrayBuffer
  12033. /** [Float32Array VKFrame.getDisplayTransform()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getDisplayTransform.html)
  12034. *
  12035. * 需要基础库: `2.20.0`
  12036. *
  12037. * 在插件中使用:需要基础库 `2.20.0`
  12038. *
  12039. * 获取纹理调整矩阵。默认获取到的纹理是未经裁剪调整的纹理,此矩阵可用于在着色器中根据帧对象尺寸对纹理进行裁剪。 */
  12040. getDisplayTransform(): Float32Array
  12041. /** [Object VKFrame.getCameraTexture(WebGLRenderingContext gl)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getCameraTexture.html)
  12042. *
  12043. * 需要基础库: `2.20.0`
  12044. *
  12045. * 在插件中使用:需要基础库 `2.20.0`
  12046. *
  12047. * 获取当前帧纹理,目前只支持 YUV 纹理。 */
  12048. getCameraTexture(
  12049. /** 画布 */
  12050. gl: WebGLRenderingContext
  12051. ): YUVTextureRes
  12052. }
  12053. /** 需要基础库: `2.28.0`
  12054. *
  12055. * 手势 anchor
  12056. *
  12057. * **示例代码**
  12058. *
  12059. * [静态图像hand检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/photo-hand-detect)
  12060. *
  12061. * [实时摄像头hand检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/hand-detect) */
  12062. interface VKHandAnchor {
  12063. /** 关键点的置信度 */
  12064. confidence: number[]
  12065. /** 识别序号 */
  12066. detectId: number
  12067. /** 手势分类, 返回整数-1到18, -1表示无效手势
  12068. *
  12069. * 可选值:
  12070. * - 0: 单手比心;
  12071. * - 1: 布(数字5);
  12072. * - 2: 剪刀(数字2);
  12073. * - 3: 握拳;
  12074. * - 4: 数字1;
  12075. * - 5: 热爱;
  12076. * - 6: 点赞;
  12077. * - 7: 数字3;
  12078. * - 8: 摇滚;
  12079. * - 9: 数字6;
  12080. * - 10: 数字8;
  12081. * - 11: 双手抱拳(恭喜发财);
  12082. * - 12: 数字4;
  12083. * - 13: 比ok;
  12084. * - 14: 不喜欢(踩);
  12085. * - 15: 双手比心;
  12086. * - 16: 祈祷(双手合十);
  12087. * - 17: 双手抱拳;
  12088. * - 18: 无手势动作;
  12089. * - -1: 无效手势; */
  12090. gesture:
  12091. | 0
  12092. | 1
  12093. | 2
  12094. | 3
  12095. | 4
  12096. | 5
  12097. | 6
  12098. | 7
  12099. | 8
  12100. | 9
  12101. | 10
  12102. | 11
  12103. | 12
  12104. | 13
  12105. | 14
  12106. | 15
  12107. | 16
  12108. | 17
  12109. | 18
  12110. | -1
  12111. /** 唯一标识 */
  12112. id: number
  12113. /** 相对视窗的位置信息,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
  12114. origin: VKOrigin
  12115. /** 关键点 */
  12116. points: VKOrigin[]
  12117. /** 总体置信值 */
  12118. score: number
  12119. /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
  12120. size: VKSize
  12121. /** 类型
  12122. *
  12123. * 可选值:
  12124. * - 7: 手势; */
  12125. type: 7
  12126. }
  12127. interface VKMarker {
  12128. /** marker id */
  12129. markerId: number
  12130. /** 图片路径 */
  12131. path: string
  12132. }
  12133. /** 需要基础库: `2.24.5`
  12134. *
  12135. * marker anchor
  12136. *
  12137. * **示例代码**
  12138. *
  12139. * [2D Marker能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/2dmarker-ar) */
  12140. interface VKMarkerAnchor {
  12141. /** 唯一标识 */
  12142. id: number
  12143. /** marker id */
  12144. markerId: number
  12145. /** 图片路径 */
  12146. path: string
  12147. /** 包含位置、旋转、放缩信息的矩阵,以列为主序 */
  12148. transform: Float32Array
  12149. /** 类型
  12150. *
  12151. * 可选值:
  12152. * - 1: marker; */
  12153. type: 1
  12154. }
  12155. /** 需要基础库: `2.27.0`
  12156. *
  12157. * OCR anchor
  12158. *
  12159. * **示例代码**
  12160. *
  12161. * [静态图像OCR检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/photo-ocr-detect)
  12162. *
  12163. * [实时摄像头OCR检测能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/ocr-detect) */
  12164. interface VKOCRAnchor {
  12165. /** 唯一标识 */
  12166. id: number
  12167. /** 识别的文字结果 */
  12168. text: string
  12169. /** 类型
  12170. *
  12171. * 可选值:
  12172. * - 6: OCR; */
  12173. type: 6
  12174. }
  12175. /** 需要基础库: `2.24.5`
  12176. *
  12177. * OSD anchor
  12178. *
  12179. * **示例代码**
  12180. *
  12181. * [单样本检测(OSD)能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/osd-ar) */
  12182. interface VKOSDAnchor {
  12183. /** 唯一标识 */
  12184. id: number
  12185. /** marker id */
  12186. markerId: number
  12187. /** 相对视窗的位置信息,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
  12188. origin: VKOrigin
  12189. /** 图片路径 */
  12190. path: string
  12191. /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
  12192. size: VKSize
  12193. /** 类型
  12194. *
  12195. * 可选值:
  12196. * - 2: OSD; */
  12197. type: 2
  12198. }
  12199. interface VKOrigin {
  12200. /** 横坐标 */
  12201. x: number
  12202. /** 纵坐标 */
  12203. y: number
  12204. }
  12205. /** 需要基础库: `2.22.0`
  12206. *
  12207. * 平面 anchor,只有 v2 版本支持
  12208. *
  12209. * **示例代码**
  12210. *
  12211. * v1 版本:[水平面AR能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/plane-ar)
  12212. * v2 版本:[水平面AR能力v2使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/plane-ar-v2) */
  12213. interface VKPlaneAnchor {
  12214. /** 方向 */
  12215. alignment: number
  12216. /** 唯一标识 */
  12217. id: number
  12218. /** 尺寸 */
  12219. size: VKSize
  12220. /** 包含位置、旋转、放缩信息的矩阵,以列为主序 */
  12221. transform: Float32Array
  12222. /** 类型
  12223. *
  12224. * 可选值:
  12225. * - 0: 平面; */
  12226. type: 0
  12227. }
  12228. /** 人脸 106 个关键点的坐标 */
  12229. interface VKPoint {
  12230. /** 横坐标 */
  12231. x: number
  12232. /** 纵坐标 */
  12233. y: number
  12234. }
  12235. /** 需要基础库: `2.20.0`
  12236. *
  12237. * vision kit 会话对象。 */
  12238. interface VKSession {
  12239. /** 相机尺寸 */
  12240. cameraSize: VKSize
  12241. /** 会话配置 */
  12242. config: VKConfig
  12243. /** 会话状态
  12244. *
  12245. * 可选值:
  12246. * - 0: 不可用;
  12247. * - 1: 运行中;
  12248. * - 2: 暂停中;
  12249. * - 3: 初始化中; */
  12250. state: 0 | 1 | 2 | 3
  12251. /** [Array.&lt;Object&gt; VKSession.getAllMarker()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.getAllMarker.html)
  12252. *
  12253. * 需要基础库: `2.24.5`
  12254. *
  12255. * 在插件中使用:需要基础库 `2.24.5`
  12256. *
  12257. * 获取所有 marker,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.marker 为 true */
  12258. getAllMarker(): VKMarker[]
  12259. /** [Array.&lt;Object&gt; VKSession.getAllOSDMarker()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.getAllOSDMarker.html)
  12260. *
  12261. * 需要基础库: `2.24.5`
  12262. *
  12263. * 在插件中使用:需要基础库 `2.24.5`
  12264. *
  12265. * 获取所有 OSD marker,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.OSD 为 true */
  12266. getAllOSDMarker(): VKMarker[]
  12267. /** [Array.&lt;Object&gt; VKSession.hitTest(number x, number y, Object reset)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.hitTest.html)
  12268. *
  12269. * 需要基础库: `2.20.0`
  12270. *
  12271. * 在插件中使用:需要基础库 `2.20.0`
  12272. *
  12273. * 触摸检测,v1 版本只支持单平面(即 hitTest 生成一次平面后,后续 hitTest 均不会再生成平面,而是以之前生成的平面为基础进行检测)。如果需要重新识别其他平面,可以在调用此方法时将 reset 参数置为 true。 */
  12274. hitTest(
  12275. /** 相对视窗的横坐标,取值范围为 [0, 1],0 为左边缘,1 为右边缘 */
  12276. x: number,
  12277. /** 相对视窗的纵坐标,取值范围为 [0, 1],0 为上边缘,1 为下边缘 */
  12278. y: number,
  12279. /** 是否需要重新识别其他平面,v2 版本不再需要此参数 */
  12280. reset: IAnyObject
  12281. ): HitTestRes[]
  12282. /** [VKSession.cancelAnimationFrame(number requestID)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.cancelAnimationFrame.html)
  12283. *
  12284. * 需要基础库: `2.20.0`
  12285. *
  12286. * 在插件中使用:需要基础库 `2.20.0`
  12287. *
  12288. * 取消由 requestAnimationFrame 添加到计划中的动画帧请求。 */
  12289. cancelAnimationFrame(requestID: number): void
  12290. /** [VKSession.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.destroy.html)
  12291. *
  12292. * 需要基础库: `2.20.0`
  12293. *
  12294. * 在插件中使用:需要基础库 `2.20.0`
  12295. *
  12296. * 销毁会话。 */
  12297. destroy(): void
  12298. /** [VKSession.detectBody(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.detectBody.html)
  12299. *
  12300. * 需要基础库: `2.28.0`
  12301. *
  12302. * 在插件中使用:需要基础库 `2.28.0`
  12303. *
  12304. * 静态图像人体关键点检测。当 wx.createVKSession 参数传入 {track: {body: {mode: 2} } } 时可用。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/body.html)。 */
  12305. detectBody(option: DetectBodyOption): void
  12306. /** [VKSession.detectDepth(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.detectDepth.html)
  12307. *
  12308. * 需要基础库: `2.33.0`
  12309. *
  12310. * 在插件中使用:需要基础库 `2.33.0`
  12311. *
  12312. * 深度识别。当 wx.createVKSession 参数传入 {track: {depth: {mode: 2} } } 时可用。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/depth.html)。 */
  12313. detectDepth(option: DetectDepthOption): void
  12314. /** [VKSession.detectFace(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.detectFace.html)
  12315. *
  12316. * 需要基础库: `2.25.0`
  12317. *
  12318. * 在插件中使用:需要基础库 `2.25.0`
  12319. *
  12320. * 静态图像人脸关键点检测。当 wx.createVKSession 参数传入 {track: {face: {mode: 2} } } 时可用。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/face.html)。安卓微信8.0.25开始支持,iOS微信8.0.24开始支持。
  12321. *
  12322. * ****
  12323. *
  12324. * ### 特别说明
  12325. * 若小程序人脸识别功能涉及采集、存储用户生物特征(如人脸照片或视频、身份证和手持身份证、身份证照和免冠照等),此类型服务需使用[微信原生人脸识别接口](https://developers.weixin.qq.com/community/develop/doc/000442d352c1202bd498ecb105c00d?highline=%E4%BA%BA%E8%84%B8%E6%A0%B8%E8%BA%AB)。 */
  12326. detectFace(option: DetectFaceOption): void
  12327. /** [VKSession.detectHand(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.detectHand.html)
  12328. *
  12329. * 需要基础库: `2.28.0`
  12330. *
  12331. * 在插件中使用:需要基础库 `2.28.0`
  12332. *
  12333. * 静态图像手势关键点检测。当 wx.createVKSession 参数传入 {track: {hand: {mode: 2} } } 时可用。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/hand.html)。 */
  12334. detectHand(option: DetectHandOption): void
  12335. /** [VKSession.off(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.off.html)
  12336. *
  12337. * 需要基础库: `2.20.0`
  12338. *
  12339. * 在插件中使用:需要基础库 `2.20.0`
  12340. *
  12341. * 取消监听会话事件。 */
  12342. off(
  12343. /** 事件名称 */
  12344. eventName: string,
  12345. /** 事件监听函数 */
  12346. fn: (...args: any[]) => any
  12347. ): void
  12348. /** [VKSession.on(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.on.html)
  12349. *
  12350. * 需要基础库: `2.20.0`
  12351. *
  12352. * 在插件中使用:需要基础库 `2.20.0`
  12353. *
  12354. * 监听会话事件。 */
  12355. on(
  12356. /** 事件名称
  12357. *
  12358. * 参数 eventName 可选值:
  12359. * - 'resize': 相机尺寸变化事件,回调参数为相机尺寸;
  12360. * - 'addAnchors': 增加 anchor 事件,回调参数为 [VKPlaneAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKPlaneAnchor.html)/[VKMarkerAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKMarkerAnchor.html)/[VKOSDAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKOSDAnchor.html) 列表(只有v2版本支持);
  12361. * - 'updateAnchors': 更新 anchor 事件,回调参数为 [VKPlaneAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKPlaneAnchor.html)/[VKMarkerAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKMarkerAnchor.html)/[VKOSDAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKOSDAnchor.html) 列表(只有v2版本支持) 或 [VKFaceAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFaceAnchor.html)/[VKOCRAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKOCRAnchor.html)/[VKHandAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKHandAnchor.html)/[VKBodyAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKBodyAnchor.html)列表(v1、v2都支持);
  12362. * - 'removeAnchors': 删除 anchor 事件,回调参数为 [VKPlaneAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKPlaneAnchor.html)/[VKMarkerAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKMarkerAnchor.html)/[VKOSDAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKOSDAnchor.html) 列表(只有v2版本支持) 或 [VKFaceAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFaceAnchor.html)/[VKOCRAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKOCRAnchor.html)/[VKHandAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKHandAnchor.html)/[VKBodyAnchor](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKBodyAnchor.html) 列表(v1、v2都支持); */
  12363. eventName:
  12364. | 'resize'
  12365. | 'addAnchors'
  12366. | 'updateAnchors'
  12367. | 'removeAnchors',
  12368. /** 事件监听函数 */
  12369. fn: (...args: any[]) => any
  12370. ): void
  12371. /** [VKSession.removeMarker(number markerId)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.removeMarker.html)
  12372. *
  12373. * 需要基础库: `2.24.5`
  12374. *
  12375. * 在插件中使用:需要基础库 `2.24.5`
  12376. *
  12377. * 删除一个 marker,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.marker 为 true */
  12378. removeMarker(
  12379. /** marker id */
  12380. markerId: number
  12381. ): void
  12382. /** [VKSession.removeOSDMarker(number markerId)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.removeOSDMarker.html)
  12383. *
  12384. * 需要基础库: `2.24.5`
  12385. *
  12386. * 在插件中使用:需要基础库 `2.24.5`
  12387. *
  12388. * 删除一个 OSD marker,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.OSD 为 true */
  12389. removeOSDMarker(
  12390. /** marker id */
  12391. markerId: number
  12392. ): void
  12393. /** [VKSession.runOCR(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.runOCR.html)
  12394. *
  12395. * 需要基础库: `2.27.0`
  12396. *
  12397. * 在插件中使用:需要基础库 `2.27.0`
  12398. *
  12399. * 静态图像OCR检测。当 wx.createVKSession 参数传入 {track: {OCR: {mode: 2} } } 时可用。用法详情[指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/ocr.html)。 */
  12400. runOCR(option: RunOCROption): void
  12401. /** [VKSession.start(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.start.html)
  12402. *
  12403. * 需要基础库: `2.20.0`
  12404. *
  12405. * 在插件中使用:需要基础库 `2.20.0`
  12406. *
  12407. * 开启会话。 */
  12408. start(
  12409. /** 开启会话回调 */
  12410. callback: VKSessionStartCallback
  12411. ): void
  12412. /** [VKSession.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.stop.html)
  12413. *
  12414. * 需要基础库: `2.20.0`
  12415. *
  12416. * 在插件中使用:需要基础库 `2.20.0`
  12417. *
  12418. * 停止会话。 */
  12419. stop(): void
  12420. /** [VKSession.update3DMode(boolean open3d)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.update3DMode.html)
  12421. *
  12422. * 需要基础库: `2.30.2`
  12423. *
  12424. * 在插件中使用:需要基础库 `2.30.2`
  12425. *
  12426. * 开启3D模式 */
  12427. update3DMode(
  12428. /** 是否开启 */
  12429. open3d: boolean
  12430. ): void
  12431. /** [VKSession.updateOSDThreshold(number threshold)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.updateOSDThreshold.html)
  12432. *
  12433. * 需要基础库: `2.24.5`
  12434. *
  12435. * 在插件中使用:需要基础库 `2.24.5`
  12436. *
  12437. * 更新 OSD 识别精确度,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.OSD 为 true */
  12438. updateOSDThreshold(
  12439. /** 阈值 */
  12440. threshold: number
  12441. ): void
  12442. /** [[VKFrame](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.html) VKSession.getVKFrame(number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.getVKFrame.html)
  12443. *
  12444. * 需要基础库: `2.20.0`
  12445. *
  12446. * 在插件中使用:需要基础库 `2.20.0`
  12447. *
  12448. * 获取帧对象,每调用一次都会触发一次帧分析过程。目前 VKSession 相机的最大帧数是 30 fps,因此调用 getVKFrame 的频率也可以限制在 30 fps,以减少渲染开销。 */
  12449. getVKFrame(
  12450. /** 宽度 */
  12451. width: number,
  12452. /** 高度 */
  12453. height: number
  12454. ): VKFrame
  12455. /** [number VKSession.addMarker(string path)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.addMarker.html)
  12456. *
  12457. * 需要基础库: `2.24.5`
  12458. *
  12459. * 在插件中使用:需要基础库 `2.24.5`
  12460. *
  12461. * 添加一个 marker,要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.marker 为 true
  12462. *
  12463. * **使用提示**
  12464. *
  12465. * 注意事项:
  12466. * 1. 使用 addMarker 接口之前,需要在 createVKSession 的时候声明开启 marker 跟踪。即 wx.createVKSession({ track: { marker: true } })
  12467. * 2. 可以添加多个 marker 图片,但不能重复添加相同的 marker 图片。
  12468. * 3. 在v2模式下同时支持水平面检测与marker检测,同时可输出多个2d/3d marker位姿(需要基础库版本不低于 [2.33.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
  12469. *
  12470. * ### 2Dmarker
  12471. * 对传入的图片有如下要求:
  12472. * 1. 格式:jpg/png 格式三通道彩图或者 1 通道灰度图
  12473. * 2. 分辨率:尺寸在 480x480 ~ 1920x1920 之间,建议为 1080 分辨率
  12474. * 3. 宽高比:在 1:1 ~ 16:9 之间,要求尽量方正,避免狭长的图片
  12475. * 4. 质量:目标图像为平面模型,需要占画面主体,避免大面积留白,建议用扫描件
  12476. *
  12477. * 示例:
  12478. *
  12479. * <img width="500px" src="https://res.wx.qq.com/op_res/sJPS5gttY4yQq-CmG9crrtaOpjb6Yc6mDhJKdUmrIpmtbWBMfAUAFavtKT6-tEZIh-8zT8tfBJBtvH048ge5Vw" alt="image.png" />
  12480. *
  12481. * 建议:
  12482. *
  12483. * 1. 图片具有丰富的细节
  12484. * 2. 避免重复单一的纹理,例如:
  12485. *
  12486. * <img width="500px" src="https://res.wx.qq.com/op_res/VfNcS-M6nPWWXq_CJ483Dq3iLsNXMvLiM6Wb5ZHOrVVGR2u5ixbQlbiSSuNHzVcMQQY5V0dvnlyOGihUIbyTvA" alt="image.png" />
  12487. * <br>
  12488. * <img width="500px" src="https://res.wx.qq.com/op_res/VfNcS-M6nPWWXq_CJ483Dq-_lR2j4eOi23IOJ2LHFQY_PWufbx3s3uROgLi_flJMHQA8DNvlebs9UwumozPlXg" alt="image.png" />
  12489. * <br>
  12490. * <img width="500px" src="https://res.wx.qq.com/op_res/VfNcS-M6nPWWXq_CJ483Dr9IaSPF18UPnz4KrbAhGW9pIb8oWxzHgmClGIRZK59N4gUnJh69yoQW1TFGqce8ew" alt="image.png" />
  12491. * <br>
  12492. *
  12493. * 3. 避免使用柔和平滑边缘的纹理及大量渐变图像,例如:
  12494. *
  12495. * <img width="500px" src="https://res.wx.qq.com/op_res/rg0BkiSl-LPBybgJtcQCq6DPj88qSVwHFZiumbE0IMq9ibzbnhjewzUSa-n5_VgF_lF9g07FFHHYyrY14KTSfA" alt="image.png" />
  12496. *
  12497. * 4. 避免模糊,建议采用高清、高对比度图像作为识别对象
  12498. * 5. 建议图像有均匀的特征(角点)分布,正确示例:
  12499. *
  12500. * <img width="500px" src="https://res.wx.qq.com/op_res/sJPS5gttY4yQq-CmG9crrrBRWB_Cw2aFXAn1KY0YtfjnQ7WNt854gA8H2zfmZUztlFcJbdEHouBGs63hUO4Mxg" alt="image.png" />
  12501. *
  12502. * 避免角点较少、中间大量空白、没有特征及角点的图像,错误示例:
  12503. *
  12504. * <img width="500px" src="https://res.wx.qq.com/op_res/rg0BkiSl-LPBybgJtcQCqzjY2LY-ylRjFS7TVD-cZsEE8TTB-xzR2YiWKhWyWg1bgpbRqQq-4l6OWPDii4S3Xg" alt="image.png" />
  12505. *
  12506. * ### 3Dmarker
  12507. * 现小程序demo支持通过上传视频, 生成对应模型的3dmarker识别文件,后缀名为.map
  12508. *
  12509. * 对传入的视频有如下要求:
  12510. * 1.视频长宽比为16:9或4:3; 短边大于480px
  12511. * 2.目标物体易于和背景物体区分出来,同时目标物体放置与背景物体一定距离,放置底面与物体易于区分,底面可以放置一张白纸,例如:
  12512. *
  12513. * <img width="500px" src="https://res.wx.qq.com/op_res/a0ooLtlHHfpfb37tq3AxZWPrfqINIs2MvJnZxQeTLzkpbgAGn6m8CaWAoy_osmlVDVhWm16e-yBDXjIY0dhCEQ" alt="image.png" />
  12514. *
  12515. * 3.目标物体最好为刚体,本身不会发生较大形变, 容易变形的物体不适合用作识别对象
  12516. * 4.视频匀速移动,避免模糊,对目标识别面环绕物体拍摄,需要保证相机有足够的平移移动
  12517. * 5.marker物体要求与2d图像要求类似,具有丰富细节,避免重复单一纹理,不反光,无高光
  12518. * 6.拍摄视频中特征纹理丰富,如果marker本身问题较弱,可以在背景中适当添加纹理物体
  12519. * 服务耗时:当前版本30s视频耗时约20分钟,请静待算法返回模型
  12520. *
  12521. * 建议:
  12522. *
  12523. * 1.视频格式:视频帧率30fps,分辨率建议1080p
  12524. * 2.视频时长:视频建议时长在20s~30s,超过30s会被截断,时长过短会导致marker效果欠佳 */
  12525. addMarker(
  12526. /** 图片路径,目前只支持本地用户图片 */
  12527. path: string
  12528. ): number
  12529. /** [number VKSession.addOSDMarker(string path)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.addOSDMarker.html)
  12530. *
  12531. * 需要基础库: `2.24.5`
  12532. *
  12533. * 在插件中使用:需要基础库 `2.24.5`
  12534. *
  12535. * 添加一个 OSD marker(one-shot detection marker),要求调 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 时传入的 track.OSD 为 true
  12536. *
  12537. * **使用提示**
  12538. *
  12539. * 注意事项:
  12540. * 1. 使用 addOSDMarker 接口之前,需要在 createVKSession 的时候声明开启 OSD 跟踪。即 wx.createVKSession({ track: { OSD: true } })
  12541. * 2. 可以添加多个 OSDMarker 图片,但不能重复添加相同的 OSDMarker 图片。
  12542. *
  12543. * 对传入的图片有如下要求:
  12544. * 1. 格式:jpg 格式彩色图片
  12545. * 2. 分辨率:尺寸不低于 240x240
  12546. * 3. 宽高比:在 1:1 ~ 16:9 之间,要求尽量方正,避免狭长的图片
  12547. * 4. 质量:目标物体需要占画面主体,避免大面积留白,避免大面积文字,不能含其他物体。
  12548. *
  12549. * 示例:
  12550. *
  12551. * <img width="500px" src="https://res.wx.qq.com/op_res/rg0BkiSl-LPBybgJtcQCq_Mq0ReXEA5nOzDIvnYYPttmwxn0V1e_yI6UUgkNT6K6aOQj2QRba5IHQglHULkrKg" alt="image.png" />
  12552. * <br>
  12553. * <img width="500px" src="https://res.wx.qq.com/op_res/rg0BkiSl-LPBybgJtcQCqwiRcyGk9oenkCpd3vAHWSTSZPPJcgIrPzcpwnSpmk_9bMiCqUdS8Ds789Rjhy0CtA" alt="image.png" />
  12554. * <br>
  12555. * <img width="500px" src="https://res.wx.qq.com/op_res/rg0BkiSl-LPBybgJtcQCqx8fYUYypBmFmB1_zX-APH06j1oMZDz7K0CE2To_982NDOB5fmM4Y2Rrr1uQF6J4gg" alt="image.png" />
  12556. * <br>
  12557. *
  12558. * 建议:
  12559. *
  12560. * 1. 具有丰富的细节,避免纯色且形状特点不鲜明的物体,例如:
  12561. *
  12562. * <img width="500px" src="https://res.wx.qq.com/op_res/rg0BkiSl-LPBybgJtcQCq-6WwSZKlNbN-if0NCag-Dm6AmNJeBFi5dvR-bRZINlZmuA9G1e4wpngvhlr2z6CXQ" alt="image.png" />
  12563. *
  12564. * 2. 避免模糊,最好采用高清图片 */
  12565. addOSDMarker(
  12566. /** 图片路径,目前只支持本地用户图片 */
  12567. path: string
  12568. ): number
  12569. /** [number VKSession.requestAnimationFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.requestAnimationFrame.html)
  12570. *
  12571. * 需要基础库: `2.20.0`
  12572. *
  12573. * 在插件中使用:需要基础库 `2.20.0`
  12574. *
  12575. * 在下次进行重绘时执行。 */
  12576. requestAnimationFrame(
  12577. /** 执行的 callback */
  12578. callback: (...args: any[]) => any
  12579. ): number
  12580. }
  12581. interface VKSize {
  12582. /** 高度 */
  12583. height: number
  12584. /** 宽度 */
  12585. width: number
  12586. }
  12587. interface VibrateLongOption {
  12588. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  12589. complete?: VibrateLongCompleteCallback
  12590. /** 接口调用失败的回调函数 */
  12591. fail?: VibrateLongFailCallback
  12592. /** 接口调用成功的回调函数 */
  12593. success?: VibrateLongSuccessCallback
  12594. }
  12595. interface VibrateShortFailCallbackResult {
  12596. /** 错误信息
  12597. *
  12598. * 可选值:
  12599. * - 'style is not support': 当前设备不支持设置震动等级; */
  12600. errMsg: string
  12601. }
  12602. interface VibrateShortOption {
  12603. /** 需要基础库: `2.13.0`
  12604. *
  12605. * 震动强度类型,有效值为:heavy、medium、light */
  12606. type: string
  12607. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  12608. complete?: VibrateShortCompleteCallback
  12609. /** 接口调用失败的回调函数 */
  12610. fail?: VibrateShortFailCallback
  12611. /** 接口调用成功的回调函数 */
  12612. success?: VibrateShortSuccessCallback
  12613. }
  12614. interface VideoContextRequestFullScreenOption {
  12615. /** 需要基础库: `1.7.0`
  12616. *
  12617. * 设置全屏时视频的方向,不指定则根据宽高比自动判断。
  12618. *
  12619. * 可选值:
  12620. * - 0: 正常竖向;
  12621. * - 90: 屏幕逆时针90度;
  12622. * - -90: 屏幕顺时针90度; */
  12623. direction?: 0 | 90 | -90
  12624. }
  12625. interface VideoDecoderStartOption {
  12626. /** 需要解码的视频源文件。基础库 2.13.0 以下的版本只支持本地路径。 2.13.0 开始支持 http:// 和 https:// 协议的远程路径。 */
  12627. source: string
  12628. /** 需要基础库: `2.15.0`
  12629. *
  12630. * 是否不需要音频轨道 */
  12631. abortAudio?: boolean
  12632. /** 需要基础库: `2.15.0`
  12633. *
  12634. * 是否不需要视频轨道 */
  12635. abortVideo?: boolean
  12636. /** 解码模式。0:按 pts 解码;1:以最快速度解码 */
  12637. mode?: number
  12638. }
  12639. interface VoIP1v1ChatUser {
  12640. /** 昵称 */
  12641. nickname: string
  12642. /** 小程序内 openid */
  12643. openid: string
  12644. /** 头像 */
  12645. headImage?: string
  12646. }
  12647. /** 需要基础库: `2.19.0`
  12648. *
  12649. * WebAudioContext 实例,通过[wx.createWebAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createWebAudioContext.html) 接口获取该实例。
  12650. *
  12651. * **示例代码**
  12652. *
  12653. * ```js
  12654. // 监听状态
  12655. const audioCtx = wx.createWebAudioContext()
  12656. audioCtx.onstatechange = () => {
  12657. console.log(ctx.state)
  12658. }
  12659. setTimeout(audioCtx.suspend, 1000)
  12660. setTimeout(audioCtx.resume, 2000)
  12661. ``` */
  12662. interface WebAudioContext {
  12663. /** 获取当前上下文的时间戳。 */
  12664. currentTime: number
  12665. /** [WebAudioContextNode](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContextNode.html)
  12666. *
  12667. * 当前上下文的最终目标节点,一般是音频渲染设备。 */
  12668. destination: WebAudioContextNode
  12669. /** 空间音频监听器。 */
  12670. listener: AudioListener
  12671. /** 可写属性,开发者可以对该属性设置一个监听函数,当WebAudio状态改变的时候,会触发开发者设置的监听函数。 */
  12672. onstatechange: (...args: any[]) => any
  12673. /** 采样率,通常在8000-96000之间,通常44100hz的采样率最为常见。 */
  12674. sampleRate: number
  12675. /** 当前WebAudio上下文的状态。可能的值如下:suspended(暂停)、running(正在运行)、closed(已关闭)。需要注意的是,不要在 audioContext close后再访问state属性 */
  12676. state: string
  12677. /** [AnalyserNode WebAudioContext.createAnalyser()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createAnalyser.html)
  12678. *
  12679. * 需要基础库: `2.22.0`
  12680. *
  12681. * 在插件中使用:不支持
  12682. *
  12683. * 创建一个 AnalyserNode 。可以用来获取音频时间和频率数据,以及实现数据可视化。 */
  12684. createAnalyser(): AnalyserNode
  12685. /** [BiquadFilterNode WebAudioContext.createBiquadFilter()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createBiquadFilter.html)
  12686. *
  12687. * 在插件中使用:不支持
  12688. *
  12689. * 创建一个BiquadFilterNode */
  12690. createBiquadFilter(): BiquadFilterNode
  12691. /** [ChannelMergerNode WebAudioContext.createChannelMerger(number numberOfInputs)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createChannelMerger.html)
  12692. *
  12693. * 在插件中使用:不支持
  12694. *
  12695. * 创建一个ChannelMergerNode */
  12696. createChannelMerger(
  12697. /** 输出流中需要保持的输入流的个数 */
  12698. numberOfInputs: number
  12699. ): ChannelMergerNode
  12700. /** [ChannelSplitterNode WebAudioContext.createChannelSplitter(number numberOfOutputs)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createChannelSplitter.html)
  12701. *
  12702. * 在插件中使用:不支持
  12703. *
  12704. * 创建一个ChannelSplitterNode */
  12705. createChannelSplitter(
  12706. /** 要分别输出的输入音频流中的通道数 */
  12707. numberOfOutputs: number
  12708. ): ChannelSplitterNode
  12709. /** [ConstantSourceNode WebAudioContext.createConstantSource()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createConstantSource.html)
  12710. *
  12711. * 在插件中使用:不支持
  12712. *
  12713. * 创建一个ConstantSourceNode */
  12714. createConstantSource(): ConstantSourceNode
  12715. /** [DelayNode WebAudioContext.createDelay(number maxDelayTime)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createDelay.html)
  12716. *
  12717. * 在插件中使用:不支持
  12718. *
  12719. * 创建一个DelayNode */
  12720. createDelay(
  12721. /** 最大延迟时间 */
  12722. maxDelayTime: number
  12723. ): DelayNode
  12724. /** [DynamicsCompressorNode WebAudioContext.createDynamicsCompressor()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createDynamicsCompressor.html)
  12725. *
  12726. * 在插件中使用:不支持
  12727. *
  12728. * 创建一个DynamicsCompressorNode */
  12729. createDynamicsCompressor(): DynamicsCompressorNode
  12730. /** [GainNode WebAudioContext.createGain()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createGain.html)
  12731. *
  12732. * 在插件中使用:不支持
  12733. *
  12734. * 创建一个GainNode */
  12735. createGain(): GainNode
  12736. /** [IIRFilterNode WebAudioContext.createIIRFilter(Array.&lt;number&gt; feedforward, Array.&lt;number&gt; feedback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createIIRFilter.html)
  12737. *
  12738. * 在插件中使用:不支持
  12739. *
  12740. * 创建一个IIRFilterNode */
  12741. createIIRFilter(
  12742. /** 一个浮点值数组,指定IIR滤波器传递函数的前馈(分子)系数。 */
  12743. feedforward: number[],
  12744. /** 一个浮点值数组,指定IIR滤波器传递函数的反馈(分母)系数。 */
  12745. feedback: number[]
  12746. ): IIRFilterNode
  12747. /** [OscillatorNode WebAudioContext.createOscillator()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createOscillator.html)
  12748. *
  12749. * 在插件中使用:不支持
  12750. *
  12751. * 创建一个OscillatorNode */
  12752. createOscillator(): OscillatorNode
  12753. /** [PannerNode WebAudioContext.createPanner()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createPanner.html)
  12754. *
  12755. * 在插件中使用:不支持
  12756. *
  12757. * 创建一个PannerNode */
  12758. createPanner(): PannerNode
  12759. /** [PeriodicWaveNode WebAudioContext.createPeriodicWave(Float32Array real, Float32Array imag, object constraints)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createPeriodicWave.html)
  12760. *
  12761. * 在插件中使用:不支持
  12762. *
  12763. * 创建一个PeriodicWaveNode
  12764. *
  12765. * **注意**
  12766. *
  12767. * `real`和`imag`数组必须拥有一样的长度,否则抛出错误
  12768. * ```js
  12769. const real = new Float32Array(2)
  12770. const imag = new Float32Array(2)
  12771. real[0] = 0
  12772. imag[0] = 0
  12773. real[1] = 1
  12774. imag[1] = 0
  12775. const waveNode = audioContext.createPeriodicWave(real, imag, {disableNormalization: true})
  12776. ``` */
  12777. createPeriodicWave(
  12778. /** 一组余弦项(传统上是A项) */
  12779. real: Float32Array,
  12780. /** 一组余弦项(传统上是A项) */
  12781. imag: Float32Array,
  12782. /** 一个字典对象,它指定是否应该禁用规范化(默认启用规范化) */
  12783. constraints: Constraints
  12784. ): PeriodicWaveNode
  12785. /** [Promise WebAudioContext.close()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.close.html)
  12786. *
  12787. * 在插件中使用:不支持
  12788. *
  12789. * 关闭WebAudioContext
  12790. *
  12791. * **注意事项**
  12792. *
  12793. * 同步关闭对应的WebAudio上下文。close后会立即释放当前上下文的资源,<b>不要在close后再次访问state属性。</b>
  12794. * ```js
  12795. const audioCtx = wx.createWebAudioContext()
  12796. audioCtx.close().then(() => {
  12797. console.log(audioCtx.state) // bad case:不应该在close后再访问state
  12798. })
  12799. ``` */
  12800. close(): Promise<any>
  12801. /** [Promise WebAudioContext.resume()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.resume.html)
  12802. *
  12803. * 在插件中使用:不支持
  12804. *
  12805. * 同步恢复已经被暂停的WebAudioContext上下文 */
  12806. resume(): Promise<any>
  12807. /** [Promise WebAudioContext.suspend()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.suspend.html)
  12808. *
  12809. * 在插件中使用:不支持
  12810. *
  12811. * 同步暂停WebAudioContext上下文 */
  12812. suspend(): Promise<any>
  12813. /** [ScriptProcessorNode WebAudioContext.createScriptProcessor(number bufferSize, number numberOfInputChannels, number numberOfOutputChannels)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createScriptProcessor.html)
  12814. *
  12815. * 在插件中使用:不支持
  12816. *
  12817. * 创建一个ScriptProcessorNode */
  12818. createScriptProcessor(
  12819. /** 缓冲区大小,以样本帧为单位 */
  12820. bufferSize: number,
  12821. /** 用于指定输入node的声道的数量 */
  12822. numberOfInputChannels: number,
  12823. /** 用于指定输出node的声道的数量 */
  12824. numberOfOutputChannels: number
  12825. ): ScriptProcessorNode
  12826. /** [WaveShaperNode WebAudioContext.createWaveShaper()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createWaveShaper.html)
  12827. *
  12828. * 在插件中使用:不支持
  12829. *
  12830. * 创建一个WaveShaperNode */
  12831. createWaveShaper(): WaveShaperNode
  12832. /** [[AudioBuffer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.html) WebAudioContext.createBuffer(number numOfChannels, number length, number sampleRate)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createBuffer.html)
  12833. *
  12834. * 在插件中使用:不支持
  12835. *
  12836. * 创建一个AudioBuffer,代表着一段驻留在内存中的短音频 */
  12837. createBuffer(
  12838. /** 定义了 buffer 中包含的声频通道数量的整数 */
  12839. numOfChannels: number,
  12840. /** 代表 buffer 中的样本帧数的整数 */
  12841. length: number,
  12842. /** 线性音频样本的采样率,即每一秒包含的关键帧的个数 */
  12843. sampleRate: number
  12844. ): AudioBuffer
  12845. /** [[AudioBuffer](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioBuffer.html) WebAudioContext.decodeAudioData()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.decodeAudioData.html)
  12846. *
  12847. * 在插件中使用:不支持
  12848. *
  12849. * 异步解码一段资源为AudioBuffer。 */
  12850. decodeAudioData(): AudioBuffer
  12851. /** [[BufferSourceNode](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/BufferSourceNode.html) WebAudioContext.createBufferSource()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.createBufferSource.html)
  12852. *
  12853. * 在插件中使用:不支持
  12854. *
  12855. * 创建一个BufferSourceNode实例,通过AudioBuffer对象来播放音频数据。 */
  12856. createBufferSource(): BufferSourceNode
  12857. }
  12858. /** 需要基础库: `2.19.0`
  12859. *
  12860. * 一类音频处理模块,不同的Node具备不同的功能,如GainNode(音量调整)等。一个WebAudioContextNode可以通过上下文来创建。
  12861. * 目前已经支持以下Node:
  12862. * IIRFilterNode
  12863. * WaveShaperNode
  12864. * ConstantSourceNode
  12865. * ChannelMergerNode
  12866. * OscillatorNode
  12867. * GainNode
  12868. * BiquadFilterNode
  12869. * PeriodicWaveNode
  12870. * BufferSourceNode
  12871. * ChannelSplitterNode
  12872. * ChannelMergerNode
  12873. * DelayNode
  12874. * DynamicsCompressorNode
  12875. * ScriptProcessorNode
  12876. * PannerNode
  12877. * AnalyserNode */
  12878. interface WebAudioContextNode {
  12879. /** 表示监听器的前向系统在同一笛卡尔坐标系中的水平位置,作为位置(位置x,位置和位置和位置)值。 */
  12880. forwardX: number
  12881. /** 表示听众的前向方向在同一笛卡尔坐标系中作为位置(位置x,位置和位置和位置)值的垂直位置。 */
  12882. forwardY: number
  12883. /** 表示与position (positionX、positionY和positionZ)值在同一笛卡尔坐标系下的听者前进方向的纵向(前后)位置。 */
  12884. forwardZ: number
  12885. /** 右手笛卡尔坐标系中X轴的位置。 */
  12886. positionX: number
  12887. /** 右手笛卡尔坐标系中Y轴的位置。 */
  12888. positionY: number
  12889. /** 右手笛卡尔坐标系中Z轴的位置。 */
  12890. positionZ: number
  12891. /** 设置监听器的方向 */
  12892. setOrientation: (...args: any[]) => any
  12893. /** 设置监听器的位置
  12894. *
  12895. * /** */
  12896. setPosition: (...args: any[]) => any
  12897. /** 表示在与position (positionX、positionY和positionZ)值相同的笛卡尔坐标系中侦听器向前方向的水平位置。 */
  12898. upX: number
  12899. /** 表示在与position (positionX、positionY和positionZ)值相同的笛卡尔坐标系中侦听器向上方向的水平位置。 */
  12900. upY: number
  12901. /** 表示在与position (positionX、positionY和positionZ)值相同的笛卡尔坐标系中侦听器向后方向的水平位置。 */
  12902. upZ: number
  12903. }
  12904. /** 提供预设的 Wi-Fi 信息列表 */
  12905. interface WifiData {
  12906. /** Wi-Fi 的 BSSID */
  12907. BSSID?: string
  12908. /** Wi-Fi 的 SSID */
  12909. SSID?: string
  12910. /** Wi-Fi 设备密码 */
  12911. password?: string
  12912. }
  12913. /** Wifi 信息
  12914. *
  12915. * **注意**
  12916. *
  12917. * - 安卓 wx.connectWifi / wx.getConnectedWifi 若设置了 partialInfo:true ,或者调用了 wx.onWifiConnectedWithPartialInfo 事件。将会返回只包含 SSID 属性的 WifiInfo 对象。
  12918. * - iOS wx.getConnectedWifi 若设置了 partialInfo:true ,将会返回只包含 SSID、BSSID 属性的 WifiInfo 对象,且需要用户开启微信定位权限才能正确返回结果。
  12919. * - 在某些情况下,可能 Wi-Fi 已经连接成功,但会因为获取不到完整的 WifiInfo 对象报错。具体错误信息为 errCode: 12010, errMsg: can't gain current wifi 或 no wifi is connected 。如果开发者不需要完整的 WifiInfo 对象,则可以通过采取上述策略解决报错问题。 */
  12920. interface WifiInfo {
  12921. /** Wi-Fi 的 BSSID */
  12922. BSSID: string
  12923. /** Wi-Fi 的 SSID */
  12924. SSID: string
  12925. /** 需要基础库: `2.12.0`
  12926. *
  12927. * Wi-Fi 频段单位 MHz */
  12928. frequency: number
  12929. /** Wi-Fi 是否安全 */
  12930. secure: boolean
  12931. /** Wi-Fi 信号强度, 安卓取值 0 ~ 100 ,iOS 取值 0 ~ 1 ,值越大强度越大 */
  12932. signalStrength: number
  12933. }
  12934. interface WindowInfo {
  12935. /** 设备像素比 */
  12936. pixelRatio: number
  12937. /** 在竖屏正方向下的安全区域。部分机型没有安全区域概念,也不会返回 safeArea 字段,开发者需自行兼容。 */
  12938. safeArea: SafeArea
  12939. /** 屏幕高度,单位px */
  12940. screenHeight: number
  12941. /** 窗口上边缘的y值 */
  12942. screenTop: number
  12943. /** 屏幕宽度,单位px */
  12944. screenWidth: number
  12945. /** 状态栏的高度,单位px */
  12946. statusBarHeight: number
  12947. /** 可使用窗口高度,单位px */
  12948. windowHeight: number
  12949. /** 可使用窗口宽度,单位px */
  12950. windowWidth: number
  12951. }
  12952. /** Worker 实例,主线程中可通过 [wx.createWorker](https://developers.weixin.qq.com/miniprogram/dev/api/worker/wx.createWorker.html) 接口获取,worker 线程中可通过全局变量 `worker` 获取。
  12953. *
  12954. * **示例代码**
  12955. *
  12956. * 运行以下代码需先进行基础配置,详细请查阅 [小程序多线程](https://developers.weixin.qq.com/miniprogram/dev/framework/workers.html) | [小游戏多线程](https://developers.weixin.qq.com/minigame/dev/guide/base-ability/worker.html) 文档了解基础知识和配置方法。
  12957. *
  12958. * ```js
  12959. const worker = wx.createWorker('workers/request/index.js') // 文件名指定 worker 的入口文件路径,绝对路径
  12960. worker.onMessage(function (res) {
  12961. console.log(res)
  12962. })
  12963. // 监听worker被系统回收事件
  12964. worker.onProcessKilled(function () {
  12965. console.log('worker has been killed')
  12966. // 重新创建一个worker
  12967. // wx.createWorker()
  12968. })
  12969. worker.postMessage({
  12970. msg: 'hello worker'
  12971. })
  12972. worker.terminate()
  12973. ``` */
  12974. interface Worker {
  12975. /** worker内的环境变量 */
  12976. env: WorkerEnv
  12977. /** [ArrayBuffer Worker.getCameraFrameData()](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.getCameraFrameData.html)
  12978. *
  12979. * 需要基础库: `2.25.1`
  12980. *
  12981. * 在插件中使用:不支持
  12982. *
  12983. * 获取摄像头当前帧图像,返回ArrayBuffer数据。仅限在 worker 线程中使用。
  12984. *
  12985. * **示例代码**
  12986. *
  12987. * ```js
  12988. // app.js
  12989. const worker = wx.createWorker('workers/index.js', {
  12990. useExperimentalWorker: true
  12991. })
  12992. const cameraContext = wx.createCameraContext()
  12993. const cameraFrameListener = cameraContext.onCameraFrame(function() {})
  12994. cameraFrameListener.start({
  12995. worker: worker
  12996. })
  12997. ```
  12998. *
  12999. * ```js
  13000. // workers/index.js
  13001. const data = worker.getCameraFrameData()
  13002. console.log(data)
  13003. ``` */
  13004. getCameraFrameData(): ArrayBuffer
  13005. /** [Worker.onMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.onMessage.html)
  13006. *
  13007. * 在插件中使用:不支持
  13008. *
  13009. * 监听主线程/Worker 线程向当前线程发送的消息的事件。 */
  13010. onMessage(
  13011. /** 主线程/Worker 线程向当前线程发送的消息的事件的监听函数 */
  13012. listener: WorkerOnMessageCallback
  13013. ): void
  13014. /** [Worker.onProcessKilled(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.onProcessKilled.html)
  13015. *
  13016. * 在插件中使用:不支持
  13017. *
  13018. * 监听 worker线程被系统回收事件(开启 useExperimentalWorker 后,当iOS系统资源紧张时,ExperimentalWorker 线程存在被系统回收的可能,开发者可监听此事件并重新创建一个worker)。仅限在主线程 worker 对象上调用。 */
  13019. onProcessKilled(
  13020. /** worker线程被系统回收事件的监听函数 */
  13021. listener: OnProcessKilledCallback
  13022. ): void
  13023. /** [Worker.postMessage(Object message)](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.postMessage.html)
  13024. *
  13025. * 在插件中使用:不支持
  13026. *
  13027. * 向主线程/Worker 线程发送的消息。
  13028. *
  13029. * **示例代码**
  13030. *
  13031. * worker 线程中
  13032. * ```js
  13033. worker.postMessage({
  13034. msg: 'hello from worker'
  13035. })
  13036. ```
  13037. *
  13038. * 主线程中
  13039. * ```js
  13040. const worker = wx.createWorker('workers/request/index.js')
  13041. worker.postMessage({
  13042. msg: 'hello from main'
  13043. })
  13044. ```
  13045. *
  13046. * **提醒**
  13047. *
  13048. * 在基础库版本2.20.2之前,postMessage仅支持传递可序列化的key-value对象。
  13049. * 在基础库2.20.2之后,postMessage支持传递任意类型的数据。 */
  13050. postMessage(
  13051. /** 需要发送的消息。 */
  13052. message: IAnyObject
  13053. ): void
  13054. /** [Worker.terminate()](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.terminate.html)
  13055. *
  13056. * 在插件中使用:不支持
  13057. *
  13058. * 结束当前 Worker 线程。仅限在主线程 worker 对象上调用。 */
  13059. terminate(): void
  13060. /** [Worker.testOnProcessKilled()](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.testOnProcessKilled.html)
  13061. *
  13062. * 需要基础库: `2.27.1`
  13063. *
  13064. * 在插件中使用:不支持
  13065. *
  13066. * 用于模拟 iOS ExperimentalWorker 线程被系统回收事件,以便于调试。接口仅在 worker 线程内可用。参考 [Worker.onProcessKilled](https://developers.weixin.qq.com/miniprogram/dev/api/worker/Worker.onProcessKilled.html)
  13067. *
  13068. * **示例代码**
  13069. *
  13070. * ```js
  13071. // game.js
  13072. const worker = wx.createWorker('workers/index.js', {
  13073. useExperimentalWorker: true
  13074. })
  13075. // 监听 ExperimentalWorker 被系统回收事件
  13076. worker.onProcessKilled(function () {
  13077. console.log('worker has been killed')
  13078. // 重新创建一个worker
  13079. // wx.createWorker()
  13080. })
  13081. ```
  13082. *
  13083. * ```js
  13084. // workers/index.js
  13085. setTimeout(() => {
  13086. // 模拟 ExperimentalWorker 线程被系统回收事件
  13087. worker.testOnProcessKilled()
  13088. }, 2000)
  13089. ``` */
  13090. testOnProcessKilled(): void
  13091. }
  13092. /** worker内的环境变量 */
  13093. interface WorkerEnv {
  13094. /** 文件系统中的用户目录路径 (本地路径) */
  13095. USER_DATA_PATH: string
  13096. }
  13097. interface WorkerOnMessageListenerResult {
  13098. /** 主线程/Worker 线程向当前线程发送的消息 */
  13099. message: IAnyObject
  13100. }
  13101. /** Easing 模块实现了常见的动画缓动函数(动画效果参考 https://easings.net/ ),可从 [wx.worklet](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/wx.worklet.html) 对象中读取。
  13102. *
  13103. * ****
  13104. *
  13105. * ## 示例代码
  13106. *
  13107. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/f94TCOmg7JFH)
  13108. *
  13109. * ### 预置动画函数
  13110. *
  13111. * * [Easing.bounce](#Easing.bounce) 反弹动画
  13112. * * [Easing.ease](#Easing.ease) 惯性动画
  13113. * * [Easing.elastic](#Easing.elastic) 弹性动画
  13114. *
  13115. * ### 标准缓动函数
  13116. *
  13117. * * [Easing.linear](#Easing.linear) 线性
  13118. * * [Easing.quad](#Easing.quad) 二次方
  13119. * * [Easing.cubic](#Easing.cubic) 三次方
  13120. * * [Easing.poly](#Easing.poly) 实现其它幂函数
  13121. *
  13122. * ### 其它数学函数
  13123. *
  13124. * * [Easing.bezier](#Easing.bezier) 三次贝塞尔曲线
  13125. * * [Easing.circle](#Easing.circle) 圆形曲线
  13126. * * [Easing.sin](#Easing.sin) 正弦函数
  13127. * * [Easing.exp](#Easing.exp) 指数函数
  13128. *
  13129. * ### 缓动方式
  13130. *
  13131. * 以上效果均有三种缓动方式
  13132. *
  13133. * * [Easing.in](#in) 正向执行缓动函数
  13134. * * [Easing.out](#out) 反向执行缓动函数
  13135. * * [Easing.inOut](#inout) 前半程正向,后半程反向
  13136. * 以 `sin` 函数为例,其中 `Easing.in(Easing.sin)` 和直接使用 `Easing.sin` 效果相同。
  13137. *
  13138. * 1. `Easing.in(Easing.sin)` 动画效果参考 https://easings.net/#easeInSine
  13139. * 2. `Easing.out(Easing.sin)` 动画效果参考 https://easings.net/#easeOutSine
  13140. * 3. `Easing.inOut(Easing.sin)` 动画效果参考 https://easings.net/#easeInOutSine
  13141. *
  13142. * ### Easing.bounce
  13143. *
  13144. * 简单的反弹效果,[动画效果参考](https://easings.net/#easeInBounce)
  13145. *
  13146. * ```js
  13147. Easing.bounce(t)
  13148. ```
  13149. *
  13150. * ### Easing.ease
  13151. *
  13152. * 简单的惯性动画,[动画效果参考](https://cubic-bezier.com/#.42,0,1,1)
  13153. *
  13154. * ```js
  13155. Easing.ease(t)
  13156. ```
  13157. *
  13158. * ### Easing.elastic
  13159. *
  13160. * 简单的弹性动画,类似弹簧来回摆动,高阶函数。默认弹性为 1,会稍微超出一次。弹性为 0 时 不会过冲。[动画效果参考](https://easings.net/#easeInElastic)
  13161. *
  13162. * ```js
  13163. Easing.elastic(bounciness = 1)
  13164. ```
  13165. *
  13166. * ### Easing.linear
  13167. *
  13168. * 线性函数,f(t) = t,[动画效果参考](https://cubic-bezier.com/#0,0,1,1)
  13169. *
  13170. * ```js
  13171. Easing.linear(t)
  13172. ```
  13173. * ### Easing.quad
  13174. *
  13175. * 二次方函数,f(t) = t * t,[动画效果参考](https://easings.net/#easeInQuad)
  13176. *
  13177. * ```js
  13178. Easing.quad(t)
  13179. ```
  13180. *
  13181. * ### Easing.cubic
  13182. *
  13183. * 立方函数,f(t) = t * t * t,[动画效果参考](https://easings.net/#easeInCubic)
  13184. *
  13185. * ```js
  13186. Easing.cubic(t)
  13187. ```
  13188. *
  13189. * ### Easing.poly
  13190. *
  13191. * 高阶函数,返回幂函数
  13192. *
  13193. * poly(4): [动画效果参考](https://easings.net/#easeInQuart)
  13194. *
  13195. * poly(5): [动画效果参考](https://easings.net/#easeInQuint)
  13196. *
  13197. * ```js
  13198. Easing.poly(n)
  13199. ```
  13200. *
  13201. * ### Easing.bezier
  13202. *
  13203. * 三次贝塞尔曲线,效果同 css `transition-timing-function`
  13204. *
  13205. * 调试参数可借助 [可视化工具](https://cubic-bezier.com/)
  13206. *
  13207. * ```js
  13208. Easing.bezier(x1, y1, x2, y2)
  13209. ```
  13210. *
  13211. * ### Easing.circle
  13212. *
  13213. * 圆形曲线,[动画效果参考](https://easings.net/#easeInCirc)
  13214. *
  13215. * ```js
  13216. Easing.circle(t)
  13217. ```
  13218. *
  13219. * ### Easing.sin
  13220. *
  13221. * 正弦函数,[动画效果参考](https://easings.net/#easeInSine)
  13222. *
  13223. * ```js
  13224. Easing.sin(t)
  13225. ```
  13226. *
  13227. * ### Easing.exp
  13228. *
  13229. * 指数函数,[动画效果参考](https://easings.net/#easeInExpo)
  13230. *
  13231. * ```js
  13232. Easing.exp(t)
  13233. ```
  13234. *
  13235. * ### Easing.in
  13236. *
  13237. * 正向运行 `easing function`,高阶函数。
  13238. *
  13239. * ```js
  13240. Easing.in(easing)
  13241. ```
  13242. *
  13243. * ### Easing.out
  13244. *
  13245. * 反向运行 `easing function`,高阶函数。
  13246. *
  13247. * ```js
  13248. Easing.out(easing)
  13249. ```
  13250. *
  13251. * ### Easing.inOut
  13252. *
  13253. * 前半程正向,后半程反向,高阶函数。
  13254. *
  13255. * ```js
  13256. Easing.inOut(easing)
  13257. ``` */
  13258. interface WorkletEasing {}
  13259. interface WriteBLECharacteristicValueOption {
  13260. /** 蓝牙特征的 UUID */
  13261. characteristicId: string
  13262. /** 蓝牙设备 id */
  13263. deviceId: string
  13264. /** 蓝牙特征对应服务的 UUID */
  13265. serviceId: string
  13266. /** 蓝牙设备特征对应的二进制值 */
  13267. value: ArrayBuffer
  13268. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  13269. complete?: WriteBLECharacteristicValueCompleteCallback
  13270. /** 接口调用失败的回调函数 */
  13271. fail?: WriteBLECharacteristicValueFailCallback
  13272. /** 接口调用成功的回调函数 */
  13273. success?: WriteBLECharacteristicValueSuccessCallback
  13274. /** 蓝牙特征值的写模式设置,有两种模式,iOS 优先 write,安卓优先 writeNoResponse 。(基础库 2.22.0 开始支持)
  13275. *
  13276. * 可选值:
  13277. * - 'write': 强制回复写,不支持时报错;
  13278. * - 'writeNoResponse': 强制无回复写,不支持时报错; */
  13279. writeType?: 'write' | 'writeNoResponse'
  13280. }
  13281. interface WriteCharacteristicValueObject {
  13282. /** 蓝牙特征的 UUID */
  13283. characteristicId: string
  13284. /** 是否需要通知主机 value 已更新 */
  13285. needNotify: boolean
  13286. /** 蓝牙特征对应服务的 UUID */
  13287. serviceId: string
  13288. /** characteristic 对应的二进制值 */
  13289. value: ArrayBuffer
  13290. /** 可选,处理回包时使用 */
  13291. callbackId?: number
  13292. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  13293. complete?: WriteCharacteristicValueCompleteCallback
  13294. /** 接口调用失败的回调函数 */
  13295. fail?: WriteCharacteristicValueFailCallback
  13296. /** 接口调用成功的回调函数 */
  13297. success?: WriteCharacteristicValueSuccessCallback
  13298. }
  13299. interface WriteFileOption {
  13300. /** 要写入的文本或二进制数据 */
  13301. data: string | ArrayBuffer
  13302. /** 要写入的文件路径 (本地路径) */
  13303. filePath: string
  13304. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  13305. complete?: WriteFileCompleteCallback
  13306. /** 指定写入文件的字符编码
  13307. *
  13308. * 可选值:
  13309. * - 'ascii': ;
  13310. * - 'base64': (注意,选择 base64 编码,data 只需要传 base64 内容本身,不要传 Data URI 前缀,否则会报 fail base64 encode error 错误。例如,传 aGVsbG8= 而不是传 data:image/png;base64,aGVsbG8= );
  13311. * - 'binary': ;
  13312. * - 'hex': ;
  13313. * - 'ucs2': 以小端序读取;
  13314. * - 'ucs-2': 以小端序读取;
  13315. * - 'utf16le': 以小端序读取;
  13316. * - 'utf-16le': 以小端序读取;
  13317. * - 'utf-8': ;
  13318. * - 'utf8': ;
  13319. * - 'latin1': ; */
  13320. encoding?:
  13321. | 'ascii'
  13322. | 'base64'
  13323. | 'binary'
  13324. | 'hex'
  13325. | 'ucs2'
  13326. | 'ucs-2'
  13327. | 'utf16le'
  13328. | 'utf-16le'
  13329. | 'utf-8'
  13330. | 'utf8'
  13331. | 'latin1'
  13332. /** 接口调用失败的回调函数 */
  13333. fail?: WriteFileFailCallback
  13334. /** 接口调用成功的回调函数 */
  13335. success?: WriteFileSuccessCallback
  13336. }
  13337. interface WriteNdefMessageOption {
  13338. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  13339. complete?: WriteNdefMessageCompleteCallback
  13340. /** 接口调用失败的回调函数 */
  13341. fail?: WriteNdefMessageFailCallback
  13342. /** 二进制对象数组, 需要指明 id, type 以及 payload (均为 ArrayBuffer 类型) */
  13343. records?: any[]
  13344. /** 接口调用成功的回调函数 */
  13345. success?: WriteNdefMessageSuccessCallback
  13346. /** text 数组 */
  13347. texts?: any[]
  13348. /** uri 数组 */
  13349. uris?: any[]
  13350. }
  13351. interface WriteOption {
  13352. /** 写入的内容,类型为 String 或 ArrayBuffer */
  13353. data: string | ArrayBuffer
  13354. /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  13355. fd: string
  13356. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  13357. complete?: WriteCompleteCallback
  13358. /** 只在 data 类型是 String 时有效,指定写入文件的字符编码,默认为 utf8
  13359. *
  13360. * 可选值:
  13361. * - 'ascii': ;
  13362. * - 'base64': ;
  13363. * - 'binary': ;
  13364. * - 'hex': ;
  13365. * - 'ucs2': 以小端序读取;
  13366. * - 'ucs-2': 以小端序读取;
  13367. * - 'utf16le': 以小端序读取;
  13368. * - 'utf-16le': 以小端序读取;
  13369. * - 'utf-8': ;
  13370. * - 'utf8': ;
  13371. * - 'latin1': ; */
  13372. encoding?:
  13373. | 'ascii'
  13374. | 'base64'
  13375. | 'binary'
  13376. | 'hex'
  13377. | 'ucs2'
  13378. | 'ucs-2'
  13379. | 'utf16le'
  13380. | 'utf-16le'
  13381. | 'utf-8'
  13382. | 'utf8'
  13383. | 'latin1'
  13384. /** 接口调用失败的回调函数 */
  13385. fail?: WriteFailCallback
  13386. /** 只在 data 类型是 ArrayBuffer 时有效,指定要写入的字节数,默认为 arrayBuffer 从0开始偏移 offset 个字节后剩余的字节数 */
  13387. length?: number
  13388. /** 只在 data 类型是 ArrayBuffer 时有效,决定 arrayBuffe 中要被写入的部位,即 arrayBuffer 中的索引,默认0 */
  13389. offset?: number
  13390. /** 指定文件开头的偏移量,即数据要被写入的位置。当 position 不传或者传入非 Number 类型的值时,数据会被写入当前指针所在位置。 */
  13391. position?: number
  13392. /** 接口调用成功的回调函数 */
  13393. success?: WriteSuccessCallback
  13394. }
  13395. /** 文件写入结果。 通过 [FileSystemManager.writeSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeSync.html) 接口返回 */
  13396. interface WriteResult {
  13397. /** 实际被写入到文件中的字节数(注意,被写入的字节数不一定与被写入的字符串字符数相同) */
  13398. bytesWritten: number
  13399. }
  13400. interface WriteSuccessCallbackResult {
  13401. /** 实际被写入到文件中的字节数(注意,被写入的字节数不一定与被写入的字符串字符数相同) */
  13402. bytesWritten: number
  13403. errMsg: string
  13404. }
  13405. interface WriteSyncOption {
  13406. /** 写入的内容,类型为 String 或 ArrayBuffer */
  13407. data: string | ArrayBuffer
  13408. /** 文件描述符。fd 通过 [FileSystemManager.open](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html) 或 [FileSystemManager.openSync](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html) 接口获得 */
  13409. fd: string
  13410. /** 只在 data 类型是 String 时有效,指定写入文件的字符编码,默认为 utf8
  13411. *
  13412. * 可选值:
  13413. * - 'ascii': ;
  13414. * - 'base64': ;
  13415. * - 'binary': ;
  13416. * - 'hex': ;
  13417. * - 'ucs2': 以小端序读取;
  13418. * - 'ucs-2': 以小端序读取;
  13419. * - 'utf16le': 以小端序读取;
  13420. * - 'utf-16le': 以小端序读取;
  13421. * - 'utf-8': ;
  13422. * - 'utf8': ;
  13423. * - 'latin1': ; */
  13424. encoding?:
  13425. | 'ascii'
  13426. | 'base64'
  13427. | 'binary'
  13428. | 'hex'
  13429. | 'ucs2'
  13430. | 'ucs-2'
  13431. | 'utf16le'
  13432. | 'utf-16le'
  13433. | 'utf-8'
  13434. | 'utf8'
  13435. | 'latin1'
  13436. /** 只在 data 类型是 ArrayBuffer 时有效,指定要写入的字节数,默认为 arrayBuffer 从0开始偏移 offset 个字节后剩余的字节数 */
  13437. length?: number
  13438. /** 只在 data 类型是 ArrayBuffer 时有效,决定 arrayBuffe 中要被写入的部位,即 arrayBuffer 中的索引,默认0 */
  13439. offset?: number
  13440. /** 指定文件开头的偏移量,即数据要被写入的位置。当 position 不传或者传入非 Number 类型的值时,数据会被写入当前指针所在位置。 */
  13441. position?: number
  13442. }
  13443. interface WxStartRecordOption {
  13444. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  13445. complete?: StartRecordCompleteCallback
  13446. /** 接口调用失败的回调函数 */
  13447. fail?: StartRecordFailCallback
  13448. /** 接口调用成功的回调函数 */
  13449. success?: WxStartRecordSuccessCallback
  13450. }
  13451. interface WxStopRecordOption {
  13452. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  13453. complete?: StopRecordCompleteCallback
  13454. /** 接口调用失败的回调函数 */
  13455. fail?: StopRecordFailCallback
  13456. /** 接口调用成功的回调函数 */
  13457. success?: WxStopRecordSuccessCallback
  13458. }
  13459. /** 运动数据列表 */
  13460. interface WxaSportRecord {
  13461. /** 消耗卡路里 */
  13462. calorie: number
  13463. /** 运动距离 */
  13464. distance: number
  13465. /** 运动时长 */
  13466. time: number
  13467. /** 运动项目id */
  13468. typeId: number
  13469. }
  13470. /** 帧纹理对象 */
  13471. interface YUVTextureRes {
  13472. /** UV 分量纹理 */
  13473. uvTexture: WebGLTexture
  13474. /** Y 分量纹理 */
  13475. yTexture: WebGLTexture
  13476. }
  13477. /** 文件路径 */
  13478. interface ZipFileItem {
  13479. /** 文件内容 */
  13480. data: string | ArrayBuffer
  13481. /** 错误信息 */
  13482. errMsg: string
  13483. }
  13484. interface Animation {
  13485. /** [Object Animation.export()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.export.html)
  13486. *
  13487. * 在插件中使用:支持
  13488. *
  13489. * 导出动画队列。**export 方法每次调用后会清掉之前的动画操作。** */
  13490. export(): AnimationExportResult
  13491. /** [[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)
  13492. *
  13493. * 在插件中使用:支持
  13494. *
  13495. * 设置背景色 */
  13496. backgroundColor(
  13497. /** 颜色值 */
  13498. value: string
  13499. ): Animation
  13500. /** [[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)
  13501. *
  13502. * 在插件中使用:支持
  13503. *
  13504. * 设置 bottom 值 */
  13505. bottom(
  13506. /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
  13507. value: number | string
  13508. ): Animation
  13509. /** [[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)
  13510. *
  13511. * 在插件中使用:支持
  13512. *
  13513. * 设置高度 */
  13514. height(
  13515. /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
  13516. value: number | string
  13517. ): Animation
  13518. /** [[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)
  13519. *
  13520. * 在插件中使用:支持
  13521. *
  13522. * 设置 left 值 */
  13523. left(
  13524. /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
  13525. value: number | string
  13526. ): Animation
  13527. /** [[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)
  13528. *
  13529. * 在插件中使用:支持
  13530. *
  13531. * 同 [transform-function matrix](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix) */
  13532. matrix(): Animation
  13533. /** [[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)
  13534. *
  13535. * 在插件中使用:支持
  13536. *
  13537. * 同 [transform-function matrix3d](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix3d) */
  13538. matrix3d(): Animation
  13539. /** [[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)
  13540. *
  13541. * 在插件中使用:支持
  13542. *
  13543. * 设置透明度 */
  13544. opacity(
  13545. /** 透明度,范围 0-1 */
  13546. value: number
  13547. ): Animation
  13548. /** [[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)
  13549. *
  13550. * 在插件中使用:支持
  13551. *
  13552. * 设置 right 值 */
  13553. right(
  13554. /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
  13555. value: number | string
  13556. ): Animation
  13557. /** [[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)
  13558. *
  13559. * 在插件中使用:支持
  13560. *
  13561. * 从原点顺时针旋转一个角度 */
  13562. rotate(
  13563. /** 旋转的角度。范围 [-180, 180] */
  13564. angle: number
  13565. ): Animation
  13566. /** [[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)
  13567. *
  13568. * 在插件中使用:支持
  13569. *
  13570. * 从 固定 轴顺时针旋转一个角度 */
  13571. rotate3d(
  13572. /** 旋转轴的 x 坐标 */
  13573. x: number,
  13574. /** 旋转轴的 y 坐标 */
  13575. y: number,
  13576. /** 旋转轴的 z 坐标 */
  13577. z: number,
  13578. /** 旋转的角度。范围 [-180, 180] */
  13579. angle: number
  13580. ): Animation
  13581. /** [[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)
  13582. *
  13583. * 在插件中使用:支持
  13584. *
  13585. * 从 X 轴顺时针旋转一个角度 */
  13586. rotateX(
  13587. /** 旋转的角度。范围 [-180, 180] */
  13588. angle: number
  13589. ): Animation
  13590. /** [[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)
  13591. *
  13592. * 在插件中使用:支持
  13593. *
  13594. * 从 Y 轴顺时针旋转一个角度 */
  13595. rotateY(
  13596. /** 旋转的角度。范围 [-180, 180] */
  13597. angle: number
  13598. ): Animation
  13599. /** [[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)
  13600. *
  13601. * 在插件中使用:支持
  13602. *
  13603. * 从 Z 轴顺时针旋转一个角度 */
  13604. rotateZ(
  13605. /** 旋转的角度。范围 [-180, 180] */
  13606. angle: number
  13607. ): Animation
  13608. /** [[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)
  13609. *
  13610. * 在插件中使用:支持
  13611. *
  13612. * 缩放 */
  13613. scale(
  13614. /** 当仅有 sx 参数时,表示在 X 轴、Y 轴同时缩放sx倍数 */
  13615. sx: number,
  13616. /** 在 Y 轴缩放 sy 倍数 */
  13617. sy?: number
  13618. ): Animation
  13619. /** [[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)
  13620. *
  13621. * 在插件中使用:支持
  13622. *
  13623. * 缩放 */
  13624. scale3d(
  13625. /** x 轴的缩放倍数 */
  13626. sx: number,
  13627. /** y 轴的缩放倍数 */
  13628. sy: number,
  13629. /** z 轴的缩放倍数 */
  13630. sz: number
  13631. ): Animation
  13632. /** [[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)
  13633. *
  13634. * 在插件中使用:支持
  13635. *
  13636. * 缩放 X 轴 */
  13637. scaleX(
  13638. /** X 轴的缩放倍数 */
  13639. scale: number
  13640. ): Animation
  13641. /** [[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)
  13642. *
  13643. * 在插件中使用:支持
  13644. *
  13645. * 缩放 Y 轴 */
  13646. scaleY(
  13647. /** Y 轴的缩放倍数 */
  13648. scale: number
  13649. ): Animation
  13650. /** [[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)
  13651. *
  13652. * 在插件中使用:支持
  13653. *
  13654. * 缩放 Z 轴 */
  13655. scaleZ(
  13656. /** Z 轴的缩放倍数 */
  13657. scale: number
  13658. ): Animation
  13659. /** [[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)
  13660. *
  13661. * 在插件中使用:支持
  13662. *
  13663. * 对 X、Y 轴坐标进行倾斜 */
  13664. skew(
  13665. /** 对 X 轴坐标倾斜的角度,范围 [-180, 180] */
  13666. ax: number,
  13667. /** 对 Y 轴坐标倾斜的角度,范围 [-180, 180] */
  13668. ay: number
  13669. ): Animation
  13670. /** [[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)
  13671. *
  13672. * 在插件中使用:支持
  13673. *
  13674. * 对 X 轴坐标进行倾斜 */
  13675. skewX(
  13676. /** 倾斜的角度,范围 [-180, 180] */
  13677. angle: number
  13678. ): Animation
  13679. /** [[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)
  13680. *
  13681. * 在插件中使用:支持
  13682. *
  13683. * 对 Y 轴坐标进行倾斜 */
  13684. skewY(
  13685. /** 倾斜的角度,范围 [-180, 180] */
  13686. angle: number
  13687. ): Animation
  13688. /** [[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)
  13689. *
  13690. * 在插件中使用:支持
  13691. *
  13692. * 表示一组动画完成。可以在一组动画中调用任意多个动画方法,一组动画中的所有动画会同时开始,一组动画完成后才会进行下一组动画。 */
  13693. step(option?: StepOption): Animation
  13694. /** [[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)
  13695. *
  13696. * 在插件中使用:支持
  13697. *
  13698. * 设置 top 值 */
  13699. top(
  13700. /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
  13701. value: number | string
  13702. ): Animation
  13703. /** [[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)
  13704. *
  13705. * 在插件中使用:支持
  13706. *
  13707. * 平移变换 */
  13708. translate(
  13709. /** 当仅有该参数时表示在 X 轴偏移 tx,单位 px */
  13710. tx?: number,
  13711. /** 在 Y 轴平移的距离,单位为 px */
  13712. ty?: number
  13713. ): Animation
  13714. /** [[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)
  13715. *
  13716. * 在插件中使用:支持
  13717. *
  13718. * 对 xyz 坐标进行平移变换 */
  13719. translate3d(
  13720. /** 在 X 轴平移的距离,单位为 px */
  13721. tx?: number,
  13722. /** 在 Y 轴平移的距离,单位为 px */
  13723. ty?: number,
  13724. /** 在 Z 轴平移的距离,单位为 px */
  13725. tz?: number
  13726. ): Animation
  13727. /** [[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)
  13728. *
  13729. * 在插件中使用:支持
  13730. *
  13731. * 对 X 轴平移 */
  13732. translateX(
  13733. /** 在 X 轴平移的距离,单位为 px */
  13734. translation: number
  13735. ): Animation
  13736. /** [[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)
  13737. *
  13738. * 在插件中使用:支持
  13739. *
  13740. * 对 Y 轴平移 */
  13741. translateY(
  13742. /** 在 Y 轴平移的距离,单位为 px */
  13743. translation: number
  13744. ): Animation
  13745. /** [[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)
  13746. *
  13747. * 在插件中使用:支持
  13748. *
  13749. * 对 Z 轴平移 */
  13750. translateZ(
  13751. /** 在 Z 轴平移的距离,单位为 px */
  13752. translation: number
  13753. ): Animation
  13754. /** [[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)
  13755. *
  13756. * 在插件中使用:支持
  13757. *
  13758. * 设置宽度 */
  13759. width(
  13760. /** 长度值,如果传入 number 则默认使用 px,可传入其他自定义单位的长度值 */
  13761. value: number | string
  13762. ): Animation
  13763. }
  13764. interface AudioContext {
  13765. /** [AudioContext.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.pause.html)
  13766. *
  13767. * 在插件中使用:支持
  13768. * @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) 替换
  13769. *
  13770. * 暂停音频。 */
  13771. pause(): void
  13772. /** [AudioContext.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.play.html)
  13773. *
  13774. * 在插件中使用:支持
  13775. * @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) 替换
  13776. *
  13777. * 播放音频。 */
  13778. play(): void
  13779. /** [AudioContext.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.seek.html)
  13780. *
  13781. * 在插件中使用:支持
  13782. * @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) 替换
  13783. *
  13784. * 跳转到指定位置。 */
  13785. seek(
  13786. /** 跳转位置,单位 s */
  13787. position: number
  13788. ): void
  13789. /** [AudioContext.setSrc(string src)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.setSrc.html)
  13790. *
  13791. * 在插件中使用:支持
  13792. * @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) 替换
  13793. *
  13794. * 设置音频地址 */
  13795. setSrc(
  13796. /** 音频地址 */
  13797. src: string
  13798. ): void
  13799. }
  13800. interface BLEPeripheralServer {
  13801. /** [BLEPeripheralServer.addService(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.addService.html)
  13802. *
  13803. * 需要基础库: `2.10.3`
  13804. *
  13805. * 在插件中使用:不支持
  13806. *
  13807. * 添加服务。 */
  13808. addService(option: AddServiceOption): void
  13809. /** [BLEPeripheralServer.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.close.html)
  13810. *
  13811. * 需要基础库: `2.10.3`
  13812. *
  13813. * 在插件中使用:不支持
  13814. *
  13815. * 关闭当前服务端。 */
  13816. close(option?: BLEPeripheralServerCloseOption): void
  13817. /** [BLEPeripheralServer.offCharacteristicReadRequest(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicReadRequest.html)
  13818. *
  13819. * 需要基础库: `2.10.3`
  13820. *
  13821. * 在插件中使用:不支持
  13822. *
  13823. * 移除已连接的设备请求读当前外围设备的特征值事件的监听函数
  13824. *
  13825. * **示例代码**
  13826. *
  13827. * ```js
  13828. const listener = function (res) { console.log(res) }
  13829. BLEPeripheralServer.onCharacteristicReadRequest(listener)
  13830. BLEPeripheralServer.offCharacteristicReadRequest(listener) // 需传入与监听时同一个的函数对象
  13831. ``` */
  13832. offCharacteristicReadRequest(
  13833. /** onCharacteristicReadRequest 传入的监听函数。不传此参数则移除所有监听函数。 */
  13834. listener?: OffCharacteristicReadRequestCallback
  13835. ): void
  13836. /** [BLEPeripheralServer.offCharacteristicSubscribed(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicSubscribed.html)
  13837. *
  13838. * 需要基础库: `2.13.0`
  13839. *
  13840. * 在插件中使用:不支持
  13841. *
  13842. * 移除特征订阅事件的监听函数
  13843. *
  13844. * **示例代码**
  13845. *
  13846. * ```js
  13847. const listener = function (res) { console.log(res) }
  13848. BLEPeripheralServer.onCharacteristicSubscribed(listener)
  13849. BLEPeripheralServer.offCharacteristicSubscribed(listener) // 需传入与监听时同一个的函数对象
  13850. ``` */
  13851. offCharacteristicSubscribed(
  13852. /** onCharacteristicSubscribed 传入的监听函数。不传此参数则移除所有监听函数。 */
  13853. listener?: OffCharacteristicSubscribedCallback
  13854. ): void
  13855. /** [BLEPeripheralServer.offCharacteristicUnsubscribed(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicUnsubscribed.html)
  13856. *
  13857. * 需要基础库: `2.13.0`
  13858. *
  13859. * 在插件中使用:不支持
  13860. *
  13861. * 移除取消特征订阅事件的监听函数
  13862. *
  13863. * **示例代码**
  13864. *
  13865. * ```js
  13866. const listener = function (res) { console.log(res) }
  13867. BLEPeripheralServer.onCharacteristicUnsubscribed(listener)
  13868. BLEPeripheralServer.offCharacteristicUnsubscribed(listener) // 需传入与监听时同一个的函数对象
  13869. ``` */
  13870. offCharacteristicUnsubscribed(
  13871. /** onCharacteristicUnsubscribed 传入的监听函数。不传此参数则移除所有监听函数。 */
  13872. listener?: OffCharacteristicUnsubscribedCallback
  13873. ): void
  13874. /** [BLEPeripheralServer.offCharacteristicWriteRequest(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.offCharacteristicWriteRequest.html)
  13875. *
  13876. * 需要基础库: `2.10.3`
  13877. *
  13878. * 在插件中使用:不支持
  13879. *
  13880. * 移除已连接的设备请求写当前外围设备的特征值事件的监听函数
  13881. *
  13882. * **示例代码**
  13883. *
  13884. * ```js
  13885. const listener = function (res) { console.log(res) }
  13886. BLEPeripheralServer.onCharacteristicWriteRequest(listener)
  13887. BLEPeripheralServer.offCharacteristicWriteRequest(listener) // 需传入与监听时同一个的函数对象
  13888. ``` */
  13889. offCharacteristicWriteRequest(
  13890. /** onCharacteristicWriteRequest 传入的监听函数。不传此参数则移除所有监听函数。 */
  13891. listener?: OffCharacteristicWriteRequestCallback
  13892. ): void
  13893. /** [BLEPeripheralServer.onCharacteristicReadRequest(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicReadRequest.html)
  13894. *
  13895. * 需要基础库: `2.10.3`
  13896. *
  13897. * 在插件中使用:不支持
  13898. *
  13899. * 监听已连接的设备请求读当前外围设备的特征值事件。收到该消息后需要立刻调用 [writeCharacteristicValue](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html) 写回数据,否则主机不会收到响应。 */
  13900. onCharacteristicReadRequest(
  13901. /** 已连接的设备请求读当前外围设备的特征值事件的监听函数 */
  13902. listener: OnCharacteristicReadRequestCallback
  13903. ): void
  13904. /** [BLEPeripheralServer.onCharacteristicSubscribed(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicSubscribed.html)
  13905. *
  13906. * 需要基础库: `2.13.0`
  13907. *
  13908. * 在插件中使用:不支持
  13909. *
  13910. * 监听特征订阅事件,仅 iOS 支持。 */
  13911. onCharacteristicSubscribed(
  13912. /** 特征订阅事件的监听函数 */
  13913. listener: OnCharacteristicSubscribedCallback
  13914. ): void
  13915. /** [BLEPeripheralServer.onCharacteristicUnsubscribed(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicUnsubscribed.html)
  13916. *
  13917. * 需要基础库: `2.13.0`
  13918. *
  13919. * 在插件中使用:不支持
  13920. *
  13921. * 监听取消特征订阅事件,仅 iOS 支持。 */
  13922. onCharacteristicUnsubscribed(
  13923. /** 取消特征订阅事件的监听函数 */
  13924. listener: OnCharacteristicUnsubscribedCallback
  13925. ): void
  13926. /** [BLEPeripheralServer.onCharacteristicWriteRequest(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.onCharacteristicWriteRequest.html)
  13927. *
  13928. * 需要基础库: `2.10.3`
  13929. *
  13930. * 在插件中使用:不支持
  13931. *
  13932. * 监听已连接的设备请求写当前外围设备的特征值事件。收到该消息后需要立刻调用 [writeCharacteristicValue](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html) 写回数据,否则主机不会收到响应。 */
  13933. onCharacteristicWriteRequest(
  13934. /** 已连接的设备请求写当前外围设备的特征值事件的监听函数 */
  13935. listener: OnCharacteristicWriteRequestCallback
  13936. ): void
  13937. /** [BLEPeripheralServer.removeService(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.removeService.html)
  13938. *
  13939. * 需要基础库: `2.10.3`
  13940. *
  13941. * 在插件中使用:不支持
  13942. *
  13943. * 移除服务。 */
  13944. removeService(option: RemoveServiceOption): void
  13945. /** [BLEPeripheralServer.startAdvertising(Object Object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.startAdvertising.html)
  13946. *
  13947. * 需要基础库: `2.10.3`
  13948. *
  13949. * 在插件中使用:不支持
  13950. *
  13951. * 开始广播本地创建的外围设备。
  13952. *
  13953. * **注意**
  13954. *
  13955. * - Android 8.0.9 开始,支持直接使用 16/32/128 位 UUID;
  13956. * - Android 8.0.9 以下版本只支持 128 位 UUID,使用 16/32 位的 UUID 时需要进行补位(系统会自动识别是否属于预分配区间),可以参考[蓝牙指南](https://developers.weixin.qq.com/miniprogram/dev/framework/device/ble.html);
  13957. * - iOS 必须直接使用 16 位的 UUID,不能补位到 128 位,否则系统组包时仍会按照 128 位传输。iOS 暂不支持 32 位 UUID。
  13958. * - iOS 同时只能发起一个广播,安卓支持同时发起多个广播。
  13959. * - 传 beacon 参数时,不能同时传入 deviceName,serviceUuids,manufacturerData 参数。 */
  13960. startAdvertising(Object: StartAdvertisingObject): void
  13961. /** [BLEPeripheralServer.stopAdvertising(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.stopAdvertising.html)
  13962. *
  13963. * 需要基础库: `2.10.3`
  13964. *
  13965. * 在插件中使用:不支持
  13966. *
  13967. * 停止广播。 */
  13968. stopAdvertising(option?: StopAdvertisingOption): void
  13969. /** [BLEPeripheralServer.writeCharacteristicValue(Object Object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/BLEPeripheralServer.writeCharacteristicValue.html)
  13970. *
  13971. * 需要基础库: `2.10.3`
  13972. *
  13973. * 在插件中使用:不支持
  13974. *
  13975. * 往指定特征写入二进制数据值,并通知已连接的主机,从机的特征值已发生变化,该接口会处理是走回包还是走订阅。 */
  13976. writeCharacteristicValue(Object: WriteCharacteristicValueObject): void
  13977. }
  13978. interface BackgroundAudioError {
  13979. /** 错误信息
  13980. *
  13981. * | 错误码 | 错误信息 | 说明 |
  13982. * | - | - | - |
  13983. * | 10001 | | 系统错误 |
  13984. * | 10002 | | 网络错误 |
  13985. * | 10003 | | 文件错误,请检查是否responseheader是否缺少Content-Length |
  13986. * | 10004 | | 格式错误 |
  13987. * | -1 | | 未知错误 | */ errMsg: string
  13988. /** 错误码
  13989. *
  13990. * | 错误码 | 错误信息 | 说明 |
  13991. * | - | - | - |
  13992. * | 10001 | | 系统错误 |
  13993. * | 10002 | | 网络错误 |
  13994. * | 10003 | | 文件错误,请检查是否responseheader是否缺少Content-Length |
  13995. * | 10004 | | 格式错误 |
  13996. * | -1 | | 未知错误 | */ errCode: number
  13997. }
  13998. interface BeaconError {
  13999. /** 错误信息
  14000. *
  14001. * | 错误码 | 错误信息 | 说明 |
  14002. * | - | - | - |
  14003. * | 0 | ok | 正常 |
  14004. * | 11000 | unsupport | 系统或设备不支持 |
  14005. * | 11001 | bluetooth service unavailable | 蓝牙服务不可用 |
  14006. * | 11002 | location service unavailable | 位置服务不可用 |
  14007. * | 11003 | already start | 已经开始搜索 |
  14008. * | 11004 | not startBeaconDiscovery | 还未开始搜索 |
  14009. * | 11005 | system error | 系统错误 |
  14010. * | 11006 | invalid data | 参数不正确 | */ errMsg: string
  14011. /** 错误码
  14012. *
  14013. * | 错误码 | 错误信息 | 说明 |
  14014. * | - | - | - |
  14015. * | 0 | ok | 正常 |
  14016. * | 11000 | unsupport | 系统或设备不支持 |
  14017. * | 11001 | bluetooth service unavailable | 蓝牙服务不可用 |
  14018. * | 11002 | location service unavailable | 位置服务不可用 |
  14019. * | 11003 | already start | 已经开始搜索 |
  14020. * | 11004 | not startBeaconDiscovery | 还未开始搜索 |
  14021. * | 11005 | system error | 系统错误 |
  14022. * | 11006 | invalid data | 参数不正确 | */ errCode: number
  14023. }
  14024. interface BluetoothError {
  14025. /** 错误信息
  14026. *
  14027. * | 错误码 | 错误信息 | 说明 |
  14028. * | - | - | - |
  14029. * | 0 | ok | 正常 |
  14030. * | -1 | already connect | 已连接 |
  14031. * | 10000 | not init | 未初始化蓝牙适配器 |
  14032. * | 10001 | not available | 当前蓝牙适配器不可用 |
  14033. * | 10002 | no device | 没有找到指定设备 |
  14034. * | 10003 | connection fail | 连接失败 |
  14035. * | 10004 | no service | 没有找到指定服务 |
  14036. * | 10005 | no characteristic | 没有找到指定特征 |
  14037. * | 10006 | no connection | 当前连接已断开 |
  14038. * | 10007 | property not support | 当前特征不支持此操作 |
  14039. * | 10008 | system error | 其余所有系统上报的异常 |
  14040. * | 10009 | system not support | Android 系统特有,系统版本低于 4.3 不支持 BLE |
  14041. * | 10012 | operate time out | 连接超时 |
  14042. * | 10013 | invalid_data | 连接 deviceId 为空或者是格式不正确 | */ errMsg: string
  14043. /** 错误码
  14044. *
  14045. * | 错误码 | 错误信息 | 说明 |
  14046. * | - | - | - |
  14047. * | 0 | ok | 正常 |
  14048. * | -1 | already connect | 已连接 |
  14049. * | 10000 | not init | 未初始化蓝牙适配器 |
  14050. * | 10001 | not available | 当前蓝牙适配器不可用 |
  14051. * | 10002 | no device | 没有找到指定设备 |
  14052. * | 10003 | connection fail | 连接失败 |
  14053. * | 10004 | no service | 没有找到指定服务 |
  14054. * | 10005 | no characteristic | 没有找到指定特征 |
  14055. * | 10006 | no connection | 当前连接已断开 |
  14056. * | 10007 | property not support | 当前特征不支持此操作 |
  14057. * | 10008 | system error | 其余所有系统上报的异常 |
  14058. * | 10009 | system not support | Android 系统特有,系统版本低于 4.3 不支持 BLE |
  14059. * | 10012 | operate time out | 连接超时 |
  14060. * | 10013 | invalid_data | 连接 deviceId 为空或者是格式不正确 | */ errCode: number
  14061. }
  14062. interface CameraContext {
  14063. /** [CameraContext.setZoom(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.setZoom.html)
  14064. *
  14065. * 需要基础库: `2.10.0`
  14066. *
  14067. * 在插件中使用:支持
  14068. *
  14069. * 设置缩放级别 */
  14070. setZoom(option: CameraContextSetZoomOption): void
  14071. /** [CameraContext.startRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.startRecord.html)
  14072. *
  14073. * 在插件中使用:支持
  14074. *
  14075. * 开始录像 */
  14076. startRecord(option: CameraContextStartRecordOption): void
  14077. /** [CameraContext.stopRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.stopRecord.html)
  14078. *
  14079. * 在插件中使用:支持
  14080. *
  14081. * 结束录像 */
  14082. stopRecord(option: CameraContextStopRecordOption): void
  14083. /** [CameraContext.takePhoto(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.takePhoto.html)
  14084. *
  14085. * 在插件中使用:支持
  14086. *
  14087. * 拍摄照片 */
  14088. takePhoto(option: TakePhotoOption): void
  14089. /** [[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)
  14090. *
  14091. * 需要基础库: `2.7.0`
  14092. *
  14093. * 在插件中使用:不支持
  14094. *
  14095. * 获取 Camera 实时帧数据
  14096. *
  14097. * ****
  14098. *
  14099. * 注: 使用该接口需同时在 [camera](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html) 组件属性中指定 frame-size。
  14100. *
  14101. * **示例代码**
  14102. *
  14103. * ```js
  14104. const context = wx.createCameraContext()
  14105. const listener = context.onCameraFrame((frame) => {
  14106. console.log(frame.data instanceof ArrayBuffer, frame.width, frame.height)
  14107. })
  14108. listener.start()
  14109. ``` */
  14110. onCameraFrame(
  14111. /** 回调函数 */
  14112. callback: OnCameraFrameCallback
  14113. ): CameraFrameListener
  14114. }
  14115. interface CameraFrameListener {
  14116. /** [CameraFrameListener.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.start.html)
  14117. *
  14118. * 在插件中使用:不支持
  14119. *
  14120. * 开始监听帧数据 */
  14121. start(option?: CameraFrameListenerStartOption): void
  14122. /** [CameraFrameListener.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.stop.html)
  14123. *
  14124. * 在插件中使用:不支持
  14125. *
  14126. * 停止监听帧数据 */
  14127. stop(option?: StopOption): void
  14128. }
  14129. interface CanvasGradient {
  14130. /** [CanvasGradient.addColorStop(number stop, string color)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasGradient.addColorStop.html)
  14131. *
  14132. * 在插件中使用:不支持
  14133. * @deprecated 基础库版本 [2.9.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [RenderingContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/RenderingContext.html) 替换
  14134. *
  14135. * @warning **CanvasContext 是旧版的接口,新版 [Canvas 2D](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 接口与 Web 一致**
  14136. *
  14137. * 添加颜色的渐变点。小于最小 stop 的部分会按最小 stop 的 color 来渲染,大于最大 stop 的部分会按最大 stop 的 color 来渲染
  14138. *
  14139. * **示例代码**
  14140. *
  14141. * ```js
  14142. const ctx = wx.createCanvasContext('myCanvas')
  14143. // Create circular gradient
  14144. const grd = ctx.createLinearGradient(30, 10, 120, 10)
  14145. grd.addColorStop(0, 'red')
  14146. grd.addColorStop(0.16, 'orange')
  14147. grd.addColorStop(0.33, 'yellow')
  14148. grd.addColorStop(0.5, 'green')
  14149. grd.addColorStop(0.66, 'cyan')
  14150. grd.addColorStop(0.83, 'blue')
  14151. grd.addColorStop(1, 'purple')
  14152. // Fill with gradient
  14153. ctx.setFillStyle(grd)
  14154. ctx.fillRect(10, 10, 150, 80)
  14155. ctx.draw()
  14156. ```
  14157. * ![](@program/dev/image/canvas/color-stop.png) */
  14158. addColorStop(
  14159. /** 表示渐变中开始与结束之间的位置,范围 0-1。 */
  14160. stop: number,
  14161. /** 渐变点的颜色。 */
  14162. color: string
  14163. ): void
  14164. }
  14165. interface CommonPaymentError {
  14166. /** 错误信息
  14167. *
  14168. * | 错误码 | 错误信息 | 说明 |
  14169. * | - | - | - |
  14170. * | -1 | | 支付失败 |
  14171. * | -2 | | 支付取消 |
  14172. * | -4 | | 风控拦截 |
  14173. * | -5 | | 开通签约结果未知 |
  14174. * | -15001 | | 参数错误,具体原因见err_msg |
  14175. * | -15002 | | outTradeNo重复使用,请换新单号重试 |
  14176. * | -15003 | | 系统错误 |
  14177. * | -15004 | | currencyType错误,目前只能填CNY |
  14178. * | -15005 | | 用户态签名signature错误 |
  14179. * | -15006 | | 支付签名paySig错误 |
  14180. * | -15007 | | session_key过期 |
  14181. * | -15008 | | 二级商户进件未完成 |
  14182. * | -15009 | | 代币未发布 |
  14183. * | -15010 | | 道具productId未发布 |
  14184. * | -15011 | | 现网版本的env只能是0,不能填1(沙盒环境) |
  14185. * | -15012 | | 调用米大师失败导致关单,请换新单号重试 |
  14186. * | -15013 | | goodsPrice道具价格错误 |
  14187. * | -15014 | | 道具/代币发布未生效,禁止下单,大概10分钟后生效 |
  14188. * | -15016 | | signData格式有问题 |
  14189. * | -15017 | | 此商家涉嫌违规,收款功能已被限制,暂无法支付。商家可以登录微信商户平台/微信支付商家助手小程序查看原因和解决方案 |
  14190. * | -15018 | | 代币或者道具productId审核不通过 | */ errMsg: string
  14191. /** 错误码
  14192. *
  14193. * | 错误码 | 错误信息 | 说明 |
  14194. * | - | - | - |
  14195. * | -1 | | 支付失败 |
  14196. * | -2 | | 支付取消 |
  14197. * | -4 | | 风控拦截 |
  14198. * | -5 | | 开通签约结果未知 |
  14199. * | -15001 | | 参数错误,具体原因见err_msg |
  14200. * | -15002 | | outTradeNo重复使用,请换新单号重试 |
  14201. * | -15003 | | 系统错误 |
  14202. * | -15004 | | currencyType错误,目前只能填CNY |
  14203. * | -15005 | | 用户态签名signature错误 |
  14204. * | -15006 | | 支付签名paySig错误 |
  14205. * | -15007 | | session_key过期 |
  14206. * | -15008 | | 二级商户进件未完成 |
  14207. * | -15009 | | 代币未发布 |
  14208. * | -15010 | | 道具productId未发布 |
  14209. * | -15011 | | 现网版本的env只能是0,不能填1(沙盒环境) |
  14210. * | -15012 | | 调用米大师失败导致关单,请换新单号重试 |
  14211. * | -15013 | | goodsPrice道具价格错误 |
  14212. * | -15014 | | 道具/代币发布未生效,禁止下单,大概10分钟后生效 |
  14213. * | -15016 | | signData格式有问题 |
  14214. * | -15017 | | 此商家涉嫌违规,收款功能已被限制,暂无法支付。商家可以登录微信商户平台/微信支付商家助手小程序查看原因和解决方案 |
  14215. * | -15018 | | 代币或者道具productId审核不通过 | */ errCode: number
  14216. }
  14217. interface Console {
  14218. /** [console.debug()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.debug.html)
  14219. *
  14220. * 在插件中使用:不支持
  14221. *
  14222. * 向调试面板中打印 debug 日志 */
  14223. debug(
  14224. /** 日志内容,可以有任意多个。 */
  14225. ...args: any[]
  14226. ): void
  14227. /** [console.error()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.error.html)
  14228. *
  14229. * 在插件中使用:不支持
  14230. *
  14231. * 向调试面板中打印 error 日志 */
  14232. error(
  14233. /** 日志内容,可以有任意多个。 */
  14234. ...args: any[]
  14235. ): void
  14236. /** [console.group(string label)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.group.html)
  14237. *
  14238. * 在插件中使用:不支持
  14239. *
  14240. * 在调试面板中创建一个新的分组。随后输出的内容都会被添加一个缩进,表示该内容属于当前分组。调用 [console.groupEnd](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.groupEnd.html)之后分组结束。
  14241. *
  14242. * **注意**
  14243. *
  14244. * 仅在工具中有效,在 vConsole 中为空函数实现。 */
  14245. group(
  14246. /** 分组标记,可选。 */
  14247. label?: string
  14248. ): void
  14249. /** [console.groupEnd()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.groupEnd.html)
  14250. *
  14251. * 在插件中使用:不支持
  14252. *
  14253. * 结束由 [console.group](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.group.html) 创建的分组
  14254. *
  14255. * **注意**
  14256. *
  14257. * 仅在工具中有效,在 vConsole 中为空函数实现。 */
  14258. groupEnd(): void
  14259. /** [console.info()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.info.html)
  14260. *
  14261. * 在插件中使用:不支持
  14262. *
  14263. * 向调试面板中打印 info 日志 */
  14264. info(
  14265. /** 日志内容,可以有任意多个。 */
  14266. ...args: any[]
  14267. ): void
  14268. /** [console.log()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.log.html)
  14269. *
  14270. * 在插件中使用:不支持
  14271. *
  14272. * 向调试面板中打印 log 日志 */
  14273. log(
  14274. /** 日志内容,可以有任意多个。 */
  14275. ...args: any[]
  14276. ): void
  14277. /** [console.warn()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.warn.html)
  14278. *
  14279. * 在插件中使用:不支持
  14280. *
  14281. * 向调试面板中打印 warn 日志 */
  14282. warn(
  14283. /** 日志内容,可以有任意多个。 */
  14284. ...args: any[]
  14285. ): void
  14286. }
  14287. interface DownloadTask {
  14288. /** [DownloadTask.abort()](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.abort.html)
  14289. *
  14290. * 需要基础库: `1.4.0`
  14291. *
  14292. * 在插件中使用:支持
  14293. *
  14294. * 中断下载任务 */
  14295. abort(): void
  14296. /** [DownloadTask.offHeadersReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offHeadersReceived.html)
  14297. *
  14298. * 需要基础库: `2.1.0`
  14299. *
  14300. * 在插件中使用:支持
  14301. *
  14302. * 移除 HTTP Response Header 事件的监听函数
  14303. *
  14304. * **示例代码**
  14305. *
  14306. * ```js
  14307. const listener = function (res) { console.log(res) }
  14308. DownloadTask.onHeadersReceived(listener)
  14309. DownloadTask.offHeadersReceived(listener) // 需传入与监听时同一个的函数对象
  14310. ``` */
  14311. offHeadersReceived(
  14312. /** onHeadersReceived 传入的监听函数。不传此参数则移除所有监听函数。 */
  14313. listener?: DownloadTaskOffHeadersReceivedCallback
  14314. ): void
  14315. /** [DownloadTask.offProgressUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.offProgressUpdate.html)
  14316. *
  14317. * 需要基础库: `2.1.0`
  14318. *
  14319. * 在插件中使用:支持
  14320. *
  14321. * 移除下载进度变化事件的监听函数
  14322. *
  14323. * **示例代码**
  14324. *
  14325. * ```js
  14326. const listener = function (res) { console.log(res) }
  14327. DownloadTask.onProgressUpdate(listener)
  14328. DownloadTask.offProgressUpdate(listener) // 需传入与监听时同一个的函数对象
  14329. ``` */
  14330. offProgressUpdate(
  14331. /** onProgressUpdate 传入的监听函数。不传此参数则移除所有监听函数。 */
  14332. listener?: DownloadTaskOffProgressUpdateCallback
  14333. ): void
  14334. /** [DownloadTask.onHeadersReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onHeadersReceived.html)
  14335. *
  14336. * 需要基础库: `2.1.0`
  14337. *
  14338. * 在插件中使用:支持
  14339. *
  14340. * 监听 HTTP Response Header 事件。会比请求完成事件更早 */
  14341. onHeadersReceived(
  14342. /** HTTP Response Header 事件的监听函数 */
  14343. listener: DownloadTaskOnHeadersReceivedCallback
  14344. ): void
  14345. /** [DownloadTask.onProgressUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/download/DownloadTask.onProgressUpdate.html)
  14346. *
  14347. * 需要基础库: `1.4.0`
  14348. *
  14349. * 在插件中使用:支持
  14350. *
  14351. * 监听下载进度变化事件 */
  14352. onProgressUpdate(
  14353. /** 下载进度变化事件的监听函数 */
  14354. listener: DownloadTaskOnProgressUpdateCallback
  14355. ): void
  14356. }
  14357. interface DraggableSheetContext {
  14358. /** [DraggableSheetContext.scrollTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/skyline/DraggableSheetContext.scrollTo.html)
  14359. *
  14360. * 需要基础库: `3.2.0`
  14361. *
  14362. * 在插件中使用:支持
  14363. *
  14364. * 滚动到指定位置。`size` 取值 `[0, 1]`,`size = 1` 时表示撑满 `draggable-sheet` 组件。`size` 和 `pixels` 同时传入时,仅 size 生效。
  14365. *
  14366. * **示例代码**
  14367. *
  14368. * ```javascript
  14369. Page({
  14370. onReady() {
  14371. this.createSelectorQuery()
  14372. .select(".sheet")
  14373. .node()
  14374. .exec(res => {
  14375. const sheetContext = res[0].node
  14376. sheetContext.scrollTo({
  14377. size: 0.7,
  14378. animated: true,
  14379. duration: 300,
  14380. easingFunction: 'ease'
  14381. })
  14382. },
  14383. })
  14384. ``` */
  14385. scrollTo(option: DraggableSheetContextScrollToOption): void
  14386. }
  14387. interface EditorContext {
  14388. /** [EditorContext.blur(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.blur.html)
  14389. *
  14390. * 需要基础库: `2.8.3`
  14391. *
  14392. * 在插件中使用:支持
  14393. *
  14394. * 编辑器失焦,同时收起键盘。 */
  14395. blur(option?: BlurOption): void
  14396. /** [EditorContext.clear(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.clear.html)
  14397. *
  14398. * 需要基础库: `2.7.0`
  14399. *
  14400. * 在插件中使用:支持
  14401. *
  14402. * 清空编辑器内容 */
  14403. clear(option?: ClearOption): void
  14404. /** [EditorContext.format(string name, string value)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.format.html)
  14405. *
  14406. * 需要基础库: `2.7.0`
  14407. *
  14408. * 在插件中使用:支持
  14409. *
  14410. * 修改样式
  14411. *
  14412. * ****
  14413. *
  14414. * ## 支持设置的样式列表
  14415. * | name | value | verson |
  14416. * | --------------------------------------------------------- | ------------------------------- | ------ |
  14417. * | bold | | 2.7.0 |
  14418. * | italic | | 2.7.0 |
  14419. * | underline | | 2.7.0 |
  14420. * | strike | | 2.7.0 |
  14421. * | ins | | 2.7.0 |
  14422. * | script | sub / super | 2.7.0 |
  14423. * | header | H1 / H2 / h3 / H4 / h5 / H6 | 2.7.0 |
  14424. * | align | left / center / right / justify | 2.7.0 |
  14425. * | direction | rtl | 2.7.0 |
  14426. * | indent | -1 / +1 | 2.7.0 |
  14427. * | list | ordered / bullet / check | 2.7.0 |
  14428. * | color | hex color | 2.7.0 |
  14429. * | backgroundColor | hex color | 2.7.0 |
  14430. * | margin/marginTop/marginBottom/marginLeft/marginRight | css style | 2.7.0 |
  14431. * | padding/paddingTop/paddingBottom/paddingLeft/paddingRight | css style | 2.7.0 |
  14432. * | font/fontSize/fontStyle/fontVariant/fontWeight/fontFamily | css style | 2.7.0 |
  14433. * | lineHeight | css style | 2.7.0 |
  14434. * | letterSpacing | css style | 2.7.0 |
  14435. * | textDecoration | css style | 2.7.0 |
  14436. * | textIndent | css style | 2.8.0 |
  14437. * | wordWrap | css style | 2.10.2 |
  14438. * | wordBreak | css style | 2.10.2 |
  14439. * | whiteSpace | css style | 2.10.2 |
  14440. *
  14441. * 对已经应用样式的选区设置会取消样式。css style 表示 css 中规定的允许值。 */
  14442. format(
  14443. /** 属性 */
  14444. name: string,
  14445. /** 值 */
  14446. value?: string
  14447. ): void
  14448. /** [EditorContext.getContents(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getContents.html)
  14449. *
  14450. * 需要基础库: `2.7.0`
  14451. *
  14452. * 在插件中使用:支持
  14453. *
  14454. * 获取编辑器内容 */
  14455. getContents(option?: GetContentsOption): void
  14456. /** [EditorContext.getSelectionText(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getSelectionText.html)
  14457. *
  14458. * 需要基础库: `2.10.2`
  14459. *
  14460. * 在插件中使用:支持
  14461. *
  14462. * 获取编辑器已选区域内的纯文本内容。当编辑器失焦或未选中一段区间时,返回内容为空。 */
  14463. getSelectionText(option?: GetSelectionTextOption): void
  14464. /** [EditorContext.insertDivider(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertDivider.html)
  14465. *
  14466. * 需要基础库: `2.7.0`
  14467. *
  14468. * 在插件中使用:支持
  14469. *
  14470. * 插入分割线 */
  14471. insertDivider(option?: InsertDividerOption): void
  14472. /** [EditorContext.insertImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertImage.html)
  14473. *
  14474. * 需要基础库: `2.7.0`
  14475. *
  14476. * 在插件中使用:支持
  14477. *
  14478. * 插入图片。
  14479. *
  14480. * 地址为临时文件时,获取的编辑器html格式内容中 <img> 标签增加属性 data-local,delta 格式内容中图片 attributes 属性增加 data-local 字段,该值为传入的临时文件地址。
  14481. *
  14482. * 开发者可选择在提交阶段上传图片到服务器,获取到网络地址后进行替换。替换时对于html内容应替换掉 <img> 的 src 值,对于 delta 内容应替换掉 `insert { image: abc }` 值。
  14483. *
  14484. * **示例代码**
  14485. *
  14486. * ```javascript
  14487. this.editorCtx.insertImage({
  14488. src: 'xx',
  14489. width: '100px',
  14490. height: '50px',
  14491. extClass: className
  14492. })
  14493. ``` */
  14494. insertImage(option: InsertImageOption): void
  14495. /** [EditorContext.insertText(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertText.html)
  14496. *
  14497. * 需要基础库: `2.7.0`
  14498. *
  14499. * 在插件中使用:支持
  14500. *
  14501. * 覆盖当前选区,设置一段文本 */
  14502. insertText(option: InsertTextOption): void
  14503. /** [EditorContext.redo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.redo.html)
  14504. *
  14505. * 需要基础库: `2.7.0`
  14506. *
  14507. * 在插件中使用:支持
  14508. *
  14509. * 恢复 */
  14510. redo(option?: RedoOption): void
  14511. /** [EditorContext.removeFormat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.removeFormat.html)
  14512. *
  14513. * 需要基础库: `2.7.0`
  14514. *
  14515. * 在插件中使用:支持
  14516. *
  14517. * 清除当前选区的样式 */
  14518. removeFormat(option?: RemoveFormatOption): void
  14519. /** [EditorContext.scrollIntoView()](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.scrollIntoView.html)
  14520. *
  14521. * 需要基础库: `2.8.3`
  14522. *
  14523. * 在插件中使用:支持
  14524. *
  14525. * 使得编辑器光标处滚动到窗口可视区域内。 */
  14526. scrollIntoView(): void
  14527. /** [EditorContext.setContents(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.setContents.html)
  14528. *
  14529. * 需要基础库: `2.7.0`
  14530. *
  14531. * 在插件中使用:支持
  14532. *
  14533. * 初始化编辑器内容,html和delta同时存在时仅delta生效 */
  14534. setContents(option: SetContentsOption): void
  14535. /** [EditorContext.undo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.undo.html)
  14536. *
  14537. * 需要基础库: `2.7.0`
  14538. *
  14539. * 在插件中使用:支持
  14540. *
  14541. * 撤销 */
  14542. undo(option?: UndoOption): void
  14543. }
  14544. interface EntryList {
  14545. /** [Array.&lt;[PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html)&gt; EntryList.getEntries()](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/EntryList.getEntries.html)
  14546. *
  14547. * 需要基础库: `2.11.0`
  14548. *
  14549. * 在插件中使用:不支持
  14550. *
  14551. * 该方法返回当前列表中的所有性能数据 */
  14552. getEntries(): PerformanceEntry[]
  14553. /** [Array.&lt;[PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html)&gt; EntryList.getEntriesByName(string name, string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/EntryList.getEntriesByName.html)
  14554. *
  14555. * 需要基础库: `2.11.0`
  14556. *
  14557. * 在插件中使用:不支持
  14558. *
  14559. * 获取当前列表中所有名称为 [name] 且类型为 [entryType] 的性能数据 */
  14560. getEntriesByName(
  14561. name: string,
  14562. entryType?: string
  14563. ): PerformanceEntry[]
  14564. /** [Array.&lt;[PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html)&gt; EntryList.getEntriesByType(string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/EntryList.getEntriesByType.html)
  14565. *
  14566. * 需要基础库: `2.11.0`
  14567. *
  14568. * 在插件中使用:不支持
  14569. *
  14570. * 获取当前列表中所有类型为 [entryType] 的性能数据 */
  14571. getEntriesByType(entryType: string): PerformanceEntry[]
  14572. }
  14573. interface EventChannel {
  14574. /** [EventChannel.emit(string eventName, any args)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.emit.html)
  14575. *
  14576. * 需要基础库: `2.7.3`
  14577. *
  14578. * 在插件中使用:支持
  14579. *
  14580. * 触发一个事件 */
  14581. emit(
  14582. /** 事件名称 */
  14583. eventName: string,
  14584. /** 事件参数 */
  14585. ...args: any
  14586. ): void
  14587. /** [EventChannel.off(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.off.html)
  14588. *
  14589. * 需要基础库: `2.7.3`
  14590. *
  14591. * 在插件中使用:支持
  14592. *
  14593. * 取消监听一个事件。给出第二个参数时,只取消给出的监听函数,否则取消所有监听函数 */
  14594. off(
  14595. /** 事件名称 */
  14596. eventName: string,
  14597. /** 事件监听函数 */
  14598. fn: EventCallback
  14599. ): void
  14600. /** [EventChannel.on(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.on.html)
  14601. *
  14602. * 需要基础库: `2.7.3`
  14603. *
  14604. * 在插件中使用:支持
  14605. *
  14606. * 持续监听一个事件 */
  14607. on(
  14608. /** 事件名称 */
  14609. eventName: string,
  14610. /** 事件监听函数 */
  14611. fn: EventCallback
  14612. ): void
  14613. /** [EventChannel.once(string eventName, function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/route/EventChannel.once.html)
  14614. *
  14615. * 需要基础库: `2.7.3`
  14616. *
  14617. * 在插件中使用:支持
  14618. *
  14619. * 监听一个事件一次,触发后失效 */
  14620. once(
  14621. /** 事件名称 */
  14622. eventName: string,
  14623. /** 事件监听函数 */
  14624. fn: EventCallback
  14625. ): void
  14626. }
  14627. interface FileError {
  14628. /** 错误信息
  14629. *
  14630. * | 错误码 | 错误信息 | 说明 |
  14631. * | - | - | - |
  14632. * | 1300001 | operation not permitted | 操作不被允许(例如,filePath 预期传入一个文件而实际传入一个目录) |
  14633. * | 1300002 | no such file or directory ${path} | 文件/目录不存在,或者目标文件路径的上层目录不存在 |
  14634. * | 1300005 | Input/output error | 输入输出流不可用 |
  14635. * | 1300009 | bad file descriptor | 无效的文件描述符 |
  14636. * | 1300013 | permission denied | 权限错误,文件是只读或只写 |
  14637. * | 1300014 | Path permission denied | 传入的路径没有权限 |
  14638. * | 1300020 | not a directory | dirPath 指定路径不是目录,常见于指定的写入路径的上级路径为一个文件的情况 |
  14639. * | 1300021 | Is a directory | 指定路径是一个目录 |
  14640. * | 1300022 | Invalid argument | 无效参数,可以检查length或offset是否越界 |
  14641. * | 1300036 | File name too long | 文件名过长 |
  14642. * | 1300066 | directory not empty | 目录不为空 |
  14643. * | 1300201 | system error | 系统接口调用失败 |
  14644. * | 1300202 | the maximum size of the file storage limit is exceeded | 存储空间不足,或文件大小超出上限(上限100M) |
  14645. * | 1300203 | base64 encode error | 字符编码转换失败(例如 base64 格式错误) |
  14646. * | 1300300 | sdcard not mounted | android sdcard 挂载失败 |
  14647. * | 1300301 | unable to open as fileType | 无法以fileType打开文件 |
  14648. * | 1301000 | permission denied, cannot access file path | 目标路径无访问权限(usr目录) |
  14649. * | 1301002 | data to write is empty | 写入数据为空 |
  14650. * | 1301003 | illegal operation on a directory | 不可对目录进行此操作(例如,指定的 filePath 是一个已经存在的目录) |
  14651. * | 1301004 | illegal operation on a package directory | 不可对代码包目录进行此操作 |
  14652. * | 1301005 | file already exists ${dirPath} | 已有同名文件或目录 |
  14653. * | 1301006 | value of length is out of range | 传入的 length 不合法 |
  14654. * | 1301007 | value of offset is out of range | 传入的 offset 不合法 |
  14655. * | 1301009 | value of position is out of range | position值越界 |
  14656. * | 1301100 | store directory is empty | store目录为空 |
  14657. * | 1301102 | unzip open file fail | 压缩文件打开失败 |
  14658. * | 1301103 | unzip entry fail | 解压单个文件失败 |
  14659. * | 1301104 | unzip fail | 解压失败 |
  14660. * | 1301111 | brotli decompress fail | brotli解压失败(例如,指定的 compressionAlgorithm 与文件实际压缩格式不符) |
  14661. * | 1301112 | tempFilePath file not exist | 指定的 tempFilePath 找不到文件 |
  14662. * | 1302001 | fail permission denied | 指定的 fd 路径没有读权限/没有写权限 |
  14663. * | 1302002 | excced max concurrent fd limit | fd数量已达上限 |
  14664. * | 1302003 | invalid flag | 无效的flag |
  14665. * | 1302004 | permission denied when open using flag | 无法使用flag标志打开文件 |
  14666. * | 1302005 | array buffer does not exist | 未传入arrayBuffer |
  14667. * | 1302100 | array buffer is readonly | arrayBuffer只读 | */ errMsg: string
  14668. /** 错误码
  14669. *
  14670. * | 错误码 | 错误信息 | 说明 |
  14671. * | - | - | - |
  14672. * | 1300001 | operation not permitted | 操作不被允许(例如,filePath 预期传入一个文件而实际传入一个目录) |
  14673. * | 1300002 | no such file or directory ${path} | 文件/目录不存在,或者目标文件路径的上层目录不存在 |
  14674. * | 1300005 | Input/output error | 输入输出流不可用 |
  14675. * | 1300009 | bad file descriptor | 无效的文件描述符 |
  14676. * | 1300013 | permission denied | 权限错误,文件是只读或只写 |
  14677. * | 1300014 | Path permission denied | 传入的路径没有权限 |
  14678. * | 1300020 | not a directory | dirPath 指定路径不是目录,常见于指定的写入路径的上级路径为一个文件的情况 |
  14679. * | 1300021 | Is a directory | 指定路径是一个目录 |
  14680. * | 1300022 | Invalid argument | 无效参数,可以检查length或offset是否越界 |
  14681. * | 1300036 | File name too long | 文件名过长 |
  14682. * | 1300066 | directory not empty | 目录不为空 |
  14683. * | 1300201 | system error | 系统接口调用失败 |
  14684. * | 1300202 | the maximum size of the file storage limit is exceeded | 存储空间不足,或文件大小超出上限(上限100M) |
  14685. * | 1300203 | base64 encode error | 字符编码转换失败(例如 base64 格式错误) |
  14686. * | 1300300 | sdcard not mounted | android sdcard 挂载失败 |
  14687. * | 1300301 | unable to open as fileType | 无法以fileType打开文件 |
  14688. * | 1301000 | permission denied, cannot access file path | 目标路径无访问权限(usr目录) |
  14689. * | 1301002 | data to write is empty | 写入数据为空 |
  14690. * | 1301003 | illegal operation on a directory | 不可对目录进行此操作(例如,指定的 filePath 是一个已经存在的目录) |
  14691. * | 1301004 | illegal operation on a package directory | 不可对代码包目录进行此操作 |
  14692. * | 1301005 | file already exists ${dirPath} | 已有同名文件或目录 |
  14693. * | 1301006 | value of length is out of range | 传入的 length 不合法 |
  14694. * | 1301007 | value of offset is out of range | 传入的 offset 不合法 |
  14695. * | 1301009 | value of position is out of range | position值越界 |
  14696. * | 1301100 | store directory is empty | store目录为空 |
  14697. * | 1301102 | unzip open file fail | 压缩文件打开失败 |
  14698. * | 1301103 | unzip entry fail | 解压单个文件失败 |
  14699. * | 1301104 | unzip fail | 解压失败 |
  14700. * | 1301111 | brotli decompress fail | brotli解压失败(例如,指定的 compressionAlgorithm 与文件实际压缩格式不符) |
  14701. * | 1301112 | tempFilePath file not exist | 指定的 tempFilePath 找不到文件 |
  14702. * | 1302001 | fail permission denied | 指定的 fd 路径没有读权限/没有写权限 |
  14703. * | 1302002 | excced max concurrent fd limit | fd数量已达上限 |
  14704. * | 1302003 | invalid flag | 无效的flag |
  14705. * | 1302004 | permission denied when open using flag | 无法使用flag标志打开文件 |
  14706. * | 1302005 | array buffer does not exist | 未传入arrayBuffer |
  14707. * | 1302100 | array buffer is readonly | arrayBuffer只读 | */ errCode: number
  14708. }
  14709. interface FileSystemManager {
  14710. /** [Array.&lt;string&gt; FileSystemManager.readdirSync(string dirPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdirSync.html)
  14711. *
  14712. * 在插件中使用:需要基础库 `2.19.2`
  14713. *
  14714. * [FileSystemManager.readdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdir.html) 的同步版本
  14715. *
  14716. * **注意事项</title>
  14717. * - readdir接口无法访问文件系统根路径(wxfile://)。
  14718. * <title>示例代码**
  14719. *
  14720. * ```js
  14721. const fs = wx.getFileSystemManager()
  14722. fs.readdir({
  14723. dirPath: `${wx.env.USER_DATA_PATH}/example`,
  14724. success(res) {
  14725. console.log(res.files)
  14726. },
  14727. fail(res) {
  14728. console.error(res)
  14729. }
  14730. })
  14731. // 同步接口
  14732. try {
  14733. const res = fs.readdirSync(`${wx.env.USER_DATA_PATH}/example`)
  14734. console.log(res)
  14735. } catch(e) {
  14736. console.error(e)
  14737. }
  14738. ``` */
  14739. readdirSync(
  14740. /** 要读取的目录路径 (本地路径) */
  14741. dirPath: string
  14742. ): string[]
  14743. /** [ArrayBuffer FileSystemManager.readCompressedFileSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readCompressedFileSync.html)
  14744. *
  14745. * 需要基础库: `2.21.1`
  14746. *
  14747. * 在插件中使用:不支持
  14748. *
  14749. * 同步读取指定压缩类型的本地文件内容
  14750. *
  14751. * **示例代码**
  14752. *
  14753. * ```js
  14754. const fs = wx.getFileSystemManager()
  14755. // 异步接口
  14756. fs.readCompressedFile({
  14757. filePath: '${wx.env.USER_DATA_PATH}/hello.br',
  14758. compressionAlgorithm: 'br',
  14759. success(res) {
  14760. console.log(res.data)
  14761. },
  14762. fail(res) {
  14763. console.log('readCompressedFile fail', res)
  14764. }
  14765. })
  14766. // 同步接口
  14767. try {
  14768. const data = fs.readCompressedFileSync({
  14769. filePath: '${wx.env.USER_DATA_PATH}/hello.br',
  14770. compressionAlgorithm: 'br',
  14771. })
  14772. console.log(data)
  14773. } catch (err) {
  14774. console.log(err)
  14775. }
  14776. ``` */
  14777. readCompressedFileSync(
  14778. option: ReadCompressedFileSyncOption
  14779. ): ArrayBuffer
  14780. /** [FileSystemManager.access(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html)
  14781. *
  14782. * 在插件中使用:需要基础库 `2.19.2`
  14783. *
  14784. * 判断文件/目录是否存在
  14785. *
  14786. * **示例代码**
  14787. *
  14788. * ```js
  14789. const fs = wx.getFileSystemManager()
  14790. // 判断文件/目录是否存在
  14791. fs.access({
  14792. path: `${wx.env.USER_DATA_PATH}/hello.txt`,
  14793. success(res) {
  14794. // 文件存在
  14795. console.log(res)
  14796. },
  14797. fail(res) {
  14798. // 文件不存在或其他错误
  14799. console.error(res)
  14800. }
  14801. })
  14802. // 同步接口
  14803. try {
  14804. fs.accessSync(`${wx.env.USER_DATA_PATH}/hello.txt`)
  14805. } catch(e) {
  14806. console.error(e)
  14807. }
  14808. ``` */
  14809. access(option: AccessOption): void
  14810. /** [FileSystemManager.accessSync(string path)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.accessSync.html)
  14811. *
  14812. * 在插件中使用:需要基础库 `2.19.2`
  14813. *
  14814. * [FileSystemManager.access](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.access.html) 的同步版本
  14815. *
  14816. * **示例代码**
  14817. *
  14818. * ```js
  14819. const fs = wx.getFileSystemManager()
  14820. // 判断文件/目录是否存在
  14821. fs.access({
  14822. path: `${wx.env.USER_DATA_PATH}/hello.txt`,
  14823. success(res) {
  14824. // 文件存在
  14825. console.log(res)
  14826. },
  14827. fail(res) {
  14828. // 文件不存在或其他错误
  14829. console.error(res)
  14830. }
  14831. })
  14832. // 同步接口
  14833. try {
  14834. fs.accessSync(`${wx.env.USER_DATA_PATH}/hello.txt`)
  14835. } catch(e) {
  14836. console.error(e)
  14837. }
  14838. ``` */
  14839. accessSync(
  14840. /** 要判断是否存在的文件/目录路径 (本地路径) */
  14841. path: string
  14842. ): void
  14843. /** [FileSystemManager.appendFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFile.html)
  14844. *
  14845. * 需要基础库: `2.1.0`
  14846. *
  14847. * 在插件中使用:需要基础库 `2.19.2`
  14848. *
  14849. * 在文件结尾追加内容
  14850. *
  14851. * **示例代码**
  14852. *
  14853. * ```js
  14854. const fs = wx.getFileSystemManager()
  14855. fs.appendFile({
  14856. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  14857. data: 'some text',
  14858. encoding: 'utf8',
  14859. success(res) {
  14860. console.log(res)
  14861. },
  14862. fail(res) {
  14863. console.error(res)
  14864. }
  14865. })
  14866. // 同步接口
  14867. try {
  14868. fs.appendFileSync(`${wx.env.USER_DATA_PATH}/hello.txt`, 'some text', 'utf8')
  14869. } catch(e) {
  14870. console.error(e)
  14871. }
  14872. ``` */
  14873. appendFile(option: AppendFileOption): void
  14874. /** [FileSystemManager.appendFileSync(string filePath, string|ArrayBuffer data, string encoding)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFileSync.html)
  14875. *
  14876. * 需要基础库: `2.1.0`
  14877. *
  14878. * 在插件中使用:需要基础库 `2.19.2`
  14879. *
  14880. * [FileSystemManager.appendFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.appendFile.html) 的同步版本
  14881. *
  14882. * **示例代码**
  14883. *
  14884. * ```js
  14885. const fs = wx.getFileSystemManager()
  14886. fs.appendFile({
  14887. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  14888. data: 'some text',
  14889. encoding: 'utf8',
  14890. success(res) {
  14891. console.log(res)
  14892. },
  14893. fail(res) {
  14894. console.error(res)
  14895. }
  14896. })
  14897. // 同步接口
  14898. try {
  14899. fs.appendFileSync(`${wx.env.USER_DATA_PATH}/hello.txt`, 'some text', 'utf8')
  14900. } catch(e) {
  14901. console.error(e)
  14902. }
  14903. ``` */
  14904. appendFileSync(
  14905. /** 要追加内容的文件路径 (本地路径) */
  14906. filePath: string,
  14907. /** 要追加的文本或二进制数据 */
  14908. data: string | ArrayBuffer,
  14909. /** 指定写入文件的字符编码
  14910. *
  14911. * 参数 encoding 可选值:
  14912. * - 'ascii': ;
  14913. * - 'base64': ;
  14914. * - 'binary': ;
  14915. * - 'hex': ;
  14916. * - 'ucs2': 以小端序读取;
  14917. * - 'ucs-2': 以小端序读取;
  14918. * - 'utf16le': 以小端序读取;
  14919. * - 'utf-16le': 以小端序读取;
  14920. * - 'utf-8': ;
  14921. * - 'utf8': ;
  14922. * - 'latin1': ; */
  14923. encoding?:
  14924. | 'ascii'
  14925. | 'base64'
  14926. | 'binary'
  14927. | 'hex'
  14928. | 'ucs2'
  14929. | 'ucs-2'
  14930. | 'utf16le'
  14931. | 'utf-16le'
  14932. | 'utf-8'
  14933. | 'utf8'
  14934. | 'latin1'
  14935. ): void
  14936. /** [FileSystemManager.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.close.html)
  14937. *
  14938. * 需要基础库: `2.16.1`
  14939. *
  14940. * 在插件中使用:需要基础库 `2.19.2`
  14941. *
  14942. * 关闭文件
  14943. *
  14944. * **示例代码**
  14945. *
  14946. * ```js
  14947. const fs = wx.getFileSystemManager()
  14948. // 打开文件
  14949. fs.open({
  14950. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  14951. flag: 'a+',
  14952. success(res) {
  14953. // 关闭文件
  14954. fs.close({
  14955. fd: res.fd
  14956. })
  14957. }
  14958. })
  14959. ``` */
  14960. close(option: FileSystemManagerCloseOption): void
  14961. /** [FileSystemManager.copyFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html)
  14962. *
  14963. * 在插件中使用:需要基础库 `2.19.2`
  14964. *
  14965. * 复制文件
  14966. *
  14967. * **示例代码**
  14968. *
  14969. * ```js
  14970. const fs = wx.getFileSystemManager()
  14971. fs.copyFile({
  14972. srcPath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  14973. destPath: `${wx.env.USER_DATA_PATH}/hello_copy.txt`
  14974. success(res) {
  14975. console.log(res)
  14976. },
  14977. fail(res) {
  14978. console.error(res)
  14979. }
  14980. })
  14981. // 同步接口
  14982. try {
  14983. fs.copyFileSync(
  14984. `${wx.env.USER_DATA_PATH}/hello.txt`,
  14985. `${wx.env.USER_DATA_PATH}/hello_copy.txt`
  14986. )
  14987. } catch(e) {
  14988. console.error(e)
  14989. }
  14990. ``` */
  14991. copyFile(option: CopyFileOption): void
  14992. /** [FileSystemManager.copyFileSync(string srcPath, string destPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFileSync.html)
  14993. *
  14994. * 在插件中使用:需要基础库 `2.19.2`
  14995. *
  14996. * [FileSystemManager.copyFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.copyFile.html) 的同步版本
  14997. *
  14998. * **示例代码**
  14999. *
  15000. * ```js
  15001. const fs = wx.getFileSystemManager()
  15002. fs.copyFile({
  15003. srcPath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15004. destPath: `${wx.env.USER_DATA_PATH}/hello_copy.txt`
  15005. success(res) {
  15006. console.log(res)
  15007. },
  15008. fail(res) {
  15009. console.error(res)
  15010. }
  15011. })
  15012. // 同步接口
  15013. try {
  15014. fs.copyFileSync(
  15015. `${wx.env.USER_DATA_PATH}/hello.txt`,
  15016. `${wx.env.USER_DATA_PATH}/hello_copy.txt`
  15017. )
  15018. } catch(e) {
  15019. console.error(e)
  15020. }
  15021. ``` */
  15022. copyFileSync(
  15023. /** 源文件路径,支持本地路径 */
  15024. srcPath: string,
  15025. /** 目标文件路径,支持本地路径 */
  15026. destPath: string
  15027. ): void
  15028. /** [FileSystemManager.fstat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.fstat.html)
  15029. *
  15030. * 需要基础库: `2.16.1`
  15031. *
  15032. * 在插件中使用:需要基础库 `2.19.2`
  15033. *
  15034. * 获取文件的状态信息
  15035. *
  15036. * **示例代码**
  15037. *
  15038. * ```js
  15039. const fs = wx.getFileSystemManager()
  15040. // 打开文件
  15041. fs.open({
  15042. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15043. flag: 'a+',
  15044. success(res) {
  15045. // 获取文件的状态信息
  15046. fs.fstat({
  15047. fd: res.fd,
  15048. success(res) {
  15049. console.log(res.stats)
  15050. }
  15051. })
  15052. }
  15053. })
  15054. ``` */
  15055. fstat(option: FstatOption): void
  15056. /** [FileSystemManager.ftruncate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.ftruncate.html)
  15057. *
  15058. * 需要基础库: `2.16.1`
  15059. *
  15060. * 在插件中使用:需要基础库 `2.19.2`
  15061. *
  15062. * 对文件内容进行截断操作
  15063. *
  15064. * **示例代码**
  15065. *
  15066. * ```js
  15067. const fs = wx.getFileSystemManager()
  15068. // 打开文件
  15069. fs.open({
  15070. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15071. flag: 'a+',
  15072. success(res) {
  15073. // 对文件内容进行截断操作
  15074. fs.ftruncate({
  15075. fd: res.fd,
  15076. length: 10, // 从第10个字节开始截断文件
  15077. success(res) {
  15078. console.log(res)
  15079. }
  15080. })
  15081. }
  15082. })
  15083. ``` */
  15084. ftruncate(option: FtruncateOption): void
  15085. /** [FileSystemManager.getFileInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.getFileInfo.html)
  15086. *
  15087. * 在插件中使用:不支持
  15088. *
  15089. * 获取该小程序下的 本地临时文件 或 本地缓存文件 信息 */
  15090. getFileInfo(option: GetFileInfoOption): void
  15091. /** [FileSystemManager.getSavedFileList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.getSavedFileList.html)
  15092. *
  15093. * 在插件中使用:不支持
  15094. *
  15095. * 获取该小程序下已保存的本地缓存文件列表 */
  15096. getSavedFileList(option?: GetSavedFileListOption): void
  15097. /** [FileSystemManager.mkdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdir.html)
  15098. *
  15099. * 在插件中使用:需要基础库 `2.19.2`
  15100. *
  15101. * 创建目录
  15102. *
  15103. * **示例代码**
  15104. *
  15105. * ```js
  15106. const fs = wx.getFileSystemManager()
  15107. fs.mkdir({
  15108. dirPath: `${wx.env.USER_DATA_PATH}/example`,
  15109. recursive: false
  15110. success(res) {
  15111. console.log(res)
  15112. },
  15113. fail(res) {
  15114. console.error(res)
  15115. }
  15116. })
  15117. // 同步接口
  15118. try {
  15119. fs.mkdirSync(`${wx.env.USER_DATA_PATH}/example`, false)
  15120. } catch(e) {
  15121. console.error(e)
  15122. }
  15123. ``` */
  15124. mkdir(option: MkdirOption): void
  15125. /** [FileSystemManager.mkdirSync(string dirPath, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdirSync.html)
  15126. *
  15127. * 在插件中使用:需要基础库 `2.19.2`
  15128. *
  15129. * [FileSystemManager.mkdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.mkdir.html) 的同步版本
  15130. *
  15131. * **示例代码**
  15132. *
  15133. * ```js
  15134. const fs = wx.getFileSystemManager()
  15135. fs.mkdir({
  15136. dirPath: `${wx.env.USER_DATA_PATH}/example`,
  15137. recursive: false
  15138. success(res) {
  15139. console.log(res)
  15140. },
  15141. fail(res) {
  15142. console.error(res)
  15143. }
  15144. })
  15145. // 同步接口
  15146. try {
  15147. fs.mkdirSync(`${wx.env.USER_DATA_PATH}/example`, false)
  15148. } catch(e) {
  15149. console.error(e)
  15150. }
  15151. ``` */
  15152. mkdirSync(
  15153. /** 创建的目录路径 (本地路径) */
  15154. dirPath: string,
  15155. /** 需要基础库: `2.3.0`
  15156. *
  15157. * 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。 */
  15158. recursive?: boolean
  15159. ): void
  15160. /** [FileSystemManager.open(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.open.html)
  15161. *
  15162. * 需要基础库: `2.16.1`
  15163. *
  15164. * 在插件中使用:需要基础库 `2.19.2`
  15165. *
  15166. * 打开文件,返回文件描述符
  15167. *
  15168. * **示例代码**
  15169. *
  15170. * ```js
  15171. const fs = wx.getFileSystemManager()
  15172. fs.open({
  15173. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15174. flag: 'a+',
  15175. success(res) {
  15176. console.log(res.fd)
  15177. }
  15178. })
  15179. ``` */
  15180. open(option: OpenOption): void
  15181. /** [FileSystemManager.read(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.read.html)
  15182. *
  15183. * 需要基础库: `2.16.1`
  15184. *
  15185. * 在插件中使用:需要基础库 `2.19.2`
  15186. *
  15187. * 读文件
  15188. *
  15189. * **示例代码**
  15190. *
  15191. * ```js
  15192. const fs = wx.getFileSystemManager()
  15193. const ab = new ArrayBuffer(1024)
  15194. // 打开文件
  15195. fs.open({
  15196. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15197. flag: 'a+',
  15198. success(res) {
  15199. // 读取文件到 ArrayBuffer 中
  15200. fs.read({
  15201. fd: res.fd,
  15202. arrayBuffer: ab,
  15203. length: 10,
  15204. success(res) {
  15205. console.log(res)
  15206. }
  15207. })
  15208. }
  15209. })
  15210. ``` */
  15211. read(option: ReadOption): void
  15212. /** [FileSystemManager.readCompressedFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readCompressedFile.html)
  15213. *
  15214. * 需要基础库: `2.21.1`
  15215. *
  15216. * 在插件中使用:不支持
  15217. *
  15218. * 读取指定压缩类型的本地文件内容
  15219. *
  15220. * **示例代码**
  15221. *
  15222. * ```js
  15223. const fs = wx.getFileSystemManager()
  15224. // 异步接口
  15225. fs.readCompressedFile({
  15226. filePath: '${wx.env.USER_DATA_PATH}/hello.br',
  15227. compressionAlgorithm: 'br',
  15228. success(res) {
  15229. console.log(res.data)
  15230. },
  15231. fail(res) {
  15232. console.log('readCompressedFile fail', res)
  15233. }
  15234. })
  15235. // 同步接口
  15236. const data = fs.readCompressedFileSync({
  15237. filePath: '${wx.env.USER_DATA_PATH}/hello.br',
  15238. compressionAlgorithm: 'br',
  15239. })
  15240. console.log(data)
  15241. ``` */
  15242. readCompressedFile(option: ReadCompressedFileOption): void
  15243. /** [FileSystemManager.readFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html)
  15244. *
  15245. * 在插件中使用:需要基础库 `2.19.2`
  15246. *
  15247. * 读取本地文件内容。单个文件大小上限为100M。
  15248. *
  15249. * **示例代码**
  15250. *
  15251. * ```js
  15252. const fs = wx.getFileSystemManager()
  15253. fs.readFile({
  15254. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15255. encoding: 'utf8',
  15256. position: 0,
  15257. success(res) {
  15258. console.log(res.data)
  15259. },
  15260. fail(res) {
  15261. console.error(res)
  15262. }
  15263. })
  15264. // 同步接口
  15265. try {
  15266. const res = fs.readFileSync(`${wx.env.USER_DATA_PATH}/hello.txt`, 'utf8', 0)
  15267. console.log(res)
  15268. } catch(e) {
  15269. console.error(e)
  15270. }
  15271. ``` */
  15272. readFile(option: ReadFileOption): void
  15273. /** [FileSystemManager.readZipEntry(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readZipEntry.html)
  15274. *
  15275. * 需要基础库: `2.17.3`
  15276. *
  15277. * 在插件中使用:需要基础库 `2.19.2`
  15278. *
  15279. * 读取压缩包内的文件
  15280. *
  15281. * **示例代码**
  15282. *
  15283. * ```js
  15284. const fs = wx.getFileSystemManager()
  15285. // 读取zip内某个或多个文件
  15286. fs.readZipEntry({
  15287. filePath: 'wxfile://from/to.zip',
  15288. entries: [{
  15289. path: 'some_folder/my_file.txt', // zip内文件路径
  15290. encoding: 'utf-8', // 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
  15291. position: 0, // 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte
  15292. length: 10000, // 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte
  15293. }, {
  15294. path: 'other_folder/orther_file.txt', // zip内文件路径
  15295. }],
  15296. success(res) {
  15297. console.log(res.entries)
  15298. // res.entries === {
  15299. // 'some_folder/my_file.txt': {
  15300. // errMsg: 'readZipEntry:ok',
  15301. // data: 'xxxxxx'
  15302. // },
  15303. // 'other_folder/orther_file.txt': {
  15304. // data: (ArrayBuffer)
  15305. // }
  15306. // }
  15307. },
  15308. fail(res) {
  15309. console.log(res.errMsg)
  15310. },
  15311. })
  15312. // 读取zip内所有文件。允许指定统一的encoding。position、length则不再允许指定,分别默认为0和文件长度
  15313. fs.readZipEntry({
  15314. filePath: 'wxfile://from/to.zip',
  15315. entries: 'all'
  15316. encoding: 'utf-8', // 统一指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
  15317. success(res) {
  15318. console.log(res.entries)
  15319. // res.entries === {
  15320. // 'some_folder/my_file.txt': {
  15321. // errMsg: 'readZipEntry:ok',
  15322. // data: 'xxxxxx'
  15323. // },
  15324. // 'other_folder/orther_file.txt': {
  15325. // errMsg: 'readZipEntry:ok',
  15326. // data: 'xxxxxx'
  15327. // }
  15328. // }
  15329. },
  15330. fail(res) {
  15331. console.log(res.errMsg)
  15332. },
  15333. })
  15334. ``` */
  15335. readZipEntry(option: ReadZipEntryOption): void
  15336. /** [FileSystemManager.readdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readdir.html)
  15337. *
  15338. * 在插件中使用:需要基础库 `2.19.2`
  15339. *
  15340. * 读取目录内文件列表
  15341. *
  15342. * **注意事项</title>
  15343. * - readdir接口无法访问文件系统根路径(wxfile://)。
  15344. * <title>示例代码**
  15345. *
  15346. * ```js
  15347. const fs = wx.getFileSystemManager()
  15348. fs.readdir({
  15349. dirPath: `${wx.env.USER_DATA_PATH}/example`,
  15350. success(res) {
  15351. console.log(res.files)
  15352. },
  15353. fail(res) {
  15354. console.error(res)
  15355. }
  15356. })
  15357. // 同步接口
  15358. try {
  15359. const res = fs.readdirSync(`${wx.env.USER_DATA_PATH}/example`)
  15360. console.log(res)
  15361. } catch(e) {
  15362. console.error(e)
  15363. }
  15364. ``` */
  15365. readdir(option: ReaddirOption): void
  15366. /** [FileSystemManager.removeSavedFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.removeSavedFile.html)
  15367. *
  15368. * 在插件中使用:不支持
  15369. *
  15370. * 删除该小程序下已保存的本地缓存文件 */
  15371. removeSavedFile(option: RemoveSavedFileOption): void
  15372. /** [FileSystemManager.rename(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rename.html)
  15373. *
  15374. * 在插件中使用:需要基础库 `2.19.2`
  15375. *
  15376. * 重命名文件。可以把文件从 oldPath 移动到 newPath
  15377. *
  15378. * **示例代码**
  15379. *
  15380. * ```js
  15381. const fs = wx.getFileSystemManager()
  15382. fs.rename({
  15383. oldPath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15384. newPath: `${wx.env.USER_DATA_PATH}/hello_new.txt`,
  15385. success(res) {
  15386. console.log(res)
  15387. },
  15388. fail(res) {
  15389. console.error(res)
  15390. }
  15391. })
  15392. // 同步接口
  15393. try {
  15394. const res = fs.renameSync(
  15395. `${wx.env.USER_DATA_PATH}/hello.txt`,
  15396. `${wx.env.USER_DATA_PATH}/hello_new.txt`
  15397. )
  15398. console.log(res)
  15399. } catch(e) {
  15400. console.error(e)
  15401. }
  15402. ``` */
  15403. rename(option: RenameOption): void
  15404. /** [FileSystemManager.renameSync(string oldPath, string newPath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.renameSync.html)
  15405. *
  15406. * 在插件中使用:需要基础库 `2.19.2`
  15407. *
  15408. * [FileSystemManager.rename](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rename.html) 的同步版本
  15409. *
  15410. * **示例代码**
  15411. *
  15412. * ```js
  15413. const fs = wx.getFileSystemManager()
  15414. fs.rename({
  15415. oldPath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15416. newPath: `${wx.env.USER_DATA_PATH}/hello_new.txt`,
  15417. success(res) {
  15418. console.log(res)
  15419. },
  15420. fail(res) {
  15421. console.error(res)
  15422. }
  15423. })
  15424. // 同步接口
  15425. try {
  15426. const res = fs.renameSync(
  15427. `${wx.env.USER_DATA_PATH}/hello.txt`,
  15428. `${wx.env.USER_DATA_PATH}/hello_new.txt`
  15429. )
  15430. console.log(res)
  15431. } catch(e) {
  15432. console.error(e)
  15433. }
  15434. ``` */
  15435. renameSync(
  15436. /** 源文件路径,支持本地路径 */
  15437. oldPath: string,
  15438. /** 新文件路径,支持本地路径 */
  15439. newPath: string
  15440. ): void
  15441. /** [FileSystemManager.rmdir(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdir.html)
  15442. *
  15443. * 在插件中使用:需要基础库 `2.19.2`
  15444. *
  15445. * 删除目录
  15446. *
  15447. * **示例代码**
  15448. *
  15449. * ```js
  15450. const fs = wx.getFileSystemManager()
  15451. fs.rmdir({
  15452. dirPath: `${wx.env.USER_DATA_PATH}/example`,
  15453. recursive: false,
  15454. success(res) {
  15455. console.log(res)
  15456. },
  15457. fail(res) {
  15458. console.error(res)
  15459. }
  15460. })
  15461. // 同步接口
  15462. try {
  15463. const res = fs.rmdirSync(`${wx.env.USER_DATA_PATH}/example`, false)
  15464. console.log(res)
  15465. } catch(e) {
  15466. console.error(e)
  15467. }
  15468. ``` */
  15469. rmdir(option: RmdirOption): void
  15470. /** [FileSystemManager.rmdirSync(string dirPath, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdirSync.html)
  15471. *
  15472. * 在插件中使用:需要基础库 `2.19.2`
  15473. *
  15474. * [FileSystemManager.rmdir](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.rmdir.html) 的同步版本
  15475. *
  15476. * **示例代码**
  15477. *
  15478. * ```js
  15479. const fs = wx.getFileSystemManager()
  15480. fs.rmdir({
  15481. dirPath: `${wx.env.USER_DATA_PATH}/example`,
  15482. recursive: false,
  15483. success(res) {
  15484. console.log(res)
  15485. },
  15486. fail(res) {
  15487. console.error(res)
  15488. }
  15489. })
  15490. // 同步接口
  15491. try {
  15492. const res = fs.rmdirSync(`${wx.env.USER_DATA_PATH}/example`, false)
  15493. console.log(res)
  15494. } catch(e) {
  15495. console.error(e)
  15496. }
  15497. ``` */
  15498. rmdirSync(
  15499. /** 要删除的目录路径 (本地路径) */
  15500. dirPath: string,
  15501. /** 需要基础库: `2.3.0`
  15502. *
  15503. * 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。 */
  15504. recursive?: boolean
  15505. ): void
  15506. /** [FileSystemManager.saveFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFile.html)
  15507. *
  15508. * 在插件中使用:不支持
  15509. *
  15510. * 保存临时文件到本地。此接口会移动临时文件,因此调用成功后,tempFilePath 将不可用。 */
  15511. saveFile(option: SaveFileOption): void
  15512. /** [FileSystemManager.stat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.stat.html)
  15513. *
  15514. * 在插件中使用:需要基础库 `2.19.2`
  15515. *
  15516. * 获取文件 Stats 对象 */
  15517. stat(option: StatOption): void
  15518. /** [FileSystemManager.truncate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.truncate.html)
  15519. *
  15520. * 需要基础库: `2.16.1`
  15521. *
  15522. * 在插件中使用:需要基础库 `2.19.2`
  15523. *
  15524. * 对文件内容进行截断操作
  15525. *
  15526. * **示例代码**
  15527. *
  15528. * ```js
  15529. const fs = wx.getFileSystemManager()
  15530. fs.truncate({
  15531. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15532. length: 10, // 从第10个字节开始截断
  15533. success(res) {
  15534. console.log(res)
  15535. }
  15536. })
  15537. ``` */
  15538. truncate(option: TruncateOption): void
  15539. /** [FileSystemManager.unlink(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlink.html)
  15540. *
  15541. * 在插件中使用:需要基础库 `2.19.2`
  15542. *
  15543. * 删除文件
  15544. *
  15545. * **示例代码**
  15546. *
  15547. * ```js
  15548. const fs = wx.getFileSystemManager()
  15549. fs.unlink({
  15550. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15551. success(res) {
  15552. console.log(res)
  15553. },
  15554. fail(res) {
  15555. console.error(res)
  15556. }
  15557. })
  15558. // 同步接口
  15559. try {
  15560. const res = fs.unlinkSync(`${wx.env.USER_DATA_PATH}/hello.txt`)
  15561. console.log(res)
  15562. } catch(e) {
  15563. console.error(e)
  15564. }
  15565. ``` */
  15566. unlink(option: UnlinkOption): void
  15567. /** [FileSystemManager.unlinkSync(string filePath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlinkSync.html)
  15568. *
  15569. * 在插件中使用:需要基础库 `2.19.2`
  15570. *
  15571. * [FileSystemManager.unlink](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unlink.html) 的同步版本
  15572. *
  15573. * **示例代码**
  15574. *
  15575. * ```js
  15576. const fs = wx.getFileSystemManager()
  15577. fs.unlink({
  15578. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15579. success(res) {
  15580. console.log(res)
  15581. },
  15582. fail(res) {
  15583. console.error(res)
  15584. }
  15585. })
  15586. // 同步接口
  15587. try {
  15588. const res = fs.unlinkSync(`${wx.env.USER_DATA_PATH}/hello.txt`)
  15589. console.log(res)
  15590. } catch(e) {
  15591. console.error(e)
  15592. }
  15593. ``` */
  15594. unlinkSync(
  15595. /** 要删除的文件路径 (本地路径) */
  15596. filePath: string
  15597. ): void
  15598. /** [FileSystemManager.unzip(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.unzip.html)
  15599. *
  15600. * 在插件中使用:需要基础库 `2.19.2`
  15601. *
  15602. * 解压文件
  15603. *
  15604. * **示例代码**
  15605. *
  15606. * ```js
  15607. const fs = wx.getFileSystemManager()
  15608. fs.unzip({
  15609. zipFilePath: `${wx.env.USER_DATA_PATH}/example.zip`,
  15610. targetPath: '${wx.env.USER_DATA_PATH}/example',
  15611. success(res) {
  15612. console.log(res)
  15613. },
  15614. fail(res) {
  15615. console.error(res)
  15616. }
  15617. })
  15618. ``` */
  15619. unzip(option: UnzipOption): void
  15620. /** [FileSystemManager.write(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.write.html)
  15621. *
  15622. * 需要基础库: `2.16.1`
  15623. *
  15624. * 在插件中使用:需要基础库 `2.19.2`
  15625. *
  15626. * 写入文件
  15627. *
  15628. * **示例代码**
  15629. *
  15630. * ```js
  15631. const fs = wx.getFileSystemManager()
  15632. // 打开文件
  15633. fs.open({
  15634. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15635. flag: 'a+',
  15636. success(res) {
  15637. // 写入文件
  15638. fs.write({
  15639. fd: res.fd,
  15640. data: 'some text',
  15641. success(res) {
  15642. console.log(res.bytesWritten)
  15643. }
  15644. })
  15645. }
  15646. })
  15647. ``` */
  15648. write(option: WriteOption): void
  15649. /** [FileSystemManager.writeFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFile.html)
  15650. *
  15651. * 在插件中使用:需要基础库 `2.19.2`
  15652. *
  15653. * 写文件
  15654. *
  15655. * **示例代码**
  15656. *
  15657. * ```js
  15658. const fs = wx.getFileSystemManager()
  15659. fs.writeFile({
  15660. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15661. data: 'some text or arrayBuffer',
  15662. encoding: 'utf8',
  15663. success(res) {
  15664. console.log(res)
  15665. },
  15666. fail(res) {
  15667. console.error(res)
  15668. }
  15669. })
  15670. // 同步接口
  15671. try {
  15672. const res = fs.writeFileSync(
  15673. `${wx.env.USER_DATA_PATH}/hello.txt`,
  15674. 'some text or arrayBuffer',
  15675. 'utf8'
  15676. )
  15677. console.log(res)
  15678. } catch(e) {
  15679. console.error(e)
  15680. }
  15681. ``` */
  15682. writeFile(option: WriteFileOption): void
  15683. /** [FileSystemManager.writeFileSync(string filePath, string|ArrayBuffer data, string encoding)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFileSync.html)
  15684. *
  15685. * 在插件中使用:需要基础库 `2.19.2`
  15686. *
  15687. * [FileSystemManager.writeFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFile.html) 的同步版本
  15688. *
  15689. * **示例代码**
  15690. *
  15691. * ```js
  15692. const fs = wx.getFileSystemManager()
  15693. fs.writeFile({
  15694. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15695. data: 'some text or arrayBuffer',
  15696. encoding: 'utf8',
  15697. success(res) {
  15698. console.log(res)
  15699. },
  15700. fail(res) {
  15701. console.error(res)
  15702. }
  15703. })
  15704. // 同步接口
  15705. try {
  15706. const res = fs.writeFileSync(
  15707. `${wx.env.USER_DATA_PATH}/hello.txt`,
  15708. 'some text or arrayBuffer',
  15709. 'utf8'
  15710. )
  15711. console.log(res)
  15712. } catch(e) {
  15713. console.error(e)
  15714. }
  15715. ``` */
  15716. writeFileSync(
  15717. /** 要写入的文件路径 (本地路径) */
  15718. filePath: string,
  15719. /** 要写入的文本或二进制数据 */
  15720. data: string | ArrayBuffer,
  15721. /** 指定写入文件的字符编码
  15722. *
  15723. * 参数 encoding 可选值:
  15724. * - 'ascii': ;
  15725. * - 'base64': (注意,选择 base64 编码,data 只需要传 base64 内容本身,不要传 Data URI 前缀,否则会报 fail base64 encode error 错误。例如,传 aGVsbG8= 而不是传 data:image/png;base64,aGVsbG8= );
  15726. * - 'binary': ;
  15727. * - 'hex': ;
  15728. * - 'ucs2': 以小端序读取;
  15729. * - 'ucs-2': 以小端序读取;
  15730. * - 'utf16le': 以小端序读取;
  15731. * - 'utf-16le': 以小端序读取;
  15732. * - 'utf-8': ;
  15733. * - 'utf8': ;
  15734. * - 'latin1': ; */
  15735. encoding?:
  15736. | 'ascii'
  15737. | 'base64'
  15738. | 'binary'
  15739. | 'hex'
  15740. | 'ucs2'
  15741. | 'ucs-2'
  15742. | 'utf16le'
  15743. | 'utf-16le'
  15744. | 'utf-8'
  15745. | 'utf8'
  15746. | 'latin1'
  15747. ): void
  15748. /** [[ReadResult](https://developers.weixin.qq.com/miniprogram/dev/api/file/ReadResult.html) FileSystemManager.readSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readSync.html)
  15749. *
  15750. * 需要基础库: `2.16.1`
  15751. *
  15752. * 在插件中使用:需要基础库 `2.19.2`
  15753. *
  15754. * 读文件
  15755. *
  15756. * **示例代码**
  15757. *
  15758. * ```js
  15759. const fs = wx.getFileSystemManager()
  15760. const ab = new ArrayBuffer(1024)
  15761. const fd = fs.openSync({
  15762. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15763. flag: 'a+'
  15764. })
  15765. const res = fs.readSync({
  15766. fd: fd,
  15767. arrayBuffer: ab,
  15768. length: 10
  15769. })
  15770. console.log(res)
  15771. ``` */
  15772. readSync(option: ReadSyncOption): ReadResult
  15773. /** [[Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html) FileSystemManager.fstatSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.fstatSync.html)
  15774. *
  15775. * 需要基础库: `2.16.1`
  15776. *
  15777. * 在插件中使用:需要基础库 `2.19.2`
  15778. *
  15779. * 同步获取文件的状态信息
  15780. *
  15781. * **示例代码**
  15782. *
  15783. * ```js
  15784. const fs = wx.getFileSystemManager()
  15785. const fd = fs.openSync({
  15786. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15787. flag: 'a+'
  15788. })
  15789. const stats = fs.fstatSync({fd: fd})
  15790. console.log(stats)
  15791. ``` */
  15792. fstatSync(option: FstatSyncOption): Stats
  15793. /** [[Stats](https://developers.weixin.qq.com/miniprogram/dev/api/file/Stats.html)|Array.&lt;[FileStats](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileStats.html)&gt; FileSystemManager.statSync(string path, boolean recursive)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.statSync.html)
  15794. *
  15795. * 在插件中使用:需要基础库 `2.19.2`
  15796. *
  15797. * [FileSystemManager.stat](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.stat.html) 的同步版本 */
  15798. statSync(
  15799. /** 文件/目录路径 (本地路径) */
  15800. path: string,
  15801. /** 需要基础库: `2.3.0`
  15802. *
  15803. * 是否递归获取目录下的每个文件的 Stats 信息 */
  15804. recursive?: boolean
  15805. ): Stats | FileStats[]
  15806. /** [[WriteResult](https://developers.weixin.qq.com/miniprogram/dev/api/file/WriteResult.html) FileSystemManager.writeSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeSync.html)
  15807. *
  15808. * 需要基础库: `2.16.1`
  15809. *
  15810. * 在插件中使用:需要基础库 `2.19.2`
  15811. *
  15812. * 同步写入文件
  15813. *
  15814. * **示例代码**
  15815. *
  15816. * ```js
  15817. const fs = wx.getFileSystemManager()
  15818. const fd = fs.openSync({
  15819. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15820. flag: 'a+'
  15821. })
  15822. const res = fs.writeSync({
  15823. fd: fd,
  15824. data: 'some text'
  15825. })
  15826. console.log(res.bytesWritten)
  15827. ``` */
  15828. writeSync(option: WriteSyncOption): WriteResult
  15829. /** [string FileSystemManager.openSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.openSync.html)
  15830. *
  15831. * 需要基础库: `2.16.1`
  15832. *
  15833. * 在插件中使用:需要基础库 `2.19.2`
  15834. *
  15835. * 同步打开文件,返回文件描述符
  15836. *
  15837. * **示例代码**
  15838. *
  15839. * ```js
  15840. const fs = wx.getFileSystemManager()
  15841. const fd = fs.openSync({
  15842. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15843. flag: 'a+'
  15844. })
  15845. console.log(fd)
  15846. ``` */
  15847. openSync(option: OpenSyncOption): string
  15848. /** [string FileSystemManager.saveFileSync(string tempFilePath, string filePath)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFileSync.html)
  15849. *
  15850. * 在插件中使用:不支持
  15851. *
  15852. * [FileSystemManager.saveFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.saveFile.html) 的同步版本 */
  15853. saveFileSync(
  15854. /** 临时存储文件路径 (本地路径) */
  15855. tempFilePath: string,
  15856. /** 要存储的文件路径 (本地路径) */
  15857. filePath?: string
  15858. ): string
  15859. /** [string|ArrayBuffer FileSystemManager.readFileSync(string filePath, string encoding, number position, number length)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFileSync.html)
  15860. *
  15861. * 在插件中使用:需要基础库 `2.19.2`
  15862. *
  15863. * [FileSystemManager.readFile](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.readFile.html) 的同步版本
  15864. *
  15865. * **示例代码**
  15866. *
  15867. * ```js
  15868. const fs = wx.getFileSystemManager()
  15869. fs.readFile({
  15870. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15871. encoding: 'utf8',
  15872. position: 0,
  15873. success(res) {
  15874. console.log(res.data)
  15875. },
  15876. fail(res) {
  15877. console.error(res)
  15878. }
  15879. })
  15880. // 同步接口
  15881. try {
  15882. const res = fs.readFileSync(`${wx.env.USER_DATA_PATH}/hello.txt`, 'utf8', 0)
  15883. console.log(res)
  15884. } catch(e) {
  15885. console.error(e)
  15886. }
  15887. ``` */
  15888. readFileSync(
  15889. /** 要读取的文件的路径 (本地路径) */
  15890. filePath: string,
  15891. /** 指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
  15892. *
  15893. * 参数 encoding 可选值:
  15894. * - 'ascii': ;
  15895. * - 'base64': ;
  15896. * - 'binary': ;
  15897. * - 'hex': ;
  15898. * - 'ucs2': 以小端序读取;
  15899. * - 'ucs-2': 以小端序读取;
  15900. * - 'utf16le': 以小端序读取;
  15901. * - 'utf-16le': 以小端序读取;
  15902. * - 'utf-8': ;
  15903. * - 'utf8': ;
  15904. * - 'latin1': ; */
  15905. encoding?:
  15906. | 'ascii'
  15907. | 'base64'
  15908. | 'binary'
  15909. | 'hex'
  15910. | 'ucs2'
  15911. | 'ucs-2'
  15912. | 'utf16le'
  15913. | 'utf-16le'
  15914. | 'utf-8'
  15915. | 'utf8'
  15916. | 'latin1',
  15917. /** 需要基础库: `2.10.0`
  15918. *
  15919. * 从文件指定位置开始读,如果不指定,则从文件头开始读。读取的范围应该是左闭右开区间 [position, position+length)。有效范围:[0, fileLength - 1]。单位:byte */
  15920. position?: number,
  15921. /** 需要基础库: `2.10.0`
  15922. *
  15923. * 指定文件的长度,如果不指定,则读到文件末尾。有效范围:[1, fileLength]。单位:byte */
  15924. length?: number
  15925. ): string | ArrayBuffer
  15926. /** [undefined FileSystemManager.closeSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.closeSync.html)
  15927. *
  15928. * 需要基础库: `2.16.1`
  15929. *
  15930. * 在插件中使用:需要基础库 `2.19.2`
  15931. *
  15932. * 同步关闭文件
  15933. *
  15934. * **示例代码**
  15935. *
  15936. * ```js
  15937. const fs = wx.getFileSystemManager()
  15938. const fd = fs.openSync({
  15939. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15940. flag: 'a+'
  15941. })
  15942. // 关闭文件
  15943. fs.closeSync({fd: fd})
  15944. ``` */
  15945. closeSync(option: CloseSyncOption): undefined
  15946. /** [undefined FileSystemManager.ftruncateSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.ftruncateSync.html)
  15947. *
  15948. * 需要基础库: `2.16.1`
  15949. *
  15950. * 在插件中使用:需要基础库 `2.19.2`
  15951. *
  15952. * 对文件内容进行截断操作
  15953. *
  15954. * **示例代码**
  15955. *
  15956. * ```js
  15957. const fs = wx.getFileSystemManager()
  15958. const fd = fs.openSync({
  15959. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15960. flag: 'a+'
  15961. })
  15962. fs.ftruncateSync({
  15963. fd: fd,
  15964. length: 10 // 从第10个字节开始截断文件
  15965. })
  15966. ``` */
  15967. ftruncateSync(option: FtruncateSyncOption): undefined
  15968. /** [undefined FileSystemManager.truncateSync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.truncateSync.html)
  15969. *
  15970. * 需要基础库: `2.16.1`
  15971. *
  15972. * 在插件中使用:需要基础库 `2.19.2`
  15973. *
  15974. * 对文件内容进行截断操作 (truncate 的同步版本)
  15975. *
  15976. * **示例代码**
  15977. *
  15978. * ```js
  15979. const fs = wx.getFileSystemManager()
  15980. fs.truncateSync({
  15981. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  15982. length: 10, // 从第10个字节开始截断
  15983. })
  15984. ``` */
  15985. truncateSync(option: TruncateSyncOption): undefined
  15986. }
  15987. interface InferenceSession {
  15988. /** [InferenceSession.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.destroy.html)
  15989. *
  15990. * 需要基础库: `2.30.0`
  15991. *
  15992. * 在插件中使用:需要基础库 `2.30.0`
  15993. *
  15994. * 销毁 InferenceSession 实例
  15995. *
  15996. * **示例代码**
  15997. *
  15998. * ```js
  15999. // 销毁会话
  16000. session.destroy()
  16001. ``` */
  16002. destroy(): void
  16003. /** [InferenceSession.offError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.offError.html)
  16004. *
  16005. * 需要基础库: `2.30.0`
  16006. *
  16007. * 在插件中使用:需要基础库 `2.30.0`
  16008. *
  16009. * 取消监听模型加载失败事件 */
  16010. offError(
  16011. /** 模型加载失败回调函数。传入指定回调函数则只取消指定回调,不传则取消所有回调 */
  16012. callback: (...args: any[]) => any
  16013. ): void
  16014. /** [InferenceSession.offLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.offLoad.html)
  16015. *
  16016. * 需要基础库: `2.30.0`
  16017. *
  16018. * 在插件中使用:需要基础库 `2.30.0`
  16019. *
  16020. * 取消监听模型加载完成事件 */
  16021. offLoad(
  16022. /** 模型加载完成回调函数。传入指定回调函数则只取消指定回调,不传则取消所有回调 */
  16023. callback: (...args: any[]) => any
  16024. ): void
  16025. /** [InferenceSession.onError(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.onError.html)
  16026. *
  16027. * 需要基础库: `2.30.0`
  16028. *
  16029. * 在插件中使用:需要基础库 `2.30.0`
  16030. *
  16031. * 监听模型加载失败事件
  16032. *
  16033. * **示例代码**
  16034. *
  16035. * ```js
  16036. // 创建会话,加载模型
  16037. const session = wx.createInferenceSession({
  16038. model: `${wx.env.USER_DATA_PATH}/MNIST.onnx`,
  16039. precisionLevel: 4,
  16040. typicalShape:{input1:[1, 3, 224, 224], input2:[1, 1, 224, 224]}, //除非使用动态轴,一般不用显式指定
  16041. allowNPU: false,
  16042. allowQuantize: false
  16043. })
  16044. // 监听error事件
  16045. session.onError(err => {
  16046. console.error(err)
  16047. })
  16048. ``` */
  16049. onError(
  16050. /** 模型加载失败回调函数 */
  16051. callback: (...args: any[]) => any
  16052. ): void
  16053. /** [InferenceSession.onLoad(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.onLoad.html)
  16054. *
  16055. * 需要基础库: `2.30.0`
  16056. *
  16057. * 在插件中使用:需要基础库 `2.30.0`
  16058. *
  16059. * 监听模型加载完成事件
  16060. *
  16061. * **示例代码**
  16062. *
  16063. * ```js
  16064. // 创建会话,加载模型
  16065. const session = wx.createInferenceSession({
  16066. model: `${wx.env.USER_DATA_PATH}/MNIST.onnx`,
  16067. precisionLevel: 4,
  16068. typicalShape:{input1:[1, 3, 224, 224], input2:[1, 1, 224, 224]}, //除非使用动态轴,一般不用显式指定
  16069. allowNPU: false,
  16070. allowQuantize: false
  16071. })
  16072. // 监听模型加载完成事件
  16073. session.onLoad(() => {
  16074. // 运行推理
  16075. // 其中input1, input2, output0 必须与使用的onnx模型中实际的输入输出名字完全一致,不可随意填写。
  16076. // 模型输入输出信息可以通过Netron 打开onnx模型看到
  16077. session.run({
  16078. input1: {
  16079. type: 'float32',
  16080. data: new Float32Array(3 * 224 * 224).buffer,
  16081. shape: [1, 3, 224, 224] // NCHW 顺序
  16082. },
  16083. // 多个input的添加方法,假设第二个input需要数据类型为uint8
  16084. input2: {
  16085. type: 'uint8',
  16086. data: new Uint8Array(224 * 224).buffer,
  16087. shape: [1, 1, 224, 224]
  16088. },
  16089. }).then(res => {
  16090. console.log(res.output0)
  16091. })
  16092. })
  16093. ``` */
  16094. onLoad(
  16095. /** 模型加载完成回调函数 */
  16096. callback: (...args: any[]) => any
  16097. ): void
  16098. /** [Promise<[Tensors](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/Tensors.html)> InferenceSession.run([Tensors](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/Tensors.html) tensors)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.run.html)
  16099. *
  16100. * 需要基础库: `2.30.0`
  16101. *
  16102. * 在插件中使用:需要基础库 `2.30.0`
  16103. *
  16104. * 运行推断。需要在 session.onLoad 回调后使用。接口参数为 Tensors 对象,返回 Promise。一个 InferenceSession 被创建完成后可以重复多次调用 InferenceSession.run(), 直到调用 session.destroy() 进行销毁。
  16105. *
  16106. * **示例代码**
  16107. *
  16108. * ```js
  16109. // 创建会话,加载模型
  16110. const session = wx.createInferenceSession({
  16111. model: `${wx.env.USER_DATA_PATH}/MNIST.onnx`,
  16112. precisionLevel: 4,
  16113. typicalShape:{input1:[1, 3, 224, 224], input2:[1, 1, 224, 224]}, //除非使用动态轴,一般不用显式指定
  16114. allowNPU: false,
  16115. allowQuantize: false
  16116. })
  16117. // 监听模型加载完成事件
  16118. session.onLoad(() => {
  16119. // 运行推理
  16120. // 其中input1, input2, output0 必须与使用的onnx模型中实际的输入输出名字完全一致,不可随意填写。
  16121. // 模型输入输出信息可以通过Netron 打开onnx模型看到
  16122. session.run({
  16123. input1: {
  16124. type: 'float32',
  16125. data: new Float32Array(3 * 224 * 224).buffer,
  16126. shape: [1, 3, 224, 224] // NCHW 顺序
  16127. },
  16128. // 多个input的添加方法,假设第二个input需要数据类型为uint8
  16129. input2: {
  16130. type: 'uint8',
  16131. data: new Uint8Array(224 * 224).buffer,
  16132. shape: [1, 1, 224, 224]
  16133. },
  16134. }).then(res => {
  16135. console.log(res.output0)
  16136. })
  16137. })
  16138. ``` */
  16139. run(
  16140. /** [Tensors](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/Tensors.html)
  16141. *
  16142. * key-value 形式的对象,对象的 key 会作为 input name,对象的 value 则是 Tensor。 Tensor 结构如下。 */
  16143. tensors: Tensors
  16144. ): Promise<Tensors>
  16145. }
  16146. interface IntersectionObserver {
  16147. /** [IntersectionObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.disconnect.html)
  16148. *
  16149. * 在插件中使用:支持
  16150. *
  16151. * 停止监听。回调函数将不再触发 */
  16152. disconnect(): void
  16153. /** [IntersectionObserver.observe(string targetSelector, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.observe.html)
  16154. *
  16155. * 在插件中使用:支持
  16156. *
  16157. * 指定目标节点并开始监听相交状态变化情况 */
  16158. observe(
  16159. /** 选择器 */
  16160. targetSelector: string,
  16161. /** 监听相交状态变化的回调函数 */
  16162. callback: IntersectionObserverObserveCallback
  16163. ): void
  16164. /** [[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)
  16165. *
  16166. * 在插件中使用:支持
  16167. *
  16168. * 使用选择器指定一个节点,作为参照区域之一。 */
  16169. relativeTo(
  16170. /** 选择器 */
  16171. selector: string,
  16172. /** 用来扩展(或收缩)参照节点布局区域的边界 */
  16173. margins?: Margins
  16174. ): IntersectionObserver
  16175. /** [[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)
  16176. *
  16177. * 在插件中使用:支持
  16178. *
  16179. * 指定页面显示区域作为参照区域之一
  16180. *
  16181. * **示例代码**
  16182. *
  16183. * 下面的示例代码中,如果目标节点(用选择器 .target-class 指定)进入显示区域以下 100px 时,就会触发回调函数。
  16184. * ```javascript
  16185. Page({
  16186. onLoad: function(){
  16187. wx.createIntersectionObserver().relativeToViewport({bottom: 100}).observe('.target-class', (res) => {
  16188. res.intersectionRatio // 相交区域占目标节点的布局区域的比例
  16189. res.intersectionRect // 相交区域
  16190. res.intersectionRect.left // 相交区域的左边界坐标
  16191. res.intersectionRect.top // 相交区域的上边界坐标
  16192. res.intersectionRect.width // 相交区域的宽度
  16193. res.intersectionRect.height // 相交区域的高度
  16194. })
  16195. }
  16196. })
  16197. ``` */
  16198. relativeToViewport(
  16199. /** 用来扩展(或收缩)参照节点布局区域的边界 */
  16200. margins?: Margins
  16201. ): IntersectionObserver
  16202. }
  16203. interface InterstitialAd {
  16204. /** [InterstitialAd.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.destroy.html)
  16205. *
  16206. * 需要基础库: `2.8.0`
  16207. *
  16208. * 在插件中使用:不支持
  16209. *
  16210. * 销毁插屏广告实例。 */
  16211. destroy(): void
  16212. /** [InterstitialAd.offClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offClose.html)
  16213. *
  16214. * 在插件中使用:不支持
  16215. *
  16216. * 移除插屏广告关闭事件的监听函数
  16217. *
  16218. * **示例代码**
  16219. *
  16220. * ```js
  16221. const listener = function (res) { console.log(res) }
  16222. InterstitialAd.onClose(listener)
  16223. InterstitialAd.offClose(listener) // 需传入与监听时同一个的函数对象
  16224. ``` */
  16225. offClose(
  16226. /** onClose 传入的监听函数。不传此参数则移除所有监听函数。 */
  16227. listener?: UDPSocketOffCloseCallback
  16228. ): void
  16229. /** [InterstitialAd.offError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offError.html)
  16230. *
  16231. * 在插件中使用:不支持
  16232. *
  16233. * 移除插屏错误事件的监听函数
  16234. *
  16235. * **示例代码**
  16236. *
  16237. * ```js
  16238. const listener = function (res) { console.log(res) }
  16239. InterstitialAd.onError(listener)
  16240. InterstitialAd.offError(listener) // 需传入与监听时同一个的函数对象
  16241. ``` */
  16242. offError(
  16243. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  16244. listener?: InterstitialAdOffErrorCallback
  16245. ): void
  16246. /** [InterstitialAd.offLoad(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offLoad.html)
  16247. *
  16248. * 在插件中使用:不支持
  16249. *
  16250. * 移除插屏广告加载事件的监听函数
  16251. *
  16252. * **示例代码**
  16253. *
  16254. * ```js
  16255. const listener = function (res) { console.log(res) }
  16256. InterstitialAd.onLoad(listener)
  16257. InterstitialAd.offLoad(listener) // 需传入与监听时同一个的函数对象
  16258. ``` */
  16259. offLoad(
  16260. /** onLoad 传入的监听函数。不传此参数则移除所有监听函数。 */
  16261. listener?: OffLoadCallback
  16262. ): void
  16263. /** [InterstitialAd.onClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onClose.html)
  16264. *
  16265. * 在插件中使用:不支持
  16266. *
  16267. * 监听插屏广告关闭事件。 */
  16268. onClose(
  16269. /** 插屏广告关闭事件的监听函数 */
  16270. listener: UDPSocketOnCloseCallback
  16271. ): void
  16272. /** [InterstitialAd.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onError.html)
  16273. *
  16274. * 在插件中使用:不支持
  16275. *
  16276. * 监听插屏错误事件。
  16277. *
  16278. * **错误码信息与解决方案表**
  16279. *
  16280. * 错误码是通过onError获取到的错误信息。调试期间,可以通过异常返回来捕获信息。
  16281. * 在小程序发布上线之后,如果遇到异常问题,可以在[“运维中心“](https://mp.weixin.qq.com/)里面搜寻错误日志,还可以针对异常返回加上适当的监控信息。
  16282. *
  16283. * | 代码 | 异常情况 | 理由 | 解决方案 |
  16284. * | ------ | -------------- | --------------- | -------------------------- |
  16285. * | 1000 | 后端错误调用失败 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。 |
  16286. * | 1001 | 参数错误 | 使用方法错误 | 可以前往developers.weixin.qq.com确认具体教程(小程序和小游戏分别有各自的教程,可以在顶部选项中,“设计”一栏的右侧进行切换。|
  16287. * | 1002 | 广告单元无效 | 可能是拼写错误、或者误用了其他APP的广告ID | 请重新前往mp.weixin.qq.com确认广告位ID。 |
  16288. * | 1003 | 内部错误 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。|
  16289. * | 1004 | 无适合的广告 | 广告不是每一次都会出现,这次没有出现可能是由于该用户不适合浏览广告 | 属于正常情况,且开发者需要针对这种情况做形态上的兼容。 |
  16290. * | 1005 | 广告组件审核中 | 你的广告正在被审核,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。|
  16291. * | 1006 | 广告组件被驳回 | 你的广告审核失败,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。|
  16292. * | 1007 | 广告组件被封禁 | 你的广告能力已经被封禁,封禁期间无法展现广告 | 请前往mp.weixin.qq.com确认小程序广告封禁状态。 |
  16293. * | 1008 | 广告单元已关闭 | 该广告位的广告能力已经被关闭 | 请前往mp.weixin.qq.com重新打开对应广告位的展现。| */
  16294. onError(
  16295. /** 插屏错误事件的监听函数 */
  16296. listener: InterstitialAdOnErrorCallback
  16297. ): void
  16298. /** [InterstitialAd.onLoad(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onLoad.html)
  16299. *
  16300. * 在插件中使用:不支持
  16301. *
  16302. * 监听插屏广告加载事件。 */
  16303. onLoad(
  16304. /** 插屏广告加载事件的监听函数 */
  16305. listener: OnLoadCallback
  16306. ): void
  16307. /** [Promise InterstitialAd.load()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.load.html)
  16308. *
  16309. * 需要基础库: `2.8.0`
  16310. *
  16311. * 在插件中使用:不支持
  16312. *
  16313. * 加载插屏广告。 */
  16314. load(): Promise<any>
  16315. /** [Promise InterstitialAd.show()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.show.html)
  16316. *
  16317. * 在插件中使用:不支持
  16318. *
  16319. * 显示插屏广告。
  16320. *
  16321. * **错误码信息表**
  16322. *
  16323. * 如果插屏广告显示失败,InterstitialAd.show() 方法会返回一个rejected Promise,开发者可以获取到错误码及对应的错误信息。
  16324. *
  16325. * | 代码 | 异常情况 | 理由 |
  16326. * | ------ | -------------- | -------------------------- |
  16327. * | 2001 | 触发频率限制 | 小程序启动一定时间内不允许展示插屏广告 |
  16328. * | 2002 | 触发频率限制 | 距离小程序插屏广告或者激励视频广告上次播放时间间隔不足,不允许展示插屏广告 |
  16329. * | 2003 | 触发频率限制 | 当前正在播放激励视频广告或者插屏广告,不允许再次展示插屏广告 |
  16330. * | 2004 | 广告渲染失败 | 该项错误不是开发者的异常情况,或因小程序页面切换导致广告渲染失败 |
  16331. * | 2005 | 广告调用异常 | 插屏广告实例不允许跨页面调用 | */
  16332. show(): Promise<any>
  16333. }
  16334. interface IsoDep {
  16335. /** [IsoDep.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.close.html)
  16336. *
  16337. * 需要基础库: `2.11.2`
  16338. *
  16339. * 在插件中使用:支持
  16340. *
  16341. * 断开连接 */
  16342. close(option?: NdefCloseOption): void
  16343. /** [IsoDep.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.connect.html)
  16344. *
  16345. * 需要基础库: `2.11.2`
  16346. *
  16347. * 在插件中使用:支持
  16348. *
  16349. * 连接 NFC 标签 */
  16350. connect(option?: NdefConnectOption): void
  16351. /** [IsoDep.getHistoricalBytes(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.getHistoricalBytes.html)
  16352. *
  16353. * 需要基础库: `2.11.2`
  16354. *
  16355. * 在插件中使用:支持
  16356. *
  16357. * 获取复位信息 */
  16358. getHistoricalBytes(option?: GetHistoricalBytesOption): void
  16359. /** [IsoDep.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.getMaxTransceiveLength.html)
  16360. *
  16361. * 需要基础库: `2.11.2`
  16362. *
  16363. * 在插件中使用:支持
  16364. *
  16365. * 获取最大传输长度 */
  16366. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  16367. /** [IsoDep.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.isConnected.html)
  16368. *
  16369. * 需要基础库: `2.11.2`
  16370. *
  16371. * 在插件中使用:支持
  16372. *
  16373. * @warning **该接口已废弃,连接状态开发者自行维护即可**
  16374. *
  16375. * 检查是否已连接 */
  16376. isConnected(option?: IsConnectedOption): void
  16377. /** [IsoDep.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.setTimeout.html)
  16378. *
  16379. * 需要基础库: `2.11.2`
  16380. *
  16381. * 在插件中使用:支持
  16382. *
  16383. * 设置超时时间 */
  16384. setTimeout(option: SetTimeoutOption): void
  16385. /** [IsoDep.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/IsoDep.transceive.html)
  16386. *
  16387. * 需要基础库: `2.11.2`
  16388. *
  16389. * 在插件中使用:支持
  16390. *
  16391. * 发送数据 */
  16392. transceive(option: TransceiveOption): void
  16393. }
  16394. interface Join1v1ChatError {
  16395. /** 错误信息
  16396. *
  16397. * | 错误码 | 错误信息 | 说明 |
  16398. * | - | - | - |
  16399. * | -20000 | not open 1v1 Chat | 未开通双人通话 |
  16400. * | -20001 | device not support | 当前设备不支持 |
  16401. * | -20002 | on call | 正在通话中 |
  16402. * | -20003 | occupied by other miniprogram | 其它小程序正在通话中 |
  16403. * | -30000 | system error | 内部系统错误 |
  16404. * | -30001 | wechat has no camera authorization | 微信缺失相机权限 |
  16405. * | -30002 | wechat has no record authorization | 微信缺失录音权限 |
  16406. * | -30003 | miniprogram has no record authorization | 小程序缺失录音权限 |
  16407. * | -30004 | miniprogram has no camera authorization | 小程序缺失相机权限 |
  16408. * | -1 | | 当前已在房间内 |
  16409. * | -2 | | 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 |
  16410. * | -3 | | 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 |
  16411. * | -1000 | | 系统错误 | */ errMsg: string
  16412. /** 错误码
  16413. *
  16414. * | 错误码 | 错误信息 | 说明 |
  16415. * | - | - | - |
  16416. * | -20000 | not open 1v1 Chat | 未开通双人通话 |
  16417. * | -20001 | device not support | 当前设备不支持 |
  16418. * | -20002 | on call | 正在通话中 |
  16419. * | -20003 | occupied by other miniprogram | 其它小程序正在通话中 |
  16420. * | -30000 | system error | 内部系统错误 |
  16421. * | -30001 | wechat has no camera authorization | 微信缺失相机权限 |
  16422. * | -30002 | wechat has no record authorization | 微信缺失录音权限 |
  16423. * | -30003 | miniprogram has no record authorization | 小程序缺失录音权限 |
  16424. * | -30004 | miniprogram has no camera authorization | 小程序缺失相机权限 |
  16425. * | -1 | | 当前已在房间内 |
  16426. * | -2 | | 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 |
  16427. * | -3 | | 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 |
  16428. * | -1000 | | 系统错误 | */ errCode: number
  16429. }
  16430. interface JoinVoIPChatError {
  16431. /** 错误信息
  16432. *
  16433. * | 错误码 | 错误信息 | 说明 |
  16434. * | - | - | - |
  16435. * | -1 | 当前已在房间内 | |
  16436. * | -2 | 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 | |
  16437. * | -3 | 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 | |
  16438. * | -1000 | 系统错误 | | */ errMsg: string
  16439. /** 错误码
  16440. *
  16441. * | 错误码 | 错误信息 | 说明 |
  16442. * | - | - | - |
  16443. * | -1 | 当前已在房间内 | |
  16444. * | -2 | 录音设备被占用,可能是当前正在使用微信内语音通话或系统通话 | |
  16445. * | -3 | 加入会话期间退出(可能是用户主动退出,或者退后台、来电等原因),因此加入失败 | |
  16446. * | -1000 | 系统错误 | | */ errCode: number
  16447. }
  16448. interface LivePlayerContext {
  16449. /** [LivePlayerContext.exitCasting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitCasting.html)
  16450. *
  16451. * 需要基础库: `2.32.0`
  16452. *
  16453. * 在插件中使用:支持
  16454. *
  16455. * 退出投屏。仅支持在 tap 事件回调内调用。 */
  16456. exitCasting(option?: ExitCastingOption): void
  16457. /** [LivePlayerContext.exitFullScreen(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitFullScreen.html)
  16458. *
  16459. * 在插件中使用:支持
  16460. *
  16461. * 退出全屏 */
  16462. exitFullScreen(option?: ExitFullScreenOption): void
  16463. /** [LivePlayerContext.exitPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitPictureInPicture.html)
  16464. *
  16465. * 在插件中使用:支持
  16466. *
  16467. * 退出小窗,该方法可在任意页面调用 */
  16468. exitPictureInPicture(option?: ExitPictureInPictureOption): void
  16469. /** [LivePlayerContext.mute(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.mute.html)
  16470. *
  16471. * 在插件中使用:支持
  16472. *
  16473. * 静音 */
  16474. mute(option?: MuteOption): void
  16475. /** [LivePlayerContext.pause(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.pause.html)
  16476. *
  16477. * 需要基础库: `1.9.90`
  16478. *
  16479. * 在插件中使用:支持
  16480. *
  16481. * 暂停 */
  16482. pause(option?: PauseOption): void
  16483. /** [LivePlayerContext.play(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.play.html)
  16484. *
  16485. * 在插件中使用:支持
  16486. *
  16487. * 播放 */
  16488. play(option?: PlayOption): void
  16489. /** [LivePlayerContext.reconnectCasting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.reconnectCasting.html)
  16490. *
  16491. * 需要基础库: `2.32.0`
  16492. *
  16493. * 在插件中使用:支持
  16494. *
  16495. * 重连投屏设备。仅支持在 tap 事件回调内调用。 */
  16496. reconnectCasting(option?: ReconnectCastingOption): void
  16497. /** [LivePlayerContext.requestFullScreen(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.requestFullScreen.html)
  16498. *
  16499. * 在插件中使用:支持
  16500. *
  16501. * 进入全屏 */
  16502. requestFullScreen(
  16503. option: LivePlayerContextRequestFullScreenOption
  16504. ): void
  16505. /** [LivePlayerContext.requestPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.requestPictureInPicture.html)
  16506. *
  16507. * 需要基础库: `2.15.0`
  16508. *
  16509. * 在插件中使用:支持
  16510. *
  16511. * 进入小窗 */
  16512. requestPictureInPicture(option?: RequestPictureInPictureOption): void
  16513. /** [LivePlayerContext.resume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.resume.html)
  16514. *
  16515. * 需要基础库: `1.9.90`
  16516. *
  16517. * 在插件中使用:支持
  16518. *
  16519. * 恢复 */
  16520. resume(option?: ResumeOption): void
  16521. /** [LivePlayerContext.snapshot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.snapshot.html)
  16522. *
  16523. * 需要基础库: `2.7.1`
  16524. *
  16525. * 在插件中使用:支持
  16526. *
  16527. * 截图 */
  16528. snapshot(option: LivePlayerContextSnapshotOption): void
  16529. /** [LivePlayerContext.startCasting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.startCasting.html)
  16530. *
  16531. * 需要基础库: `2.32.0`
  16532. *
  16533. * 在插件中使用:支持
  16534. *
  16535. * 开始投屏, 拉起半屏搜索设备。仅支持在 tap 事件回调内调用。 */
  16536. startCasting(option?: StartCastingOption): void
  16537. /** [LivePlayerContext.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.stop.html)
  16538. *
  16539. * 在插件中使用:支持
  16540. *
  16541. * 停止 */
  16542. stop(option?: StopOption): void
  16543. /** [LivePlayerContext.switchCasting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.switchCasting.html)
  16544. *
  16545. * 需要基础库: `2.32.0`
  16546. *
  16547. * 在插件中使用:支持
  16548. *
  16549. * 切换投屏设备。仅支持在 tap 事件回调内调用。 */
  16550. switchCasting(option?: SwitchCastingOption): void
  16551. }
  16552. interface LivePusherContext {
  16553. /** [LivePusherContext.applyBlusherStickMakeup(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applyBlusherStickMakeup.html)
  16554. *
  16555. * 需要基础库: `2.14.0`
  16556. *
  16557. * 在插件中使用:不支持
  16558. *
  16559. * 添加腮红美妆特效 */
  16560. applyBlusherStickMakeup(option: ApplyBlusherStickMakeupOption): void
  16561. /** [LivePusherContext.applyEyeBrowMakeup(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applyEyeBrowMakeup.html)
  16562. *
  16563. * 需要基础库: `2.14.0`
  16564. *
  16565. * 在插件中使用:不支持
  16566. *
  16567. * 添加眉毛美妆特效 */
  16568. applyEyeBrowMakeup(option: ApplyEyeBrowMakeupOption): void
  16569. /** [LivePusherContext.applyEyeShadowMakeup(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applyEyeShadowMakeup.html)
  16570. *
  16571. * 需要基础库: `2.14.0`
  16572. *
  16573. * 在插件中使用:不支持
  16574. *
  16575. * 添加眼影美妆特效 */
  16576. applyEyeShadowMakeup(option: ApplyEyeShadowMakeupOption): void
  16577. /** [LivePusherContext.applyFaceContourMakeup(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applyFaceContourMakeup.html)
  16578. *
  16579. * 需要基础库: `2.14.0`
  16580. *
  16581. * 在插件中使用:不支持
  16582. *
  16583. * 添加修容美妆特效 */
  16584. applyFaceContourMakeup(option: ApplyFaceContourMakeupOption): void
  16585. /** [LivePusherContext.applyFilter(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applyFilter.html)
  16586. *
  16587. * 需要基础库: `2.14.0`
  16588. *
  16589. * 在插件中使用:不支持
  16590. *
  16591. * 添加滤镜效果 */
  16592. applyFilter(option: ApplyFilterOption): void
  16593. /** [LivePusherContext.applyLipStickMakeup(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applyLipStickMakeup.html)
  16594. *
  16595. * 需要基础库: `2.14.0`
  16596. *
  16597. * 在插件中使用:不支持
  16598. *
  16599. * 添加口红美妆特效 */
  16600. applyLipStickMakeup(option: ApplyLipStickMakeupOption): void
  16601. /** [LivePusherContext.applySticker(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.applySticker.html)
  16602. *
  16603. * 需要基础库: `2.14.0`
  16604. *
  16605. * 在插件中使用:不支持
  16606. *
  16607. * 添加贴纸特效 */
  16608. applySticker(option: ApplyStickerOption): void
  16609. /** [LivePusherContext.clearFilters(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.clearFilters.html)
  16610. *
  16611. * 需要基础库: `2.14.0`
  16612. *
  16613. * 在插件中使用:不支持
  16614. *
  16615. * 清除所有滤镜效果 */
  16616. clearFilters(option?: ClearFiltersOption): void
  16617. /** [LivePusherContext.clearMakeups(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.clearMakeups.html)
  16618. *
  16619. * 需要基础库: `2.14.0`
  16620. *
  16621. * 在插件中使用:不支持
  16622. *
  16623. * 清除所有美妆特效 */
  16624. clearMakeups(option?: ClearMakeupsOption): void
  16625. /** [LivePusherContext.clearStickers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.clearStickers.html)
  16626. *
  16627. * 需要基础库: `2.14.0`
  16628. *
  16629. * 在插件中使用:不支持
  16630. *
  16631. * 清除所有贴纸特效 */
  16632. clearStickers(option?: ClearStickersOption): void
  16633. /** [LivePusherContext.createOffscreenCanvas(object options)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.createOffscreenCanvas.html)
  16634. *
  16635. * 需要基础库: `2.29.0`
  16636. *
  16637. * 在插件中使用:支持
  16638. *
  16639. * 创建一个能够承接 LivePusher 采集纹理的离屏 Canvas,客户端 8.0.31 版本开始支持。 */
  16640. createOffscreenCanvas(
  16641. /** 同[wx.createOffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html) */
  16642. options: IAnyObject
  16643. ): void
  16644. /** [LivePusherContext.exitPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.exitPictureInPicture.html)
  16645. *
  16646. * 需要基础库: `2.25.0`
  16647. *
  16648. * 在插件中使用:支持
  16649. *
  16650. * 退出小窗,该方法可在任意页面调用 */
  16651. exitPictureInPicture(option?: ExitPictureInPictureOption): void
  16652. /** [LivePusherContext.getMaxZoom(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.getMaxZoom.html)
  16653. *
  16654. * 需要基础库: `2.31.0`
  16655. *
  16656. * 在插件中使用:支持
  16657. *
  16658. * 获取最大缩放级别 */
  16659. getMaxZoom(option?: GetMaxZoomOption): void
  16660. /** [LivePusherContext.onCustomRendererEvent(string event, function|function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.onCustomRendererEvent.html)
  16661. *
  16662. * 需要基础库: `2.29.0`
  16663. *
  16664. * 在插件中使用:支持
  16665. *
  16666. * 开启自定义渲染时,开发者通过此方法订阅相关事件,客户端 8.0.31 版本开始支持。 */
  16667. onCustomRendererEvent(
  16668. /** 事件类型,后订阅的监听器会取消之前的监听器
  16669. *
  16670. * 参数 event 可选值:
  16671. * - 'frame': 采集到视频帧后触发;
  16672. * - 'update': 推流尺寸变更时触发; */
  16673. event: 'frame' | 'update',
  16674. /** 自定义渲染事件处理回调函数 */
  16675. callback: CustomRendererFrameEventCallback
  16676. ): void
  16677. /** [LivePusherContext.pause(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.pause.html)
  16678. *
  16679. * 在插件中使用:支持
  16680. *
  16681. * 暂停推流 */
  16682. pause(option?: PauseOption): void
  16683. /** [LivePusherContext.pauseBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.pauseBGM.html)
  16684. *
  16685. * 需要基础库: `2.4.0`
  16686. *
  16687. * 在插件中使用:支持
  16688. *
  16689. * 暂停背景音 */
  16690. pauseBGM(option?: PauseBGMOption): void
  16691. /** [LivePusherContext.playBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.playBGM.html)
  16692. *
  16693. * 需要基础库: `2.4.0`
  16694. *
  16695. * 在插件中使用:支持
  16696. *
  16697. * 播放背景音 */
  16698. playBGM(option: PlayBGMOption): void
  16699. /** [LivePusherContext.resume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.resume.html)
  16700. *
  16701. * 在插件中使用:支持
  16702. *
  16703. * 恢复推流 */
  16704. resume(option?: ResumeOption): void
  16705. /** [LivePusherContext.resumeBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.resumeBGM.html)
  16706. *
  16707. * 需要基础库: `2.4.0`
  16708. *
  16709. * 在插件中使用:支持
  16710. *
  16711. * 恢复背景音 */
  16712. resumeBGM(option?: ResumeBGMOption): void
  16713. /** [LivePusherContext.sendMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.sendMessage.html)
  16714. *
  16715. * 需要基础库: `2.10.0`
  16716. *
  16717. * 在插件中使用:支持
  16718. *
  16719. * 发送SEI消息 */
  16720. sendMessage(option: SendMessageOption): void
  16721. /** [LivePusherContext.setBGMVolume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.setBGMVolume.html)
  16722. *
  16723. * 需要基础库: `2.4.0`
  16724. *
  16725. * 在插件中使用:支持
  16726. *
  16727. * 设置背景音音量 */
  16728. setBGMVolume(option: SetBGMVolumeOption): void
  16729. /** [LivePusherContext.setMICVolume(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.setMICVolume.html)
  16730. *
  16731. * 需要基础库: `2.10.0`
  16732. *
  16733. * 在插件中使用:支持
  16734. *
  16735. * 设置麦克风音量 */
  16736. setMICVolume(option: SetMICVolumeOption): void
  16737. /** [LivePusherContext.setZoom(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.setZoom.html)
  16738. *
  16739. * 需要基础库: `2.31.0`
  16740. *
  16741. * 在插件中使用:支持
  16742. *
  16743. * 设置缩放级别 */
  16744. setZoom(option: LivePusherContextSetZoomOption): void
  16745. /** [LivePusherContext.snapshot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.snapshot.html)
  16746. *
  16747. * 需要基础库: `1.9.90`
  16748. *
  16749. * 在插件中使用:支持
  16750. *
  16751. * 快照 */
  16752. snapshot(option: LivePusherContextSnapshotOption): void
  16753. /** [LivePusherContext.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.start.html)
  16754. *
  16755. * 在插件中使用:支持
  16756. *
  16757. * 开始推流,同时开启摄像头预览 */
  16758. start(option?: LivePusherContextStartOption): void
  16759. /** [LivePusherContext.startPreview(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.startPreview.html)
  16760. *
  16761. * 需要基础库: `2.7.0`
  16762. *
  16763. * 在插件中使用:支持
  16764. *
  16765. * 开启摄像头预览 */
  16766. startPreview(option?: StartPreviewOption): void
  16767. /** [LivePusherContext.stop(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.stop.html)
  16768. *
  16769. * 在插件中使用:支持
  16770. *
  16771. * 停止推流,同时停止摄像头预览 */
  16772. stop(option?: StopOption): void
  16773. /** [LivePusherContext.stopBGM(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.stopBGM.html)
  16774. *
  16775. * 需要基础库: `2.4.0`
  16776. *
  16777. * 在插件中使用:支持
  16778. *
  16779. * 停止背景音 */
  16780. stopBGM(option?: StopBGMOption): void
  16781. /** [LivePusherContext.stopPreview(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.stopPreview.html)
  16782. *
  16783. * 需要基础库: `2.7.0`
  16784. *
  16785. * 在插件中使用:支持
  16786. *
  16787. * 关闭摄像头预览 */
  16788. stopPreview(option?: StopPreviewOption): void
  16789. /** [LivePusherContext.switchCamera(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.switchCamera.html)
  16790. *
  16791. * 在插件中使用:支持
  16792. *
  16793. * 切换前后摄像头 */
  16794. switchCamera(option?: SwitchCameraOption): void
  16795. /** [LivePusherContext.toggleTorch(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.toggleTorch.html)
  16796. *
  16797. * 需要基础库: `2.1.0`
  16798. *
  16799. * 在插件中使用:支持
  16800. *
  16801. * 切换手电筒 */
  16802. toggleTorch(option?: ToggleTorchOption): void
  16803. }
  16804. interface LogManager {
  16805. /** [LogManager.debug()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.debug.html)
  16806. *
  16807. * 在插件中使用:不支持
  16808. *
  16809. * 写 debug 日志 */
  16810. debug(
  16811. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */
  16812. ...args: any[]
  16813. ): void
  16814. /** [LogManager.info()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.info.html)
  16815. *
  16816. * 在插件中使用:不支持
  16817. *
  16818. * 写 info 日志 */
  16819. info(
  16820. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */
  16821. ...args: any[]
  16822. ): void
  16823. /** [LogManager.log()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.log.html)
  16824. *
  16825. * 在插件中使用:不支持
  16826. *
  16827. * 写 log 日志 */
  16828. log(
  16829. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */
  16830. ...args: any[]
  16831. ): void
  16832. /** [LogManager.warn()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.warn.html)
  16833. *
  16834. * 在插件中使用:不支持
  16835. *
  16836. * 写 warn 日志 */
  16837. warn(
  16838. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过100Kb */
  16839. ...args: any[]
  16840. ): void
  16841. }
  16842. interface MapContext {
  16843. /** [MapContext.addArc(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addArc.html)
  16844. *
  16845. * 需要基础库: `2.22.0`
  16846. *
  16847. * 在插件中使用:支持
  16848. *
  16849. * 添加弧线,途经点与夹角必须设置一个。途经点必须在起终点有效坐标范围内,否则不能生成正确的弧线,同时设置夹角角度时,以夹角角度为准。夹角定义为起点到终点,与起点外切线逆时针旋转的角度。工具侧暂未支持。 */
  16850. addArc(option: AddArcOption): void
  16851. /** [MapContext.addCustomLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addCustomLayer.html)
  16852. *
  16853. * 需要基础库: `2.12.0`
  16854. *
  16855. * 在插件中使用:支持
  16856. *
  16857. * 添加个性化图层。图层创建[参考文档](https://lbs.qq.com/dev/console/customLayer/create) */
  16858. addCustomLayer(option: AddCustomLayerOption): void
  16859. /** [MapContext.addGroundOverlay(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addGroundOverlay.html)
  16860. *
  16861. * 需要基础库: `2.14.0`
  16862. *
  16863. * 在插件中使用:支持
  16864. *
  16865. * 创建自定义图片图层,图片会随着地图缩放而缩放。 */
  16866. addGroundOverlay(option: AddGroundOverlayOption): void
  16867. /** [MapContext.addMarkers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addMarkers.html)
  16868. *
  16869. * 需要基础库: `2.13.0`
  16870. *
  16871. * 在插件中使用:支持
  16872. *
  16873. * 添加 marker。 */
  16874. addMarkers(option: AddMarkersOption): void
  16875. /** [MapContext.addVisualLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.addVisualLayer.html)
  16876. *
  16877. * 需要基础库: `2.20.1`
  16878. *
  16879. * 在插件中使用:支持
  16880. *
  16881. * 添加可视化图层。需要刷新时,interval 可设置的最小值为 15 s。 */
  16882. addVisualLayer(option: AddVisualLayerOption): void
  16883. /** [MapContext.eraseLines(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.eraseLines.html)
  16884. *
  16885. * 需要基础库: `2.5.0`
  16886. *
  16887. * 在插件中使用:支持
  16888. *
  16889. * 擦除或置灰已添加到地图中的线段。 */
  16890. eraseLines(option: EraseLinesOption): void
  16891. /** [MapContext.executeVisualLayerCommand(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.executeVisualLayerCommand.html)
  16892. *
  16893. * 需要基础库: `2.26.0`
  16894. *
  16895. * 在插件中使用:支持
  16896. *
  16897. * 执行可视化图层指令,结合 `MapContext.on('visualLayerEvent')` 监听事件使用。 */
  16898. executeVisualLayerCommand(option: ExecuteVisualLayerCommandOption): void
  16899. /** [MapContext.fromScreenLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.fromScreenLocation.html)
  16900. *
  16901. * 需要基础库: `2.14.0`
  16902. *
  16903. * 在插件中使用:支持
  16904. *
  16905. * 获取屏幕上的点对应的经纬度,坐标原点为地图左上角。 */
  16906. fromScreenLocation(option: FromScreenLocationOption): void
  16907. /** [MapContext.getCenterLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getCenterLocation.html)
  16908. *
  16909. * 在插件中使用:支持
  16910. *
  16911. * 获取当前地图中心的经纬度。返回的是 gcj02 坐标系,可以用于 [wx.openLocation()](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.openLocation.html) */
  16912. getCenterLocation(option: GetCenterLocationOption): void
  16913. /** [MapContext.getRegion(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getRegion.html)
  16914. *
  16915. * 需要基础库: `1.4.0`
  16916. *
  16917. * 在插件中使用:支持
  16918. *
  16919. * 获取当前地图的视野范围 */
  16920. getRegion(option?: GetRegionOption): void
  16921. /** [MapContext.getRotate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getRotate.html)
  16922. *
  16923. * 需要基础库: `2.8.0`
  16924. *
  16925. * 在插件中使用:支持
  16926. *
  16927. * 获取当前地图的旋转角 */
  16928. getRotate(option?: GetRotateOption): void
  16929. /** [MapContext.getScale(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getScale.html)
  16930. *
  16931. * 需要基础库: `1.4.0`
  16932. *
  16933. * 在插件中使用:支持
  16934. *
  16935. * 获取当前地图的缩放级别 */
  16936. getScale(option?: GetScaleOption): void
  16937. /** [MapContext.getSkew(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.getSkew.html)
  16938. *
  16939. * 需要基础库: `2.8.0`
  16940. *
  16941. * 在插件中使用:支持
  16942. *
  16943. * 获取当前地图的倾斜角 */
  16944. getSkew(option?: GetSkewOption): void
  16945. /** [MapContext.includePoints(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.includePoints.html)
  16946. *
  16947. * 需要基础库: `1.2.0`
  16948. *
  16949. * 在插件中使用:支持
  16950. *
  16951. * 缩放视野展示所有经纬度 */
  16952. includePoints(option: IncludePointsOption): void
  16953. /** [MapContext.initMarkerCluster(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.initMarkerCluster.html)
  16954. *
  16955. * 需要基础库: `2.13.0`
  16956. *
  16957. * 在插件中使用:支持
  16958. *
  16959. * 初始化点聚合的配置,未调用时采用默认配置。 */
  16960. initMarkerCluster(option: InitMarkerClusterOption): void
  16961. /** [MapContext.moveAlong(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.moveAlong.html)
  16962. *
  16963. * 需要基础库: `2.13.0`
  16964. *
  16965. * 在插件中使用:支持
  16966. *
  16967. * 沿指定路径移动 `marker`,用于轨迹回放等场景。动画完成时触发回调事件,若动画进行中,对同一 `marker` 再次调用 `moveAlong` 方法,前一次的动画将被打断。 */
  16968. moveAlong(option: MoveAlongOption): void
  16969. /** [MapContext.moveToLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.moveToLocation.html)
  16970. *
  16971. * 需要基础库: `1.2.0`
  16972. *
  16973. * 在插件中使用:支持
  16974. *
  16975. * 将地图中心移置当前定位点,此时需设置地图组件 show-location 为true。[2.8.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起支持将地图中心移动到指定位置。 */
  16976. moveToLocation(option?: MoveToLocationOption): void
  16977. /** [MapContext.on(string event, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.on.html)
  16978. *
  16979. * 需要基础库: `2.13.0`
  16980. *
  16981. * 在插件中使用:支持
  16982. *
  16983. * 监听地图事件。
  16984. *
  16985. * ### visualLayerEvent
  16986. *
  16987. * 可视化图层 visualLayer 统一回调出口,[2.26.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起支持。
  16988. *
  16989. * #### 返回参数
  16990. *
  16991. * | 参数 | 类型 | 说明 |
  16992. * | --------- | ------ | -------- |
  16993. * | layerId | String | 图层 id |
  16994. * | eventType | String | 事件类型 |
  16995. * | eventInfo | String | 事件信息 |
  16996. *
  16997. * ### markerClusterCreate
  16998. *
  16999. * 缩放或拖动导致新的聚合簇产生时触发,仅返回新创建的聚合簇信息。
  17000. *
  17001. * #### 返回参数
  17002. *
  17003. * | 参数 | 类型 | 说明 |
  17004. * | -------- | -------------------- | ---------- |
  17005. * | clusters | `Array<ClusterInfo>` | 聚合簇数据 |
  17006. *
  17007. * ### markerClusterClick
  17008. *
  17009. * 聚合簇的点击事件。
  17010. *
  17011. * #### 返回参数
  17012. *
  17013. * | 参数 | 类型 | 说明 |
  17014. * | --------- | ------------- | --------- |
  17015. * | cluster | ClusterInfo | 聚合簇 |
  17016. *
  17017. * #### ClusterInfo 结构
  17018. *
  17019. * | 参数 | 类型 | 说明 |
  17020. * | --------- | --------------- | -------------------------- |
  17021. * | clusterId | Number | 聚合簇的 id |
  17022. * | center | LatLng | 聚合簇的坐标 |
  17023. * | markerIds | `Array<Number>` | 该聚合簇内的点标记数据数组 |
  17024. *
  17025. * **示例代码**
  17026. *
  17027. * ```js
  17028. MapContext.on('visualLayerEvent', (res) => {})
  17029. MapContext.on('markerClusterCreate', (res) => {})
  17030. MapContext.on('markerClusterClick', (res) => {})
  17031. ``` */
  17032. on(
  17033. /** 事件名
  17034. *
  17035. * 参数 event 可选值:
  17036. * - 'markerClusterCreate': ;
  17037. * - 'markerClusterClick': ;
  17038. * - 'visualLayerEvent': ; */
  17039. event:
  17040. | 'markerClusterCreate'
  17041. | 'markerClusterClick'
  17042. | 'visualLayerEvent',
  17043. /** 事件的回调函数 */
  17044. callback: (...args: any[]) => any
  17045. ): void
  17046. /** [MapContext.openMapApp(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.openMapApp.html)
  17047. *
  17048. * 需要基础库: `2.14.0`
  17049. *
  17050. * 在插件中使用:支持
  17051. *
  17052. * 拉起地图APP选择导航。 */
  17053. openMapApp(option: OpenMapAppOption): void
  17054. /** [MapContext.removeArc(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeArc.html)
  17055. *
  17056. * 需要基础库: `2.22.0`
  17057. *
  17058. * 在插件中使用:支持
  17059. *
  17060. * 删除弧线。工具侧暂未支持。 */
  17061. removeArc(option: RemoveArcOption): void
  17062. /** [MapContext.removeCustomLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeCustomLayer.html)
  17063. *
  17064. * 需要基础库: `2.12.0`
  17065. *
  17066. * 在插件中使用:支持
  17067. *
  17068. * 移除个性化图层。 */
  17069. removeCustomLayer(option: RemoveCustomLayerOption): void
  17070. /** [MapContext.removeGroundOverlay(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeGroundOverlay.html)
  17071. *
  17072. * 需要基础库: `2.14.0`
  17073. *
  17074. * 在插件中使用:支持
  17075. *
  17076. * 移除自定义图片图层。 */
  17077. removeGroundOverlay(option: RemoveGroundOverlayOption): void
  17078. /** [MapContext.removeMarkers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeMarkers.html)
  17079. *
  17080. * 需要基础库: `2.13.0`
  17081. *
  17082. * 在插件中使用:支持
  17083. *
  17084. * 移除 marker。 */
  17085. removeMarkers(option: RemoveMarkersOption): void
  17086. /** [MapContext.removeVisualLayer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.removeVisualLayer.html)
  17087. *
  17088. * 需要基础库: `2.20.1`
  17089. *
  17090. * 在插件中使用:支持
  17091. *
  17092. * 移除可视化图层。 */
  17093. removeVisualLayer(option: RemoveVisualLayerOption): void
  17094. /** [MapContext.setBoundary(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setBoundary.html)
  17095. *
  17096. * 需要基础库: `2.22.0`
  17097. *
  17098. * 在插件中使用:支持
  17099. *
  17100. * 限制地图的显示范围。此接口同时会限制地图的最小缩放整数级别。 */
  17101. setBoundary(option: SetBoundaryOption): void
  17102. /** [MapContext.setCenterOffset(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setCenterOffset.html)
  17103. *
  17104. * 需要基础库: `2.10.0`
  17105. *
  17106. * 在插件中使用:支持
  17107. *
  17108. * 设置地图中心点偏移,向后向下为增长,屏幕比例范围(0.25~0.75),默认偏移为[0.5, 0.5] */
  17109. setCenterOffset(option: SetCenterOffsetOption): void
  17110. /** [MapContext.setLocMarkerIcon(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.setLocMarkerIcon.html)
  17111. *
  17112. * 需要基础库: `2.16.0`
  17113. *
  17114. * 在插件中使用:支持
  17115. *
  17116. * 设置定位点图标,支持网络路径、本地路径、代码包路径 */
  17117. setLocMarkerIcon(option: SetLocMarkerIconOption): void
  17118. /** [MapContext.toScreenLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.toScreenLocation.html)
  17119. *
  17120. * 需要基础库: `2.14.0`
  17121. *
  17122. * 在插件中使用:支持
  17123. *
  17124. * 获取经纬度对应的屏幕坐标,坐标原点为地图左上角。 */
  17125. toScreenLocation(option: ToScreenLocationOption): void
  17126. /** [MapContext.translateMarker(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.translateMarker.html)
  17127. *
  17128. * 需要基础库: `1.2.0`
  17129. *
  17130. * 在插件中使用:支持
  17131. *
  17132. * 平移marker,带动画。 */
  17133. translateMarker(option: TranslateMarkerOption): void
  17134. /** [MapContext.updateGroundOverlay(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.updateGroundOverlay.html)
  17135. *
  17136. * 需要基础库: `2.14.0`
  17137. *
  17138. * 在插件中使用:支持
  17139. *
  17140. * 更新自定义图片图层。 */
  17141. updateGroundOverlay(option: UpdateGroundOverlayOption): void
  17142. }
  17143. interface MediaContainer {
  17144. /** [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)
  17145. *
  17146. * 需要基础库: `2.9.0`
  17147. *
  17148. * 在插件中使用:支持
  17149. *
  17150. * 将音频或视频轨道添加到容器 */
  17151. addTrack(
  17152. /** [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html)
  17153. *
  17154. * 要添加的音频或视频轨道 */
  17155. track: MediaTrack
  17156. ): void
  17157. /** [MediaContainer.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.destroy.html)
  17158. *
  17159. * 需要基础库: `2.9.0`
  17160. *
  17161. * 在插件中使用:支持
  17162. *
  17163. * 将容器销毁,释放资源 */
  17164. destroy(): void
  17165. /** [MediaContainer.export()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.export.html)
  17166. *
  17167. * 需要基础库: `2.9.0`
  17168. *
  17169. * 在插件中使用:支持
  17170. *
  17171. * 将容器内的轨道合并并导出视频文件 */
  17172. export(): void
  17173. /** [MediaContainer.extractDataSource(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaContainer.extractDataSource.html)
  17174. *
  17175. * 需要基础库: `2.9.0`
  17176. *
  17177. * 在插件中使用:支持
  17178. *
  17179. * 将传入的视频源分离轨道。不会自动将轨道添加到待合成的容器里。 */
  17180. extractDataSource(option: ExtractDataSourceOption): void
  17181. /** [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)
  17182. *
  17183. * 需要基础库: `2.9.0`
  17184. *
  17185. * 在插件中使用:支持
  17186. *
  17187. * 将音频或视频轨道从容器中移除 */
  17188. removeTrack(
  17189. /** [MediaTrack](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-processing/MediaTrack.html)
  17190. *
  17191. * 要移除的音频或视频轨道 */
  17192. track: MediaTrack
  17193. ): void
  17194. }
  17195. interface MediaQueryObserver {
  17196. /** [MediaQueryObserver.disconnect()](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/MediaQueryObserver.disconnect.html)
  17197. *
  17198. * 在插件中使用:支持
  17199. *
  17200. * 停止监听。回调函数将不再触发 */
  17201. disconnect(): void
  17202. /** [MediaQueryObserver.observe(Object descriptor, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/MediaQueryObserver.observe.html)
  17203. *
  17204. * 在插件中使用:支持
  17205. *
  17206. * 开始监听页面 media query 变化情况 */
  17207. observe(
  17208. /** media query 描述符 */
  17209. descriptor: ObserveDescriptor,
  17210. /** 监听 media query 状态变化的回调函数 */
  17211. callback: MediaQueryObserverObserveCallback
  17212. ): void
  17213. }
  17214. interface MediaRecorder {
  17215. /** [MediaRecorder.off(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.off.html)
  17216. *
  17217. * 需要基础库: `2.11.0`
  17218. *
  17219. * 在插件中使用:支持
  17220. *
  17221. * 取消监听录制事件。当对应事件触发时,该回调函数不再执行。 */
  17222. off(
  17223. /** 事件名 */
  17224. eventName: string,
  17225. /** 事件触发时执行的回调函数 */
  17226. callback: (...args: any[]) => any
  17227. ): void
  17228. /** [MediaRecorder.on(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.on.html)
  17229. *
  17230. * 需要基础库: `2.11.0`
  17231. *
  17232. * 在插件中使用:支持
  17233. *
  17234. * 注册监听录制事件的回调函数。当对应事件触发时,回调函数会被执行。 */
  17235. on(
  17236. /** 事件名
  17237. *
  17238. * 参数 eventName 可选值:
  17239. * - 'start': 录制开始事件。;
  17240. * - 'stop': 录制结束事件。返回 {tempFilePath, duration, fileSize};
  17241. * - 'pause': 录制暂停事件。;
  17242. * - 'resume': 录制继续事件。;
  17243. * - 'timeupdate': 录制时间更新事件。; */
  17244. eventName: 'start' | 'stop' | 'pause' | 'resume' | 'timeupdate',
  17245. /** 事件触发时执行的回调函数 */
  17246. callback: (...args: any[]) => any
  17247. ): void
  17248. /** [Promise MediaRecorder.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.destroy.html)
  17249. *
  17250. * 需要基础库: `2.11.0`
  17251. *
  17252. * 在插件中使用:支持
  17253. *
  17254. * 销毁录制器 */
  17255. destroy(): Promise<any>
  17256. /** [Promise MediaRecorder.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.pause.html)
  17257. *
  17258. * 需要基础库: `2.11.0`
  17259. *
  17260. * 在插件中使用:支持
  17261. *
  17262. * 暂停录制 */
  17263. pause(): Promise<any>
  17264. /** [Promise MediaRecorder.requestFrame(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.requestFrame.html)
  17265. *
  17266. * 需要基础库: `2.11.0`
  17267. *
  17268. * 在插件中使用:支持
  17269. *
  17270. * 请求下一帧录制,在 callback 里完成一帧渲染后开始录制当前帧 */
  17271. requestFrame(callback: (...args: any[]) => any): Promise<any>
  17272. /** [Promise MediaRecorder.resume()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.resume.html)
  17273. *
  17274. * 需要基础库: `2.11.0`
  17275. *
  17276. * 在插件中使用:支持
  17277. *
  17278. * 恢复录制 */
  17279. resume(): Promise<any>
  17280. /** [Promise MediaRecorder.start()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.start.html)
  17281. *
  17282. * 需要基础库: `2.11.0`
  17283. *
  17284. * 在插件中使用:支持
  17285. *
  17286. * 开始录制 */
  17287. start(): Promise<any>
  17288. /** [Promise MediaRecorder.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/MediaRecorder.stop.html)
  17289. *
  17290. * 需要基础库: `2.11.0`
  17291. *
  17292. * 在插件中使用:支持
  17293. *
  17294. * 结束录制 */
  17295. stop(): Promise<any>
  17296. }
  17297. interface MifareClassic {
  17298. /** [MifareClassic.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.close.html)
  17299. *
  17300. * 需要基础库: `2.11.2`
  17301. *
  17302. * 在插件中使用:支持
  17303. *
  17304. * 断开连接 */
  17305. close(option?: NdefCloseOption): void
  17306. /** [MifareClassic.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.connect.html)
  17307. *
  17308. * 需要基础库: `2.11.2`
  17309. *
  17310. * 在插件中使用:支持
  17311. *
  17312. * 连接 NFC 标签 */
  17313. connect(option?: NdefConnectOption): void
  17314. /** [MifareClassic.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.getMaxTransceiveLength.html)
  17315. *
  17316. * 需要基础库: `2.11.2`
  17317. *
  17318. * 在插件中使用:支持
  17319. *
  17320. * 获取最大传输长度 */
  17321. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  17322. /** [MifareClassic.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.isConnected.html)
  17323. *
  17324. * 需要基础库: `2.11.2`
  17325. *
  17326. * 在插件中使用:支持
  17327. *
  17328. * @warning **该接口已废弃,连接状态开发者自行维护即可**
  17329. *
  17330. * 检查是否已连接 */
  17331. isConnected(option?: IsConnectedOption): void
  17332. /** [MifareClassic.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.setTimeout.html)
  17333. *
  17334. * 需要基础库: `2.11.2`
  17335. *
  17336. * 在插件中使用:支持
  17337. *
  17338. * 设置超时时间 */
  17339. setTimeout(option: SetTimeoutOption): void
  17340. /** [MifareClassic.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareClassic.transceive.html)
  17341. *
  17342. * 需要基础库: `2.11.2`
  17343. *
  17344. * 在插件中使用:支持
  17345. *
  17346. * 发送数据 */
  17347. transceive(option: TransceiveOption): void
  17348. }
  17349. interface MifareUltralight {
  17350. /** [MifareUltralight.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.close.html)
  17351. *
  17352. * 需要基础库: `2.11.2`
  17353. *
  17354. * 在插件中使用:支持
  17355. *
  17356. * 断开连接 */
  17357. close(option?: NdefCloseOption): void
  17358. /** [MifareUltralight.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.connect.html)
  17359. *
  17360. * 需要基础库: `2.11.2`
  17361. *
  17362. * 在插件中使用:支持
  17363. *
  17364. * 连接 NFC 标签 */
  17365. connect(option?: NdefConnectOption): void
  17366. /** [MifareUltralight.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.getMaxTransceiveLength.html)
  17367. *
  17368. * 需要基础库: `2.11.2`
  17369. *
  17370. * 在插件中使用:支持
  17371. *
  17372. * 获取最大传输长度 */
  17373. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  17374. /** [MifareUltralight.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.isConnected.html)
  17375. *
  17376. * 需要基础库: `2.11.2`
  17377. *
  17378. * 在插件中使用:支持
  17379. *
  17380. * @warning **该接口已废弃,连接状态开发者自行维护即可**
  17381. *
  17382. * 检查是否已连接 */
  17383. isConnected(option?: IsConnectedOption): void
  17384. /** [MifareUltralight.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.setTimeout.html)
  17385. *
  17386. * 需要基础库: `2.11.2`
  17387. *
  17388. * 在插件中使用:支持
  17389. *
  17390. * 设置超时时间 */
  17391. setTimeout(option: SetTimeoutOption): void
  17392. /** [MifareUltralight.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/MifareUltralight.transceive.html)
  17393. *
  17394. * 需要基础库: `2.11.2`
  17395. *
  17396. * 在插件中使用:支持
  17397. *
  17398. * 发送数据 */
  17399. transceive(option: TransceiveOption): void
  17400. }
  17401. interface NFCError {
  17402. /** 错误信息
  17403. *
  17404. * | 错误码 | 错误信息 | 说明 |
  17405. * | - | - | - |
  17406. * | 0 | ok | 正常 |
  17407. * | 13000 | | 当前设备不支持NFC |
  17408. * | 13001 | | 当前设备支持NFC,但系统NFC开关未开启 |
  17409. * | 13002 | | 当前设备支持NFC,但不支持HCE |
  17410. * | 13003 | | AID列表参数格式错误 |
  17411. * | 13004 | | 未设置微信为默认NFC支付应用 |
  17412. * | 13005 | | 返回的指令不合法 |
  17413. * | 13006 | | 注册AID失败 | */ errMsg: string
  17414. /** 错误码
  17415. *
  17416. * | 错误码 | 错误信息 | 说明 |
  17417. * | - | - | - |
  17418. * | 0 | ok | 正常 |
  17419. * | 13000 | | 当前设备不支持NFC |
  17420. * | 13001 | | 当前设备支持NFC,但系统NFC开关未开启 |
  17421. * | 13002 | | 当前设备支持NFC,但不支持HCE |
  17422. * | 13003 | | AID列表参数格式错误 |
  17423. * | 13004 | | 未设置微信为默认NFC支付应用 |
  17424. * | 13005 | | 返回的指令不合法 |
  17425. * | 13006 | | 注册AID失败 | */ errCode: number
  17426. }
  17427. interface Ndef {
  17428. /** [Ndef.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.close.html)
  17429. *
  17430. * 需要基础库: `2.11.2`
  17431. *
  17432. * 在插件中使用:支持
  17433. *
  17434. * 断开连接 */
  17435. close(option?: NdefCloseOption): void
  17436. /** [Ndef.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.connect.html)
  17437. *
  17438. * 需要基础库: `2.11.2`
  17439. *
  17440. * 在插件中使用:支持
  17441. *
  17442. * 连接 NFC 标签 */
  17443. connect(option?: NdefConnectOption): void
  17444. /** [Ndef.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.isConnected.html)
  17445. *
  17446. * 需要基础库: `2.11.2`
  17447. *
  17448. * 在插件中使用:支持
  17449. *
  17450. * @warning **该接口已废弃,连接状态开发者自行维护即可**
  17451. *
  17452. * 检查是否已连接 */
  17453. isConnected(option?: IsConnectedOption): void
  17454. /** [Ndef.offNdefMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.offNdefMessage.html)
  17455. *
  17456. * 需要基础库: `2.11.2`
  17457. *
  17458. * 在插件中使用:支持
  17459. *
  17460. * 取消监听 Ndef 消息 */
  17461. offNdefMessage(callback: (...args: any[]) => any): void
  17462. /** [Ndef.onNdefMessage(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.onNdefMessage.html)
  17463. *
  17464. * 需要基础库: `2.11.2`
  17465. *
  17466. * 在插件中使用:支持
  17467. *
  17468. * 监听 Ndef 消息 */
  17469. onNdefMessage(callback: (...args: any[]) => any): void
  17470. /** [Ndef.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.setTimeout.html)
  17471. *
  17472. * 需要基础库: `2.11.2`
  17473. *
  17474. * 在插件中使用:支持
  17475. *
  17476. * 设置超时时间 */
  17477. setTimeout(option: SetTimeoutOption): void
  17478. /** [Ndef.writeNdefMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/Ndef.writeNdefMessage.html)
  17479. *
  17480. * 需要基础库: `2.11.2`
  17481. *
  17482. * 在插件中使用:支持
  17483. *
  17484. * 重写 Ndef 标签内容 */
  17485. writeNdefMessage(option: WriteNdefMessageOption): void
  17486. }
  17487. interface NfcA {
  17488. /** [NfcA.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.close.html)
  17489. *
  17490. * 需要基础库: `2.11.2`
  17491. *
  17492. * 在插件中使用:支持
  17493. *
  17494. * 断开连接 */
  17495. close(option?: NdefCloseOption): void
  17496. /** [NfcA.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.connect.html)
  17497. *
  17498. * 需要基础库: `2.11.2`
  17499. *
  17500. * 在插件中使用:支持
  17501. *
  17502. * 连接 NFC 标签 */
  17503. connect(option?: NdefConnectOption): void
  17504. /** [NfcA.getAtqa(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getAtqa.html)
  17505. *
  17506. * 需要基础库: `2.11.2`
  17507. *
  17508. * 在插件中使用:支持
  17509. *
  17510. * 获取ATQA信息 */
  17511. getAtqa(option?: GetAtqaOption): void
  17512. /** [NfcA.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getMaxTransceiveLength.html)
  17513. *
  17514. * 需要基础库: `2.11.2`
  17515. *
  17516. * 在插件中使用:支持
  17517. *
  17518. * 获取最大传输长度 */
  17519. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  17520. /** [NfcA.getSak(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.getSak.html)
  17521. *
  17522. * 需要基础库: `2.11.2`
  17523. *
  17524. * 在插件中使用:支持
  17525. *
  17526. * 获取SAK信息 */
  17527. getSak(option?: GetSakOption): void
  17528. /** [NfcA.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.isConnected.html)
  17529. *
  17530. * 需要基础库: `2.11.2`
  17531. *
  17532. * 在插件中使用:支持
  17533. *
  17534. * @warning **该接口已废弃,连接状态开发者自行维护即可**
  17535. *
  17536. * 检查是否已连接 */
  17537. isConnected(option?: IsConnectedOption): void
  17538. /** [NfcA.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.setTimeout.html)
  17539. *
  17540. * 需要基础库: `2.11.2`
  17541. *
  17542. * 在插件中使用:支持
  17543. *
  17544. * 设置超时时间 */
  17545. setTimeout(option: SetTimeoutOption): void
  17546. /** [NfcA.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcA.transceive.html)
  17547. *
  17548. * 需要基础库: `2.11.2`
  17549. *
  17550. * 在插件中使用:支持
  17551. *
  17552. * 发送数据 */
  17553. transceive(option: TransceiveOption): void
  17554. }
  17555. interface NfcB {
  17556. /** [NfcB.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.close.html)
  17557. *
  17558. * 需要基础库: `2.11.2`
  17559. *
  17560. * 在插件中使用:支持
  17561. *
  17562. * 断开连接 */
  17563. close(option?: NdefCloseOption): void
  17564. /** [NfcB.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.connect.html)
  17565. *
  17566. * 需要基础库: `2.11.2`
  17567. *
  17568. * 在插件中使用:支持
  17569. *
  17570. * 连接 NFC 标签 */
  17571. connect(option?: NdefConnectOption): void
  17572. /** [NfcB.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.getMaxTransceiveLength.html)
  17573. *
  17574. * 需要基础库: `2.11.2`
  17575. *
  17576. * 在插件中使用:支持
  17577. *
  17578. * 获取最大传输长度 */
  17579. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  17580. /** [NfcB.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.isConnected.html)
  17581. *
  17582. * 需要基础库: `2.11.2`
  17583. *
  17584. * 在插件中使用:支持
  17585. *
  17586. * @warning **该接口已废弃,连接状态开发者自行维护即可**
  17587. *
  17588. * 检查是否已连接 */
  17589. isConnected(option?: IsConnectedOption): void
  17590. /** [NfcB.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.setTimeout.html)
  17591. *
  17592. * 需要基础库: `2.11.2`
  17593. *
  17594. * 在插件中使用:支持
  17595. *
  17596. * 设置超时时间 */
  17597. setTimeout(option: SetTimeoutOption): void
  17598. /** [NfcB.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcB.transceive.html)
  17599. *
  17600. * 需要基础库: `2.11.2`
  17601. *
  17602. * 在插件中使用:支持
  17603. *
  17604. * 发送数据 */
  17605. transceive(option: TransceiveOption): void
  17606. }
  17607. interface NfcF {
  17608. /** [NfcF.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.close.html)
  17609. *
  17610. * 需要基础库: `2.11.2`
  17611. *
  17612. * 在插件中使用:支持
  17613. *
  17614. * 断开连接 */
  17615. close(option?: NdefCloseOption): void
  17616. /** [NfcF.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.connect.html)
  17617. *
  17618. * 需要基础库: `2.11.2`
  17619. *
  17620. * 在插件中使用:支持
  17621. *
  17622. * 连接 NFC 标签 */
  17623. connect(option?: NdefConnectOption): void
  17624. /** [NfcF.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.getMaxTransceiveLength.html)
  17625. *
  17626. * 需要基础库: `2.11.2`
  17627. *
  17628. * 在插件中使用:支持
  17629. *
  17630. * 获取最大传输长度 */
  17631. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  17632. /** [NfcF.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.isConnected.html)
  17633. *
  17634. * 需要基础库: `2.11.2`
  17635. *
  17636. * 在插件中使用:支持
  17637. *
  17638. * @warning **该接口已废弃,连接状态开发者自行维护即可**
  17639. *
  17640. * 检查是否已连接 */
  17641. isConnected(option?: IsConnectedOption): void
  17642. /** [NfcF.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.setTimeout.html)
  17643. *
  17644. * 需要基础库: `2.11.2`
  17645. *
  17646. * 在插件中使用:支持
  17647. *
  17648. * 设置超时时间 */
  17649. setTimeout(option: SetTimeoutOption): void
  17650. /** [NfcF.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcF.transceive.html)
  17651. *
  17652. * 需要基础库: `2.11.2`
  17653. *
  17654. * 在插件中使用:支持
  17655. *
  17656. * 发送数据 */
  17657. transceive(option: TransceiveOption): void
  17658. }
  17659. interface NfcV {
  17660. /** [NfcV.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.close.html)
  17661. *
  17662. * 需要基础库: `2.11.2`
  17663. *
  17664. * 在插件中使用:支持
  17665. *
  17666. * 断开连接 */
  17667. close(option?: NdefCloseOption): void
  17668. /** [NfcV.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.connect.html)
  17669. *
  17670. * 需要基础库: `2.11.2`
  17671. *
  17672. * 在插件中使用:支持
  17673. *
  17674. * 连接 NFC 标签 */
  17675. connect(option?: NdefConnectOption): void
  17676. /** [NfcV.getMaxTransceiveLength(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.getMaxTransceiveLength.html)
  17677. *
  17678. * 需要基础库: `2.11.2`
  17679. *
  17680. * 在插件中使用:支持
  17681. *
  17682. * 获取最大传输长度 */
  17683. getMaxTransceiveLength(option?: GetMaxTransceiveLengthOption): void
  17684. /** [NfcV.isConnected(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.isConnected.html)
  17685. *
  17686. * 需要基础库: `2.11.2`
  17687. *
  17688. * 在插件中使用:支持
  17689. *
  17690. * @warning **该接口已废弃,连接状态开发者自行维护即可**
  17691. *
  17692. * 检查是否已连接 */
  17693. isConnected(option?: IsConnectedOption): void
  17694. /** [NfcV.setTimeout(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.setTimeout.html)
  17695. *
  17696. * 需要基础库: `2.11.2`
  17697. *
  17698. * 在插件中使用:支持
  17699. *
  17700. * 设置超时时间 */
  17701. setTimeout(option: SetTimeoutOption): void
  17702. /** [NfcV.transceive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc/NfcV.transceive.html)
  17703. *
  17704. * 需要基础库: `2.11.2`
  17705. *
  17706. * 在插件中使用:支持
  17707. *
  17708. * 发送数据 */
  17709. transceive(option: TransceiveOption): void
  17710. }
  17711. interface Nfcrwerror {
  17712. /** 错误信息
  17713. *
  17714. * | 错误码 | 错误信息 | 说明 |
  17715. * | - | - | - |
  17716. * | 13000 | 设备不支持NFC | |
  17717. * | 13001 | 系统NFC开关未打开 | |
  17718. * | 13010 | 未知错误 | |
  17719. * | 13019 | user is not authorized | 用户未授权 |
  17720. * | 13011 | invalid parameter | 参数无效 |
  17721. * | 13012 | parse NdefMessage failed | 将参数解析为NdefMessage失败 |
  17722. * | 13021 | NFC discovery already started | 已经开始NFC扫描 |
  17723. * | 13018 | NFC discovery has not started | 尝试在未开始NFC扫描时停止NFC扫描 |
  17724. * | 13022 | Tech already connected | 标签已经连接 |
  17725. * | 13023 | Tech has not connected | 尝试在未连接标签时断开连接 |
  17726. * | 13013 | NFC tag has not been discovered | 未扫描到NFC标签 |
  17727. * | 13014 | invalid tech | 无效的标签技术 |
  17728. * | 13015 | unavailable tech | 从标签上获取对应技术失败 |
  17729. * | 13024 | function not support | 当前标签技术不支持该功能 |
  17730. * | 13017 | system internal error | 相关读写操作失败 |
  17731. * | 13016 | connect fail | 连接失败 | */ errMsg: string
  17732. /** 错误码
  17733. *
  17734. * | 错误码 | 错误信息 | 说明 |
  17735. * | - | - | - |
  17736. * | 13000 | 设备不支持NFC | |
  17737. * | 13001 | 系统NFC开关未打开 | |
  17738. * | 13010 | 未知错误 | |
  17739. * | 13019 | user is not authorized | 用户未授权 |
  17740. * | 13011 | invalid parameter | 参数无效 |
  17741. * | 13012 | parse NdefMessage failed | 将参数解析为NdefMessage失败 |
  17742. * | 13021 | NFC discovery already started | 已经开始NFC扫描 |
  17743. * | 13018 | NFC discovery has not started | 尝试在未开始NFC扫描时停止NFC扫描 |
  17744. * | 13022 | Tech already connected | 标签已经连接 |
  17745. * | 13023 | Tech has not connected | 尝试在未连接标签时断开连接 |
  17746. * | 13013 | NFC tag has not been discovered | 未扫描到NFC标签 |
  17747. * | 13014 | invalid tech | 无效的标签技术 |
  17748. * | 13015 | unavailable tech | 从标签上获取对应技术失败 |
  17749. * | 13024 | function not support | 当前标签技术不支持该功能 |
  17750. * | 13017 | system internal error | 相关读写操作失败 |
  17751. * | 13016 | connect fail | 连接失败 | */ errCode: number
  17752. }
  17753. interface NodesRef {
  17754. /** [[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)
  17755. *
  17756. * 在插件中使用:支持
  17757. *
  17758. * 添加节点的布局位置的查询请求。相对于显示区域,以像素为单位。其功能类似于 DOM 的 `getBoundingClientRect`。返回 `NodesRef` 对应的 `SelectorQuery`。
  17759. *
  17760. * **示例代码**
  17761. *
  17762. * ```js
  17763. Page({
  17764. getRect () {
  17765. wx.createSelectorQuery().select('#the-id').boundingClientRect(function(rect){
  17766. rect.id // 节点的ID
  17767. rect.dataset // 节点的dataset
  17768. rect.left // 节点的左边界坐标
  17769. rect.right // 节点的右边界坐标
  17770. rect.top // 节点的上边界坐标
  17771. rect.bottom // 节点的下边界坐标
  17772. rect.width // 节点的宽度
  17773. rect.height // 节点的高度
  17774. }).exec()
  17775. },
  17776. getAllRects () {
  17777. wx.createSelectorQuery().selectAll('.a-class').boundingClientRect(function(rects){
  17778. rects.forEach(function(rect){
  17779. rect.id // 节点的ID
  17780. rect.dataset // 节点的dataset
  17781. rect.left // 节点的左边界坐标
  17782. rect.right // 节点的右边界坐标
  17783. rect.top // 节点的上边界坐标
  17784. rect.bottom // 节点的下边界坐标
  17785. rect.width // 节点的宽度
  17786. rect.height // 节点的高度
  17787. })
  17788. }).exec()
  17789. }
  17790. })
  17791. ``` */
  17792. boundingClientRect(
  17793. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */
  17794. callback?: BoundingClientRectCallback
  17795. ): SelectorQuery
  17796. /** [[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)
  17797. *
  17798. * 需要基础库: `2.4.2`
  17799. *
  17800. * 在插件中使用:支持
  17801. *
  17802. * 添加节点的 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) 的获取。
  17803. *
  17804. * **示例代码**
  17805. *
  17806. * ```js
  17807. Page({
  17808. getContext () {
  17809. wx.createSelectorQuery().select('.the-video-class').context(function(res){
  17810. console.log(res.context) // 节点对应的 Context 对象。如:选中的节点是 <video> 组件,那么此处即返回 VideoContext 对象
  17811. }).exec()
  17812. }
  17813. })
  17814. ``` */
  17815. context(
  17816. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,返回节点信息。 */
  17817. callback?: ContextCallback
  17818. ): SelectorQuery
  17819. /** [[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)
  17820. *
  17821. * 在插件中使用:支持
  17822. *
  17823. * 获取节点的相关信息。需要获取的字段在fields中指定。返回值是 `nodesRef` 对应的 `selectorQuery`
  17824. *
  17825. * **注意**
  17826. *
  17827. * computedStyle 的优先级高于 size,当同时在 computedStyle 里指定了 width/height 和传入了 size: true,则优先返回 computedStyle 获取到的 width/height。
  17828. *
  17829. * **示例代码**
  17830. *
  17831. * ```js
  17832. Page({
  17833. getFields () {
  17834. wx.createSelectorQuery().select('#the-id').fields({
  17835. dataset: true,
  17836. size: true,
  17837. scrollOffset: true,
  17838. properties: ['scrollX', 'scrollY'],
  17839. computedStyle: ['margin', 'backgroundColor'],
  17840. context: true,
  17841. }, function (res) {
  17842. res.dataset // 节点的dataset
  17843. res.width // 节点的宽度
  17844. res.height // 节点的高度
  17845. res.scrollLeft // 节点的水平滚动位置
  17846. res.scrollTop // 节点的竖直滚动位置
  17847. res.scrollX // 节点 scroll-x 属性的当前值
  17848. res.scrollY // 节点 scroll-y 属性的当前值
  17849. // 此处返回指定要返回的样式名
  17850. res.margin
  17851. res.backgroundColor
  17852. res.context // 节点对应的 Context 对象
  17853. }).exec()
  17854. }
  17855. })
  17856. ``` */
  17857. fields(
  17858. fields: Fields,
  17859. /** 回调函数 */
  17860. callback?: FieldsCallback
  17861. ): SelectorQuery
  17862. /** [[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)
  17863. *
  17864. * 需要基础库: `2.7.0`
  17865. *
  17866. * 在插件中使用:支持
  17867. *
  17868. * 获取 Node 节点实例。目前支持 [Canvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Canvas.html) 和 [ScrollViewContext](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.html) 的获取。
  17869. *
  17870. * **示例代码**
  17871. *
  17872. * ```js
  17873. Page({
  17874. getNode() {
  17875. wx.createSelectorQuery().select('.canvas').node(function(res){
  17876. console.log(res.node) // 节点对应的 Canvas 实例。
  17877. }).exec()
  17878. }
  17879. })
  17880. ``` */
  17881. node(
  17882. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,返回节点信息。 */
  17883. callback?: NodeCallback
  17884. ): SelectorQuery
  17885. /** [[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)
  17886. *
  17887. * 在插件中使用:支持
  17888. *
  17889. * 添加节点的滚动位置查询请求。以像素为单位。节点必须是 `scroll-view` 或者 `viewport`,返回 `NodesRef` 对应的 `SelectorQuery`。
  17890. *
  17891. * **示例代码**
  17892. *
  17893. * ```js
  17894. Page({
  17895. getScrollOffset () {
  17896. wx.createSelectorQuery().selectViewport().scrollOffset(function(res){
  17897. res.id // 节点的ID
  17898. res.dataset // 节点的dataset
  17899. res.scrollLeft // 节点的水平滚动位置
  17900. res.scrollTop // 节点的竖直滚动位置
  17901. }).exec()
  17902. }
  17903. })
  17904. ``` */
  17905. scrollOffset(
  17906. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */
  17907. callback?: ScrollOffsetCallback
  17908. ): SelectorQuery
  17909. }
  17910. interface Path2D {
  17911. /** [Path2D.addPath([Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html) path)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.addPath.html)
  17912. *
  17913. * 需要基础库: `2.11.0`
  17914. *
  17915. * 在插件中使用:不支持
  17916. *
  17917. * 添加路径到当前路径。 */
  17918. addPath(
  17919. /** [Path2D](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.html)
  17920. *
  17921. * 添加的 Path2D 路径。 */
  17922. path: Path2D
  17923. ): void
  17924. /** [Path2D.arc(number x, number y, number radius, number startAngle, number endAngle, boolean counterclockwise)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.arc.html)
  17925. *
  17926. * 需要基础库: `2.11.0`
  17927. *
  17928. * 在插件中使用:不支持
  17929. *
  17930. * 添加一段圆弧路径。 */
  17931. arc(
  17932. /** 圆心横坐标。 */
  17933. x: number,
  17934. /** 圆心纵坐标。 */
  17935. y: number,
  17936. /** 圆形半径,必须为正数。 */
  17937. radius: number,
  17938. /** 圆弧开始角度。 */
  17939. startAngle: number,
  17940. /** 圆弧结束角度。 */
  17941. endAngle: number,
  17942. /** 是否逆时针绘制。如果传 true, 则会从 endAngle 开始绘制到 startAngle。 */
  17943. counterclockwise?: boolean
  17944. ): void
  17945. /** [Path2D.arcTo(number x1, number y1, number x2, number y2, number radius)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.arcTo.html)
  17946. *
  17947. * 需要基础库: `2.11.0`
  17948. *
  17949. * 在插件中使用:不支持
  17950. *
  17951. * 通过给定控制点添加一段圆弧路径。 */
  17952. arcTo(
  17953. /** 第一个控制点横坐标。 */
  17954. x1: number,
  17955. /** 第一个控制点纵坐标。 */
  17956. y1: number,
  17957. /** 第二个控制点横坐标。 */
  17958. x2: number,
  17959. /** 第二个控制点纵坐标。 */
  17960. y2: number,
  17961. /** 圆形半径,必须为非负数。 */
  17962. radius: number
  17963. ): void
  17964. /** [Path2D.bezierCurveTo(number cp1x, number cp1y, number cp2x, number cp2y, number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.bezierCurveTo.html)
  17965. *
  17966. * 需要基础库: `2.11.0`
  17967. *
  17968. * 在插件中使用:不支持
  17969. *
  17970. * 添加三次贝塞尔曲线路径。 */
  17971. bezierCurveTo(
  17972. /** 第一个控制点横坐标。 */
  17973. cp1x: number,
  17974. /** 第一个控制点纵坐标。 */
  17975. cp1y: number,
  17976. /** 第二个控制点横坐标。 */
  17977. cp2x: number,
  17978. /** 第二个控制点纵坐标。 */
  17979. cp2y: number,
  17980. /** 结束点横坐标。 */
  17981. x: number,
  17982. /** 结束点纵坐标。 */
  17983. y: number
  17984. ): void
  17985. /** [Path2D.closePath()](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.closePath.html)
  17986. *
  17987. * 需要基础库: `2.11.0`
  17988. *
  17989. * 在插件中使用:不支持
  17990. *
  17991. * 闭合路径到起点。 */
  17992. closePath(): void
  17993. /** [Path2D.ellipse(number x, number y, number radiusX, number radiusY, number rotation, number startAngle, number endAngle, boolean counterclockwise)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.ellipse.html)
  17994. *
  17995. * 需要基础库: `2.11.0`
  17996. *
  17997. * 在插件中使用:不支持
  17998. *
  17999. * 添加椭圆弧路径 */
  18000. ellipse(
  18001. /** 椭圆圆心横坐标。 */
  18002. x: number,
  18003. /** 椭圆圆心纵坐标。 */
  18004. y: number,
  18005. /** 椭圆长轴半径,必须为非负数。 */
  18006. radiusX: number,
  18007. /** 椭圆短轴半径,必须为非负数。 */
  18008. radiusY: number,
  18009. /** 椭圆旋转角度。 */
  18010. rotation: number,
  18011. /** 圆弧开始角度。 */
  18012. startAngle: number,
  18013. /** 圆弧结束角度。 */
  18014. endAngle: number,
  18015. /** 是否逆时针绘制。如果传 true, 则会从 endAngle 开始绘制到 startAngle。 */
  18016. counterclockwise?: boolean
  18017. ): void
  18018. /** [Path2D.lineTo(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.lineTo.html)
  18019. *
  18020. * 需要基础库: `2.11.0`
  18021. *
  18022. * 在插件中使用:不支持
  18023. *
  18024. * 添加直线路径 */
  18025. lineTo(
  18026. /** 结束点横坐标。 */
  18027. x: number,
  18028. /** 结束点纵坐标。 */
  18029. y: number
  18030. ): void
  18031. /** [Path2D.moveTo(number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.moveTo.html)
  18032. *
  18033. * 需要基础库: `2.11.0`
  18034. *
  18035. * 在插件中使用:不支持
  18036. *
  18037. * 移动路径开始点 */
  18038. moveTo(
  18039. /** 横坐标。 */
  18040. x: number,
  18041. /** 纵坐标。 */
  18042. y: number
  18043. ): void
  18044. /** [Path2D.quadraticCurveTo(number cpx, number cpy, number x, number y)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.quadraticCurveTo.html)
  18045. *
  18046. * 需要基础库: `2.11.0`
  18047. *
  18048. * 在插件中使用:不支持
  18049. *
  18050. * 添加二次贝塞尔曲线路径。 */
  18051. quadraticCurveTo(
  18052. /** 控制点横坐标。 */
  18053. cpx: number,
  18054. /** 控制点纵坐标。 */
  18055. cpy: number,
  18056. /** 结束点横坐标。 */
  18057. x: number,
  18058. /** 结束点纵坐标。 */
  18059. y: number
  18060. ): void
  18061. /** [Path2D.rect(number x, number y, number width, number height)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/Path2D.rect.html)
  18062. *
  18063. * 需要基础库: `2.11.0`
  18064. *
  18065. * 在插件中使用:不支持
  18066. *
  18067. * 添加方形路径。 */
  18068. rect(
  18069. /** 开始点横坐标。 */
  18070. x: number,
  18071. /** 开始点纵坐标。 */
  18072. y: number,
  18073. /** 方形宽度,正数向右,负数向左。 */
  18074. width: number,
  18075. /** 方形高度,正数向下,负数向上。 */
  18076. height: number
  18077. ): void
  18078. }
  18079. interface Performance {
  18080. /** [Array.&lt;[PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html)&gt; Performance.getEntries()](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.getEntries.html)
  18081. *
  18082. * 需要基础库: `2.11.0`
  18083. *
  18084. * 在插件中使用:不支持
  18085. *
  18086. * 该方法返回当前缓冲区中的所有性能数据 */
  18087. getEntries(): PerformanceEntry[]
  18088. /** [Array.&lt;[PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html)&gt; Performance.getEntriesByName(string name, string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.getEntriesByName.html)
  18089. *
  18090. * 需要基础库: `2.11.0`
  18091. *
  18092. * 在插件中使用:不支持
  18093. *
  18094. * 获取当前缓冲区中所有名称为 [name] 且类型为 [entryType] 的性能数据 */
  18095. getEntriesByName(
  18096. /** 名称 */
  18097. name: string,
  18098. /** 类型 */
  18099. entryType?: string
  18100. ): PerformanceEntry[]
  18101. /** [Array.&lt;[PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html)&gt; Performance.getEntriesByType(string entryType)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.getEntriesByType.html)
  18102. *
  18103. * 需要基础库: `2.11.0`
  18104. *
  18105. * 在插件中使用:不支持
  18106. *
  18107. * 获取当前缓冲区中所有类型为 [entryType] 的性能数据 */
  18108. getEntriesByType(
  18109. /** 类型 */
  18110. entryType: string
  18111. ): PerformanceEntry[]
  18112. /** [Performance.setBufferSize(number size)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.setBufferSize.html)
  18113. *
  18114. * 需要基础库: `2.11.0`
  18115. *
  18116. * 在插件中使用:不支持
  18117. *
  18118. * 设置缓冲区大小,默认缓冲 30 条性能数据 */
  18119. setBufferSize(size: number): void
  18120. /** [[PerformanceObserver](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceObserver.html) Performance.createObserver(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.createObserver.html)
  18121. *
  18122. * 需要基础库: `2.11.0`
  18123. *
  18124. * 在插件中使用:不支持
  18125. *
  18126. * 创建全局性能事件监听器 */
  18127. createObserver(
  18128. /** 回调函数 */
  18129. callback: (...args: any[]) => any
  18130. ): PerformanceObserver
  18131. }
  18132. interface PreDownloadSubpackageTask {
  18133. /** [PreDownloadSubpackageTask.onProgressUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/subpackage/PreDownloadSubpackageTask.onProgressUpdate.html)
  18134. *
  18135. * 需要基础库: `2.27.3`
  18136. *
  18137. * 在插件中使用:不支持
  18138. *
  18139. * 监听分包加载进度变化事件 */
  18140. onProgressUpdate(
  18141. /** 分包加载进度变化事件的监听函数 */
  18142. listener: PreDownloadSubpackageTaskOnProgressUpdateCallback
  18143. ): void
  18144. }
  18145. interface RealtimeLogManager {
  18146. /** [Object RealtimeLogManager.getCurrentState()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.getCurrentState.html)
  18147. *
  18148. * 需要基础库: `2.19.4`
  18149. *
  18150. * 在插件中使用:不支持
  18151. *
  18152. * 实时日志会将一定时间间隔内缓存的日志聚合上报,如果该时间内缓存的内容超出限制,则会被丢弃。此方法可以获取当前缓存剩余空间。
  18153. *
  18154. * > 注意:基础库内部在对日志进行上报时会补充一些结构化数据,如果遇到上报溢出的情况也会补充警告日志,所以此方法获取到的当前占用信息会比预期的大一些。 */
  18155. getCurrentState(): CurrentState
  18156. /** [RealtimeLogManager.addFilterMsg(string msg)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.addFilterMsg.html)
  18157. *
  18158. * 需要基础库: `2.8.1`
  18159. *
  18160. * 在插件中使用:不支持
  18161. *
  18162. * 添加过滤关键字,暂不支持在插件使用 */
  18163. addFilterMsg(
  18164. /** 是setFilterMsg的添加接口。用于设置多个过滤关键字。 */
  18165. msg: string
  18166. ): void
  18167. /** [RealtimeLogManager.error()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.error.html)
  18168. *
  18169. * 需要基础库: `2.7.1`
  18170. *
  18171. * 在插件中使用:不支持
  18172. *
  18173. * 写 error 日志,暂不支持在插件使用 */
  18174. error(
  18175. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过5Kb */
  18176. ...args: any[]
  18177. ): void
  18178. /** [RealtimeLogManager.in(Page pageInstance)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.in.html)
  18179. *
  18180. * 需要基础库: `2.9.1`
  18181. *
  18182. * 在插件中使用:不支持
  18183. *
  18184. * 设置实时日志page参数所在的页面,暂不支持在插件使用 */
  18185. in(
  18186. /** page实例 */
  18187. pageInstance: Page.TrivialInstance
  18188. ): void
  18189. /** [RealtimeLogManager.info()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.info.html)
  18190. *
  18191. * 需要基础库: `2.7.1`
  18192. *
  18193. * 在插件中使用:不支持
  18194. *
  18195. * 写 info 日志,暂不支持在插件使用 */
  18196. info(
  18197. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过5Kb */
  18198. ...args: any[]
  18199. ): void
  18200. /** [RealtimeLogManager.setFilterMsg(string msg)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.setFilterMsg.html)
  18201. *
  18202. * 需要基础库: `2.7.3`
  18203. *
  18204. * 在插件中使用:不支持
  18205. *
  18206. * 设置过滤关键字,暂不支持在插件使用 */
  18207. setFilterMsg(
  18208. /** 过滤关键字,最多不超过1Kb,可以在小程序管理后台根据设置的内容搜索得到对应的日志。 */
  18209. msg: string
  18210. ): void
  18211. /** [RealtimeLogManager.warn()](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.warn.html)
  18212. *
  18213. * 需要基础库: `2.7.1`
  18214. *
  18215. * 在插件中使用:不支持
  18216. *
  18217. * 写 warn 日志,暂不支持在插件使用 */
  18218. warn(
  18219. /** 日志内容,可以有任意多个。每次调用的参数的总大小不超过5Kb */
  18220. ...args: any[]
  18221. ): void
  18222. /** [[RealtimeTagLogManager](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.html) RealtimeLogManager.tag(string tagName)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.tag.html)
  18223. *
  18224. * 需要基础库: `2.16.0`
  18225. *
  18226. * 在插件中使用:需要基础库 `2.16.0`
  18227. *
  18228. * 获取给定标签的日志管理器实例,目前只支持在插件使用 */
  18229. tag(
  18230. /** 标签名 */
  18231. tagName: string
  18232. ): RealtimeTagLogManager
  18233. }
  18234. interface RealtimeTagLogManager {
  18235. /** [RealtimeTagLogManager.addFilterMsg(string msg)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.addFilterMsg.html)
  18236. *
  18237. * 需要基础库: `2.16.0`
  18238. *
  18239. * 在插件中使用:需要基础库 `2.16.0`
  18240. *
  18241. * 添加过滤关键字 */
  18242. addFilterMsg(
  18243. /** 是setFilterMsg的添加接口。用于设置多个过滤关键字。 */
  18244. msg: string
  18245. ): void
  18246. /** [RealtimeTagLogManager.error(string key, Object|Array.&lt;any&gt;|number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.error.html)
  18247. *
  18248. * 需要基础库: `2.16.0`
  18249. *
  18250. * 在插件中使用:需要基础库 `2.16.0`
  18251. *
  18252. * 写 error 日志 */
  18253. error(
  18254. /** 日志的 key */
  18255. key: string,
  18256. /** 日志的值,每次调用的参数的总大小不超过5Kb */
  18257. value: IAnyObject | any[] | number | string
  18258. ): void
  18259. /** [RealtimeTagLogManager.info(string key, Object|Array.&lt;any&gt;|number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.info.html)
  18260. *
  18261. * 需要基础库: `2.16.0`
  18262. *
  18263. * 在插件中使用:需要基础库 `2.16.0`
  18264. *
  18265. * 写 info 日志 */
  18266. info(
  18267. /** 日志的 key */
  18268. key: string,
  18269. /** 日志的值,每次调用的参数的总大小不超过5Kb */
  18270. value: IAnyObject | any[] | number | string
  18271. ): void
  18272. /** [RealtimeTagLogManager.setFilterMsg(string msg)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.setFilterMsg.html)
  18273. *
  18274. * 需要基础库: `2.16.0`
  18275. *
  18276. * 在插件中使用:需要基础库 `2.16.0`
  18277. *
  18278. * 设置过滤关键字 */
  18279. setFilterMsg(
  18280. /** 过滤关键字,最多不超过1Kb,可以在小程序管理后台根据设置的内容搜索得到对应的日志。 */
  18281. msg: string
  18282. ): void
  18283. /** [RealtimeTagLogManager.warn(string key, Object|Array.&lt;any&gt;|number|string value)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.warn.html)
  18284. *
  18285. * 需要基础库: `2.16.0`
  18286. *
  18287. * 在插件中使用:需要基础库 `2.16.0`
  18288. *
  18289. * 写 warn 日志 */
  18290. warn(
  18291. /** 日志的 key */
  18292. key: string,
  18293. /** 日志的值,每次调用的参数的总大小不超过5Kb */
  18294. value: IAnyObject | any[] | number | string
  18295. ): void
  18296. }
  18297. interface RecorderManager {
  18298. /** [RecorderManager.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onError.html)
  18299. *
  18300. * 在插件中使用:支持
  18301. *
  18302. * 监听录音错误事件 */
  18303. onError(
  18304. /** 录音错误事件的监听函数 */
  18305. listener: UDPSocketOnErrorCallback
  18306. ): void
  18307. /** [RecorderManager.onFrameRecorded(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onFrameRecorded.html)
  18308. *
  18309. * 在插件中使用:支持
  18310. *
  18311. * 监听已录制完指定帧大小的文件事件。如果设置了 frameSize,则会回调此事件。 */
  18312. onFrameRecorded(
  18313. /** 已录制完指定帧大小的文件事件的监听函数 */
  18314. listener: OnFrameRecordedCallback
  18315. ): void
  18316. /** [RecorderManager.onInterruptionBegin(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onInterruptionBegin.html)
  18317. *
  18318. * 需要基础库: `2.3.0`
  18319. *
  18320. * 在插件中使用:支持
  18321. *
  18322. * 监听录音因为受到系统占用而被中断开始事件。以下场景会触发此事件:微信语音聊天、微信视频聊天。此事件触发后,录音会被暂停。pause 事件在此事件后触发 */
  18323. onInterruptionBegin(
  18324. /** 录音因为受到系统占用而被中断开始事件的监听函数 */
  18325. listener: OnInterruptionBeginCallback
  18326. ): void
  18327. /** [RecorderManager.onInterruptionEnd(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onInterruptionEnd.html)
  18328. *
  18329. * 需要基础库: `2.3.0`
  18330. *
  18331. * 在插件中使用:支持
  18332. *
  18333. * 监听录音中断结束事件。在收到 interruptionBegin 事件之后,小程序内所有录音会暂停,收到此事件之后才可再次录音成功。 */
  18334. onInterruptionEnd(
  18335. /** 录音中断结束事件的监听函数 */
  18336. listener: OnInterruptionEndCallback
  18337. ): void
  18338. /** [RecorderManager.onPause(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onPause.html)
  18339. *
  18340. * 在插件中使用:支持
  18341. *
  18342. * 监听录音暂停事件 */
  18343. onPause(
  18344. /** 录音暂停事件的监听函数 */
  18345. listener: OnPauseCallback
  18346. ): void
  18347. /** [RecorderManager.onResume(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onResume.html)
  18348. *
  18349. * 在插件中使用:支持
  18350. *
  18351. * 监听录音继续事件 */
  18352. onResume(
  18353. /** 录音继续事件的监听函数 */
  18354. listener: OnResumeCallback
  18355. ): void
  18356. /** [RecorderManager.onStart(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onStart.html)
  18357. *
  18358. * 在插件中使用:支持
  18359. *
  18360. * 监听录音开始事件 */
  18361. onStart(
  18362. /** 录音开始事件的监听函数 */
  18363. listener: OnStartCallback
  18364. ): void
  18365. /** [RecorderManager.onStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.onStop.html)
  18366. *
  18367. * 在插件中使用:支持
  18368. *
  18369. * 监听录音结束事件 */
  18370. onStop(
  18371. /** 录音结束事件的监听函数 */
  18372. listener: RecorderManagerOnStopCallback
  18373. ): void
  18374. /** [RecorderManager.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.pause.html)
  18375. *
  18376. * 在插件中使用:支持
  18377. *
  18378. * 暂停录音 */
  18379. pause(): void
  18380. /** [RecorderManager.resume()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.resume.html)
  18381. *
  18382. * 在插件中使用:支持
  18383. *
  18384. * 继续录音 */
  18385. resume(): void
  18386. /** [RecorderManager.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.start.html)
  18387. *
  18388. * 在插件中使用:支持
  18389. *
  18390. * 开始录音
  18391. *
  18392. * **采样率与编码码率限制**
  18393. *
  18394. * 每种采样率有对应的编码码率范围有效值,设置不合法的采样率或编码码率会导致录音失败,具体对应关系如下表。
  18395. *
  18396. * | 采样率 | 编码码率 |
  18397. * | ------ | -------------- |
  18398. * | 8000 | 16000 ~ 48000 |
  18399. * | 11025 | 16000 ~ 48000 |
  18400. * | 12000 | 24000 ~ 64000 |
  18401. * | 16000 | 24000 ~ 96000 |
  18402. * | 22050 | 32000 ~ 128000 |
  18403. * | 24000 | 32000 ~ 128000 |
  18404. * | 32000 | 48000 ~ 192000 |
  18405. * | 44100 | 64000 ~ 320000 |
  18406. * | 48000 | 64000 ~ 320000 | */
  18407. start(option: RecorderManagerStartOption): void
  18408. /** [RecorderManager.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/RecorderManager.stop.html)
  18409. *
  18410. * 在插件中使用:支持
  18411. *
  18412. * 停止录音 */
  18413. stop(): void
  18414. }
  18415. interface RequestTask {
  18416. /** [RequestTask.abort()](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.abort.html)
  18417. *
  18418. * 需要基础库: `1.4.0`
  18419. *
  18420. * 在插件中使用:支持
  18421. *
  18422. * 中断请求任务 */
  18423. abort(): void
  18424. /** [RequestTask.offChunkReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.offChunkReceived.html)
  18425. *
  18426. * 需要基础库: `2.20.1`
  18427. *
  18428. * 在插件中使用:支持
  18429. *
  18430. * 移除 Transfer-Encoding Chunk Received 事件的监听函数
  18431. *
  18432. * **示例代码**
  18433. *
  18434. * ```js
  18435. const listener = function (res) { console.log(res) }
  18436. RequestTask.onChunkReceived(listener)
  18437. RequestTask.offChunkReceived(listener) // 需传入与监听时同一个的函数对象
  18438. ``` */
  18439. offChunkReceived(
  18440. /** onChunkReceived 传入的监听函数。不传此参数则移除所有监听函数。 */
  18441. listener?: OffChunkReceivedCallback
  18442. ): void
  18443. /** [RequestTask.offHeadersReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.offHeadersReceived.html)
  18444. *
  18445. * 需要基础库: `2.1.0`
  18446. *
  18447. * 在插件中使用:支持
  18448. *
  18449. * 移除 HTTP Response Header 事件的监听函数
  18450. *
  18451. * **示例代码**
  18452. *
  18453. * ```js
  18454. const listener = function (res) { console.log(res) }
  18455. RequestTask.onHeadersReceived(listener)
  18456. RequestTask.offHeadersReceived(listener) // 需传入与监听时同一个的函数对象
  18457. ``` */
  18458. offHeadersReceived(
  18459. /** onHeadersReceived 传入的监听函数。不传此参数则移除所有监听函数。 */
  18460. listener?: RequestTaskOffHeadersReceivedCallback
  18461. ): void
  18462. /** [RequestTask.onChunkReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.onChunkReceived.html)
  18463. *
  18464. * 需要基础库: `2.20.1`
  18465. *
  18466. * 在插件中使用:支持
  18467. *
  18468. * 监听 Transfer-Encoding Chunk Received 事件。当接收到新的chunk时触发。 */
  18469. onChunkReceived(
  18470. /** Transfer-Encoding Chunk Received 事件的监听函数 */
  18471. listener: OnChunkReceivedCallback
  18472. ): void
  18473. /** [RequestTask.onHeadersReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/request/RequestTask.onHeadersReceived.html)
  18474. *
  18475. * 需要基础库: `2.1.0`
  18476. *
  18477. * 在插件中使用:支持
  18478. *
  18479. * 监听 HTTP Response Header 事件。会比请求完成事件更早 */
  18480. onHeadersReceived(
  18481. /** HTTP Response Header 事件的监听函数 */
  18482. listener: RequestTaskOnHeadersReceivedCallback
  18483. ): void
  18484. }
  18485. interface RewardedVideoAd {
  18486. /** [Promise RewardedVideoAd.load()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.load.html)
  18487. *
  18488. * 在插件中使用:不支持
  18489. *
  18490. * 加载激励视频广告。 */
  18491. load(): Promise<any>
  18492. /** [Promise RewardedVideoAd.show()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.show.html)
  18493. *
  18494. * 在插件中使用:不支持
  18495. *
  18496. * 显示激励视频广告。激励视频广告将从屏幕下方推入。 */
  18497. show(): Promise<any>
  18498. /** [RewardedVideoAd.destroy()](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.destroy.html)
  18499. *
  18500. * 需要基础库: `2.8.0`
  18501. *
  18502. * 在插件中使用:不支持
  18503. *
  18504. * 销毁激励视频广告实例。 */
  18505. destroy(): void
  18506. /** [RewardedVideoAd.offClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offClose.html)
  18507. *
  18508. * 在插件中使用:不支持
  18509. *
  18510. * 移除用户点击 `关闭广告` 按钮的事件的监听函数
  18511. *
  18512. * **示例代码**
  18513. *
  18514. * ```js
  18515. const listener = function (res) { console.log(res) }
  18516. RewardedVideoAd.onClose(listener)
  18517. RewardedVideoAd.offClose(listener) // 需传入与监听时同一个的函数对象
  18518. ``` */
  18519. offClose(
  18520. /** onClose 传入的监听函数。不传此参数则移除所有监听函数。 */
  18521. listener?: RewardedVideoAdOffCloseCallback
  18522. ): void
  18523. /** [RewardedVideoAd.offError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offError.html)
  18524. *
  18525. * 在插件中使用:不支持
  18526. *
  18527. * 移除激励视频错误事件的监听函数
  18528. *
  18529. * **示例代码**
  18530. *
  18531. * ```js
  18532. const listener = function (res) { console.log(res) }
  18533. RewardedVideoAd.onError(listener)
  18534. RewardedVideoAd.offError(listener) // 需传入与监听时同一个的函数对象
  18535. ``` */
  18536. offError(
  18537. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  18538. listener?: RewardedVideoAdOffErrorCallback
  18539. ): void
  18540. /** [RewardedVideoAd.offLoad(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offLoad.html)
  18541. *
  18542. * 在插件中使用:不支持
  18543. *
  18544. * 移除激励视频广告加载事件的监听函数
  18545. *
  18546. * **示例代码**
  18547. *
  18548. * ```js
  18549. const listener = function (res) { console.log(res) }
  18550. RewardedVideoAd.onLoad(listener)
  18551. RewardedVideoAd.offLoad(listener) // 需传入与监听时同一个的函数对象
  18552. ``` */
  18553. offLoad(
  18554. /** onLoad 传入的监听函数。不传此参数则移除所有监听函数。 */
  18555. listener?: OffLoadCallback
  18556. ): void
  18557. /** [RewardedVideoAd.onClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onClose.html)
  18558. *
  18559. * 在插件中使用:不支持
  18560. *
  18561. * 监听用户点击 `关闭广告` 按钮的事件。 */
  18562. onClose(
  18563. /** 用户点击 `关闭广告` 按钮的事件的监听函数 */
  18564. listener: RewardedVideoAdOnCloseCallback
  18565. ): void
  18566. /** [RewardedVideoAd.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onError.html)
  18567. *
  18568. * 在插件中使用:不支持
  18569. *
  18570. * 监听激励视频错误事件。
  18571. *
  18572. * **错误码信息与解决方案表**
  18573. *
  18574. * 错误码是通过onError获取到的错误信息。调试期间,可以通过异常返回来捕获信息。
  18575. * 在小程序发布上线之后,如果遇到异常问题,可以在[“运维中心“](https://mp.weixin.qq.com/)里面搜寻错误日志,还可以针对异常返回加上适当的监控信息。
  18576. *
  18577. * | 代码 | 异常情况 | 理由 | 解决方案 |
  18578. * | ------ | -------------- | --------------- | -------------------------- |
  18579. * | 1000 | 后端错误调用失败 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。 |
  18580. * | 1001 | 参数错误 | 使用方法错误 | 可以前往developers.weixin.qq.com确认具体教程(小程序和小游戏分别有各自的教程,可以在顶部选项中,“设计”一栏的右侧进行切换。|
  18581. * | 1002 | 广告单元无效 | 可能是拼写错误、或者误用了其他APP的广告ID | 请重新前往mp.weixin.qq.com确认广告位ID。 |
  18582. * | 1003 | 内部错误 | 该项错误不是开发者的异常情况 | 一般情况下忽略一段时间即可恢复。|
  18583. * | 1004 | 无适合的广告 | 广告不是每一次都会出现,这次没有出现可能是由于该用户不适合浏览广告 | 属于正常情况,且开发者需要针对这种情况做形态上的兼容。 |
  18584. * | 1005 | 广告组件审核中 | 你的广告正在被审核,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。|
  18585. * | 1006 | 广告组件被驳回 | 你的广告审核失败,无法展现广告 | 请前往mp.weixin.qq.com确认审核状态,且开发者需要针对这种情况做形态上的兼容。|
  18586. * | 1007 | 广告组件被封禁 | 你的广告能力已经被封禁,封禁期间无法展现广告 | 请前往mp.weixin.qq.com确认小程序广告封禁状态。 |
  18587. * | 1008 | 广告单元已关闭 | 该广告位的广告能力已经被关闭 | 请前往mp.weixin.qq.com重新打开对应广告位的展现。| */
  18588. onError(
  18589. /** 激励视频错误事件的监听函数 */
  18590. listener: RewardedVideoAdOnErrorCallback
  18591. ): void
  18592. /** [RewardedVideoAd.onLoad(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onLoad.html)
  18593. *
  18594. * 在插件中使用:不支持
  18595. *
  18596. * 监听激励视频广告加载事件。 */
  18597. onLoad(
  18598. /** 激励视频广告加载事件的监听函数 */
  18599. listener: OnLoadCallback
  18600. ): void
  18601. }
  18602. interface Router {
  18603. /** [router.addRouteBuilder(string routeType, function routeBuilder)](https://developers.weixin.qq.com/miniprogram/dev/api/route/router/base/router.addRouteBuilder.html)
  18604. *
  18605. * 在插件中使用:不支持
  18606. *
  18607. * 添加自定义路由配置
  18608. *
  18609. * **自定义路由示例**
  18610. *
  18611. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/y1IbQpmA7wGZ)
  18612. *
  18613. * ```js
  18614. // 定义自定义效果,从右侧推入
  18615. const slideRouteBuilder = (customRouteContext) => {
  18616. const { primaryAnimation } = customRouteContext
  18617. const handlePrimaryAnimation = () => {
  18618. 'worklet'
  18619. const transX = windowWidth * (1 - primaryAnimation.value)
  18620. return {
  18621. transform: `translateX(${transX}px)`,
  18622. }
  18623. }
  18624. return {
  18625. handlePrimaryAnimation
  18626. }
  18627. }
  18628. wx.router.addRouteBuilder('slide', slideRouteBuilder)
  18629. // 使用自定义路由
  18630. wx.navigateTo({
  18631. url: 'xxx',
  18632. routeType: 'slide'
  18633. })
  18634. ``` */
  18635. addRouteBuilder(
  18636. /** 路由类型 */
  18637. routeType: string,
  18638. /** [路由动画定义函数](#) */
  18639. routeBuilder: CustomRouteBuilder
  18640. ): void
  18641. /** [router.getRouteContext(Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/route/router/base/router.getRouteContext.html)
  18642. *
  18643. * 在插件中使用:不支持
  18644. *
  18645. * 获取页面对应的自定义路由上下文对象 */
  18646. getRouteContext(
  18647. /** 页面/自定义组件实例 */
  18648. component: Component.TrivialInstance | Page.TrivialInstance
  18649. ): void
  18650. /** [router.removeRouteBuilder(string routeType)](https://developers.weixin.qq.com/miniprogram/dev/api/route/router/base/router.removeRouteBuilder.html)
  18651. *
  18652. * 在插件中使用:不支持
  18653. *
  18654. * 移除自定义路由配置 */
  18655. removeRouteBuilder(
  18656. /** 路由类型 */
  18657. routeType: string
  18658. ): void
  18659. }
  18660. interface SelectorQuery {
  18661. /** [[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)
  18662. *
  18663. * 在插件中使用:支持
  18664. *
  18665. * 执行所有的请求。请求结果按请求次序构成数组,在callback的第一个参数中返回。 */
  18666. exec(
  18667. /** 回调函数 */
  18668. callback?: (...args: any[]) => any
  18669. ): NodesRef
  18670. /** [[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)
  18671. *
  18672. * 在插件中使用:支持
  18673. *
  18674. * 在当前页面下选择第一个匹配选择器 `selector` 的节点。返回一个 `NodesRef` 对象实例,可以用于获取节点信息。
  18675. *
  18676. * **selector 语法**
  18677. *
  18678. * selector类似于 CSS 的选择器,但仅支持下列语法。
  18679. *
  18680. * - ID选择器:#the-id
  18681. * - class选择器(可以连续指定多个):.a-class.another-class
  18682. * - 子元素选择器:.the-parent > .the-child
  18683. * - 后代选择器:.the-ancestor .the-descendant
  18684. * - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
  18685. * - 多选择器的并集:#a-node, .some-other-nodes */
  18686. select(
  18687. /** 选择器 */
  18688. selector: string
  18689. ): NodesRef
  18690. /** [[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)
  18691. *
  18692. * 在插件中使用:支持
  18693. *
  18694. * 在当前页面下选择匹配选择器 selector 的所有节点。
  18695. *
  18696. * **selector 语法**
  18697. *
  18698. * selector类似于 CSS 的选择器,但仅支持下列语法。
  18699. *
  18700. * - ID选择器:#the-id
  18701. * - class选择器(可以连续指定多个):.a-class.another-class
  18702. * - 子元素选择器:.the-parent > .the-child
  18703. * - 后代选择器:.the-ancestor .the-descendant
  18704. * - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
  18705. * - 多选择器的并集:#a-node, .some-other-nodes */
  18706. selectAll(
  18707. /** 选择器 */
  18708. selector: string
  18709. ): NodesRef
  18710. /** [[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)
  18711. *
  18712. * 在插件中使用:支持
  18713. *
  18714. * 选择显示区域。可用于获取显示区域的尺寸、滚动位置等信息。 */
  18715. selectViewport(): NodesRef
  18716. /** [[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)
  18717. *
  18718. * 需要基础库: `1.6.0`
  18719. *
  18720. * 在插件中使用:支持
  18721. *
  18722. * 将选择器的选取范围更改为自定义组件 `component` 内。(初始时,选择器仅选取页面范围的节点,不会选取任何自定义组件中的节点)。
  18723. *
  18724. * **示例代码**
  18725. *
  18726. * ```js
  18727. Component({
  18728. queryMultipleNodes (){
  18729. const query = wx.createSelectorQuery().in(this)
  18730. query.select('#the-id').boundingClientRect(function(res){
  18731. res.top // 这个组件内 #the-id 节点的上边界坐标
  18732. }).exec()
  18733. }
  18734. })
  18735. ``` */
  18736. in(
  18737. /** 自定义组件实例 */
  18738. component: Component.TrivialInstance | Page.TrivialInstance
  18739. ): SelectorQuery
  18740. }
  18741. interface SocketTask {
  18742. /** [SocketTask.close(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.close.html)
  18743. *
  18744. * 在插件中使用:支持
  18745. *
  18746. * 关闭 WebSocket 连接 */
  18747. close(option: SocketTaskCloseOption): void
  18748. /** [SocketTask.onClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onClose.html)
  18749. *
  18750. * 在插件中使用:支持
  18751. *
  18752. * 监听 WebSocket 连接关闭事件 */
  18753. onClose(
  18754. /** WebSocket 连接关闭事件的监听函数 */
  18755. listener: SocketTaskOnCloseCallback
  18756. ): void
  18757. /** [SocketTask.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onError.html)
  18758. *
  18759. * 在插件中使用:支持
  18760. *
  18761. * 监听 WebSocket 错误事件 */
  18762. onError(
  18763. /** WebSocket 错误事件的监听函数 */
  18764. listener: UDPSocketOnErrorCallback
  18765. ): void
  18766. /** [SocketTask.onMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onMessage.html)
  18767. *
  18768. * 在插件中使用:支持
  18769. *
  18770. * 监听 WebSocket 接收到服务器的消息事件 */
  18771. onMessage(
  18772. /** WebSocket 接收到服务器的消息事件的监听函数 */
  18773. listener: SocketTaskOnMessageCallback
  18774. ): void
  18775. /** [SocketTask.onOpen(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.onOpen.html)
  18776. *
  18777. * 在插件中使用:支持
  18778. *
  18779. * 监听 WebSocket 连接打开事件 */
  18780. onOpen(
  18781. /** WebSocket 连接打开事件的监听函数 */
  18782. listener: OnOpenCallback
  18783. ): void
  18784. /** [SocketTask.send(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.send.html)
  18785. *
  18786. * 在插件中使用:支持
  18787. *
  18788. * 通过 WebSocket 连接发送数据 */
  18789. send(option: SocketTaskSendOption): void
  18790. }
  18791. interface TCPSocket {
  18792. /** [TCPSocket.bindWifi(Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.bindWifi.html)
  18793. *
  18794. * 需要基础库: `2.25.0`
  18795. *
  18796. * 在插件中使用:不支持
  18797. *
  18798. * 将 TCP Socket 绑定到当前 wifi 网络,成功后会触发 onBindWifi 事件(仅安卓支持) */
  18799. bindWifi(options: BindWifiOption): void
  18800. /** [TCPSocket.close()](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.close.html)
  18801. *
  18802. * 在插件中使用:不支持
  18803. *
  18804. * 关闭连接 */
  18805. close(): void
  18806. /** [TCPSocket.connect(Object options)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.connect.html)
  18807. *
  18808. * 在插件中使用:不支持
  18809. *
  18810. * 在给定的套接字上启动连接 */
  18811. connect(options: TCPSocketConnectOption): void
  18812. /** [TCPSocket.offBindWifi(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offBindWifi.html)
  18813. *
  18814. * 需要基础库: `2.25.0`
  18815. *
  18816. * 在插件中使用:不支持
  18817. *
  18818. * 移除当一个 socket 绑定当前 wifi 网络成功时触发该事件的监听函数
  18819. *
  18820. * **示例代码**
  18821. *
  18822. * ```js
  18823. const listener = function (res) { console.log(res) }
  18824. TCPSocket.onBindWifi(listener)
  18825. TCPSocket.offBindWifi(listener) // 需传入与监听时同一个的函数对象
  18826. ``` */
  18827. offBindWifi(
  18828. /** onBindWifi 传入的监听函数。不传此参数则移除所有监听函数。 */
  18829. listener?: OffBindWifiCallback
  18830. ): void
  18831. /** [TCPSocket.offClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offClose.html)
  18832. *
  18833. * 在插件中使用:不支持
  18834. *
  18835. * 移除一旦 socket 完全关闭就发出该事件的监听函数
  18836. *
  18837. * **示例代码**
  18838. *
  18839. * ```js
  18840. const listener = function (res) { console.log(res) }
  18841. TCPSocket.onClose(listener)
  18842. TCPSocket.offClose(listener) // 需传入与监听时同一个的函数对象
  18843. ``` */
  18844. offClose(
  18845. /** onClose 传入的监听函数。不传此参数则移除所有监听函数。 */
  18846. listener?: UDPSocketOffCloseCallback
  18847. ): void
  18848. /** [TCPSocket.offConnect(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offConnect.html)
  18849. *
  18850. * 在插件中使用:不支持
  18851. *
  18852. * 移除当一个 socket 连接成功建立的时候触发该事件的监听函数
  18853. *
  18854. * **示例代码**
  18855. *
  18856. * ```js
  18857. const listener = function (res) { console.log(res) }
  18858. TCPSocket.onConnect(listener)
  18859. TCPSocket.offConnect(listener) // 需传入与监听时同一个的函数对象
  18860. ``` */
  18861. offConnect(
  18862. /** onConnect 传入的监听函数。不传此参数则移除所有监听函数。 */
  18863. listener?: OffConnectCallback
  18864. ): void
  18865. /** [TCPSocket.offError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offError.html)
  18866. *
  18867. * 在插件中使用:不支持
  18868. *
  18869. * 移除当错误发生时触发的监听函数
  18870. *
  18871. * **示例代码**
  18872. *
  18873. * ```js
  18874. const listener = function (res) { console.log(res) }
  18875. TCPSocket.onError(listener)
  18876. TCPSocket.offError(listener) // 需传入与监听时同一个的函数对象
  18877. ``` */
  18878. offError(
  18879. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  18880. listener?: UDPSocketOffErrorCallback
  18881. ): void
  18882. /** [TCPSocket.offMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.offMessage.html)
  18883. *
  18884. * 在插件中使用:不支持
  18885. *
  18886. * 移除当接收到数据的时触发该事件的监听函数
  18887. *
  18888. * **示例代码**
  18889. *
  18890. * ```js
  18891. const listener = function (res) { console.log(res) }
  18892. TCPSocket.onMessage(listener)
  18893. TCPSocket.offMessage(listener) // 需传入与监听时同一个的函数对象
  18894. ``` */
  18895. offMessage(
  18896. /** onMessage 传入的监听函数。不传此参数则移除所有监听函数。 */
  18897. listener?: TCPSocketOffMessageCallback
  18898. ): void
  18899. /** [TCPSocket.onBindWifi(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onBindWifi.html)
  18900. *
  18901. * 需要基础库: `2.25.0`
  18902. *
  18903. * 在插件中使用:不支持
  18904. *
  18905. * 监听当一个 socket 绑定当前 wifi 网络成功时触发该事件 */
  18906. onBindWifi(
  18907. /** 当一个 socket 绑定当前 wifi 网络成功时触发该事件的监听函数 */
  18908. listener: OnBindWifiCallback
  18909. ): void
  18910. /** [TCPSocket.onClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onClose.html)
  18911. *
  18912. * 在插件中使用:不支持
  18913. *
  18914. * 监听一旦 socket 完全关闭就发出该事件 */
  18915. onClose(
  18916. /** 一旦 socket 完全关闭就发出该事件的监听函数 */
  18917. listener: UDPSocketOnCloseCallback
  18918. ): void
  18919. /** [TCPSocket.onConnect(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onConnect.html)
  18920. *
  18921. * 在插件中使用:不支持
  18922. *
  18923. * 监听当一个 socket 连接成功建立的时候触发该事件 */
  18924. onConnect(
  18925. /** 当一个 socket 连接成功建立的时候触发该事件的监听函数 */
  18926. listener: OnConnectCallback
  18927. ): void
  18928. /** [TCPSocket.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onError.html)
  18929. *
  18930. * 在插件中使用:不支持
  18931. *
  18932. * 监听当错误发生时触发 */
  18933. onError(
  18934. /** 的监听函数 */
  18935. listener: UDPSocketOnErrorCallback
  18936. ): void
  18937. /** [TCPSocket.onMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.onMessage.html)
  18938. *
  18939. * 在插件中使用:不支持
  18940. *
  18941. * 监听当接收到数据的时触发该事件 */
  18942. onMessage(
  18943. /** 当接收到数据的时触发该事件的监听函数 */
  18944. listener: TCPSocketOnMessageCallback
  18945. ): void
  18946. /** [TCPSocket.write(string|ArrayBuffer data)](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.write.html)
  18947. *
  18948. * 在插件中使用:不支持
  18949. *
  18950. * 在 socket 上发送数据 */
  18951. write(
  18952. /** 要发送的数据 */
  18953. data: string | ArrayBuffer
  18954. ): void
  18955. }
  18956. interface UDPSocket {
  18957. /** [UDPSocket.close()](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.close.html)
  18958. *
  18959. * 在插件中使用:需要基础库 `2.11.1`
  18960. *
  18961. * 关闭 UDP Socket 实例,相当于销毁。 在关闭之后,UDP Socket 实例不能再发送消息,每次调用 `UDPSocket.send` 将会触发错误事件,并且 message 事件回调函数也不会再也执行。在 `UDPSocket` 实例被创建后将被 Native 强引用,保证其不被 GC。在 `UDPSocket.close` 后将解除对其的强引用,让 UDPSocket 实例遵从 GC。 */
  18962. close(): void
  18963. /** [UDPSocket.connect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.connect.html)
  18964. *
  18965. * 需要基础库: `2.15.0`
  18966. *
  18967. * 在插件中使用:需要基础库 `2.11.1`
  18968. *
  18969. * 预先连接到指定的 IP 和 port,需要配合 write 方法一起使用 */
  18970. connect(option: UDPSocketConnectOption): void
  18971. /** [UDPSocket.offClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offClose.html)
  18972. *
  18973. * 在插件中使用:需要基础库 `2.11.1`
  18974. *
  18975. * 移除关闭事件的监听函数
  18976. *
  18977. * **示例代码**
  18978. *
  18979. * ```js
  18980. const listener = function (res) { console.log(res) }
  18981. UDPSocket.onClose(listener)
  18982. UDPSocket.offClose(listener) // 需传入与监听时同一个的函数对象
  18983. ``` */
  18984. offClose(
  18985. /** onClose 传入的监听函数。不传此参数则移除所有监听函数。 */
  18986. listener?: UDPSocketOffCloseCallback
  18987. ): void
  18988. /** [UDPSocket.offError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offError.html)
  18989. *
  18990. * 在插件中使用:需要基础库 `2.11.1`
  18991. *
  18992. * 移除错误事件的监听函数
  18993. *
  18994. * **示例代码**
  18995. *
  18996. * ```js
  18997. const listener = function (res) { console.log(res) }
  18998. UDPSocket.onError(listener)
  18999. UDPSocket.offError(listener) // 需传入与监听时同一个的函数对象
  19000. ``` */
  19001. offError(
  19002. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  19003. listener?: UDPSocketOffErrorCallback
  19004. ): void
  19005. /** [UDPSocket.offListening(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offListening.html)
  19006. *
  19007. * 在插件中使用:需要基础库 `2.11.1`
  19008. *
  19009. * 移除开始监听数据包消息的事件的监听函数
  19010. *
  19011. * **示例代码**
  19012. *
  19013. * ```js
  19014. const listener = function (res) { console.log(res) }
  19015. UDPSocket.onListening(listener)
  19016. UDPSocket.offListening(listener) // 需传入与监听时同一个的函数对象
  19017. ``` */
  19018. offListening(
  19019. /** onListening 传入的监听函数。不传此参数则移除所有监听函数。 */
  19020. listener?: OffListeningCallback
  19021. ): void
  19022. /** [UDPSocket.offMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.offMessage.html)
  19023. *
  19024. * 在插件中使用:需要基础库 `2.11.1`
  19025. *
  19026. * 移除收到消息的事件的监听函数
  19027. *
  19028. * **示例代码**
  19029. *
  19030. * ```js
  19031. const listener = function (res) { console.log(res) }
  19032. UDPSocket.onMessage(listener)
  19033. UDPSocket.offMessage(listener) // 需传入与监听时同一个的函数对象
  19034. ``` */
  19035. offMessage(
  19036. /** onMessage 传入的监听函数。不传此参数则移除所有监听函数。 */
  19037. listener?: UDPSocketOffMessageCallback
  19038. ): void
  19039. /** [UDPSocket.onClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onClose.html)
  19040. *
  19041. * 在插件中使用:需要基础库 `2.11.1`
  19042. *
  19043. * 监听关闭事件 */
  19044. onClose(
  19045. /** 关闭事件的监听函数 */
  19046. listener: UDPSocketOnCloseCallback
  19047. ): void
  19048. /** [UDPSocket.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onError.html)
  19049. *
  19050. * 在插件中使用:需要基础库 `2.11.1`
  19051. *
  19052. * 监听错误事件 */
  19053. onError(
  19054. /** 错误事件的监听函数 */
  19055. listener: UDPSocketOnErrorCallback
  19056. ): void
  19057. /** [UDPSocket.onListening(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onListening.html)
  19058. *
  19059. * 在插件中使用:需要基础库 `2.11.1`
  19060. *
  19061. * 监听开始监听数据包消息的事件 */
  19062. onListening(
  19063. /** 开始监听数据包消息的事件的监听函数 */
  19064. listener: OnListeningCallback
  19065. ): void
  19066. /** [UDPSocket.onMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.onMessage.html)
  19067. *
  19068. * 在插件中使用:需要基础库 `2.11.1`
  19069. *
  19070. * 监听收到消息的事件 */
  19071. onMessage(
  19072. /** 收到消息的事件的监听函数 */
  19073. listener: UDPSocketOnMessageCallback
  19074. ): void
  19075. /** [UDPSocket.send(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.send.html)
  19076. *
  19077. * 在插件中使用:需要基础库 `2.11.1`
  19078. *
  19079. * 向指定的 IP 和 port 发送消息。基础库 2.9.0 起支持广播 (指定地址为 255.255.255.255)。 */
  19080. send(option: UDPSocketSendOption): void
  19081. /** [UDPSocket.setTTL(number ttl)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.setTTL.html)
  19082. *
  19083. * 需要基础库: `2.18.0`
  19084. *
  19085. * 在插件中使用:支持
  19086. *
  19087. * 设置 IP_TTL 套接字选项,用于设置一个 IP 数据包传输时允许的最大跳步数 */
  19088. setTTL(
  19089. /** ttl 参数可以是 0 到 255 之间 */
  19090. ttl: number
  19091. ): void
  19092. /** [UDPSocket.write()](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.write.html)
  19093. *
  19094. * 需要基础库: `2.15.0`
  19095. *
  19096. * 在插件中使用:需要基础库 `2.11.1`
  19097. *
  19098. * 用法与 send 方法相同,如果没有预先调用 connect 则与 send 无差异(注意即使调用了 connect 也需要在本接口填入地址和端口参数) */
  19099. write(): void
  19100. /** [number UDPSocket.bind(number port)](https://developers.weixin.qq.com/miniprogram/dev/api/network/udp/UDPSocket.bind.html)
  19101. *
  19102. * 在插件中使用:需要基础库 `2.11.1`
  19103. *
  19104. * 绑定一个系统随机分配的可用端口,或绑定一个指定的端口号 */
  19105. bind(
  19106. /** 需要基础库: `2.9.0`
  19107. *
  19108. * 指定要绑定的端口号,不传则返回系统随机分配的可用端口 */
  19109. port?: number
  19110. ): number
  19111. }
  19112. interface UpdateManager {
  19113. /** [UpdateManager.applyUpdate()](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.applyUpdate.html)
  19114. *
  19115. * 在插件中使用:不支持
  19116. *
  19117. * 强制小程序重启并使用新版本。在小程序新版本下载完成后(即收到 `onUpdateReady` 回调)调用。
  19118. *
  19119. * **示例代码**
  19120. *
  19121. * [示例代码](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html#示例代码) */
  19122. applyUpdate(): void
  19123. /** [UpdateManager.onCheckForUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onCheckForUpdate.html)
  19124. *
  19125. * 在插件中使用:不支持
  19126. *
  19127. * 监听向微信后台请求检查更新结果事件。微信在小程序每次启动(包括热启动)时自动检查更新,不需由开发者主动触发。
  19128. *
  19129. * **示例代码**
  19130. *
  19131. * [示例代码](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html#示例代码) */
  19132. onCheckForUpdate(
  19133. /** 向微信后台请求检查更新结果事件的监听函数 */
  19134. listener: OnCheckForUpdateCallback
  19135. ): void
  19136. /** [UpdateManager.onUpdateFailed(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateFailed.html)
  19137. *
  19138. * 在插件中使用:不支持
  19139. *
  19140. * 监听小程序更新失败事件。小程序有新版本,客户端主动触发下载(无需开发者触发),下载失败(可能是网络原因等)后回调
  19141. *
  19142. * **示例代码**
  19143. *
  19144. * [示例代码](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html#示例代码) */
  19145. onUpdateFailed(
  19146. /** 小程序更新失败事件的监听函数 */
  19147. listener: OnUpdateFailedCallback
  19148. ): void
  19149. /** [UpdateManager.onUpdateReady(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.onUpdateReady.html)
  19150. *
  19151. * 在插件中使用:不支持
  19152. *
  19153. * 监听小程序有版本更新事件。客户端主动触发下载(无需开发者触发),下载成功后回调
  19154. *
  19155. * **示例代码**
  19156. *
  19157. * [示例代码](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html#示例代码) */
  19158. onUpdateReady(
  19159. /** 小程序有版本更新事件的监听函数 */
  19160. listener: OnUpdateReadyCallback
  19161. ): void
  19162. }
  19163. interface UploadTask {
  19164. /** [UploadTask.abort()](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.abort.html)
  19165. *
  19166. * 需要基础库: `1.4.0`
  19167. *
  19168. * 在插件中使用:支持
  19169. *
  19170. * 中断上传任务 */
  19171. abort(): void
  19172. /** [UploadTask.offHeadersReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.offHeadersReceived.html)
  19173. *
  19174. * 需要基础库: `2.1.0`
  19175. *
  19176. * 在插件中使用:支持
  19177. *
  19178. * 移除 HTTP Response Header 事件的监听函数
  19179. *
  19180. * **示例代码**
  19181. *
  19182. * ```js
  19183. const listener = function (res) { console.log(res) }
  19184. UploadTask.onHeadersReceived(listener)
  19185. UploadTask.offHeadersReceived(listener) // 需传入与监听时同一个的函数对象
  19186. ``` */
  19187. offHeadersReceived(
  19188. /** onHeadersReceived 传入的监听函数。不传此参数则移除所有监听函数。 */
  19189. listener?: DownloadTaskOffHeadersReceivedCallback
  19190. ): void
  19191. /** [UploadTask.offProgressUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.offProgressUpdate.html)
  19192. *
  19193. * 需要基础库: `2.1.0`
  19194. *
  19195. * 在插件中使用:支持
  19196. *
  19197. * 移除上传进度变化事件的监听函数
  19198. *
  19199. * **示例代码**
  19200. *
  19201. * ```js
  19202. const listener = function (res) { console.log(res) }
  19203. UploadTask.onProgressUpdate(listener)
  19204. UploadTask.offProgressUpdate(listener) // 需传入与监听时同一个的函数对象
  19205. ``` */
  19206. offProgressUpdate(
  19207. /** onProgressUpdate 传入的监听函数。不传此参数则移除所有监听函数。 */
  19208. listener?: UploadTaskOffProgressUpdateCallback
  19209. ): void
  19210. /** [UploadTask.onHeadersReceived(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onHeadersReceived.html)
  19211. *
  19212. * 需要基础库: `2.1.0`
  19213. *
  19214. * 在插件中使用:支持
  19215. *
  19216. * 监听 HTTP Response Header 事件。会比请求完成事件更早 */
  19217. onHeadersReceived(
  19218. /** HTTP Response Header 事件的监听函数 */
  19219. listener: DownloadTaskOnHeadersReceivedCallback
  19220. ): void
  19221. /** [UploadTask.onProgressUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/upload/UploadTask.onProgressUpdate.html)
  19222. *
  19223. * 需要基础库: `1.4.0`
  19224. *
  19225. * 在插件中使用:支持
  19226. *
  19227. * 监听上传进度变化事件 */
  19228. onProgressUpdate(
  19229. /** 上传进度变化事件的监听函数 */
  19230. listener: UploadTaskOnProgressUpdateCallback
  19231. ): void
  19232. }
  19233. interface UserCryptoManager {
  19234. /** [UserCryptoManager.getLatestUserKey(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.getLatestUserKey.html)
  19235. *
  19236. * 需要基础库: `2.17.3`
  19237. *
  19238. * 在插件中使用:不支持
  19239. *
  19240. * 获取最新的用户加密密钥
  19241. *
  19242. * **示例代码**
  19243. *
  19244. * ```js
  19245. const userCryptoManager = wx.getUserCryptoManager()
  19246. userCryptoManager.getLatestUserKey({
  19247. success: res => {
  19248. const {encryptKey, iv, version, expireTime} = res
  19249. console.log(encryptKey, iv, version, expireTime)
  19250. }
  19251. })
  19252. ``` */
  19253. getLatestUserKey(option?: GetLatestUserKeyOption): void
  19254. /** [UserCryptoManager.getRandomValues(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.getRandomValues.html)
  19255. *
  19256. * 需要基础库: `2.17.3`
  19257. *
  19258. * 在插件中使用:不支持
  19259. *
  19260. * 获取密码学安全随机数
  19261. *
  19262. * **示例代码**
  19263. *
  19264. * ```js
  19265. const userCryptoManager = wx.getUserCryptoManager()
  19266. userCryptoManager.getRandomValues({
  19267. length: 6 // 生成 6 个字节长度的随机数,
  19268. success: res => {
  19269. console.log(wx.arrayBufferToBase64(res.randomValues)) // 转换为 base64 字符串后打印
  19270. }
  19271. })
  19272. ``` */
  19273. getRandomValues(option: GetRandomValuesOption): void
  19274. }
  19275. interface VideoContext {
  19276. /** [VideoContext.exitBackgroundPlayback()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitBackgroundPlayback.html)
  19277. *
  19278. * 需要基础库: `2.14.3`
  19279. *
  19280. * 在插件中使用:支持
  19281. *
  19282. * 退出后台音频播放模式。 */
  19283. exitBackgroundPlayback(): void
  19284. /** [VideoContext.exitCasting()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitCasting.html)
  19285. *
  19286. * 需要基础库: `2.32.0`
  19287. *
  19288. * 在插件中使用:支持
  19289. *
  19290. * 退出投屏。仅支持在 tap 事件回调内调用。 */
  19291. exitCasting(): void
  19292. /** [VideoContext.exitFullScreen()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitFullScreen.html)
  19293. *
  19294. * 需要基础库: `1.4.0`
  19295. *
  19296. * 在插件中使用:支持
  19297. *
  19298. * 退出全屏 */
  19299. exitFullScreen(): void
  19300. /** [VideoContext.exitPictureInPicture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.exitPictureInPicture.html)
  19301. *
  19302. * 在插件中使用:支持
  19303. *
  19304. * 退出小窗,该方法可在任意页面调用 */
  19305. exitPictureInPicture(option?: ExitPictureInPictureOption): void
  19306. /** [VideoContext.hideStatusBar()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.hideStatusBar.html)
  19307. *
  19308. * 需要基础库: `2.1.0`
  19309. *
  19310. * 在插件中使用:支持
  19311. *
  19312. * 隐藏状态栏,仅在iOS全屏下有效 */
  19313. hideStatusBar(): void
  19314. /** [VideoContext.pause()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.pause.html)
  19315. *
  19316. * 在插件中使用:支持
  19317. *
  19318. * 暂停视频 */
  19319. pause(): void
  19320. /** [VideoContext.play()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.play.html)
  19321. *
  19322. * 在插件中使用:支持
  19323. *
  19324. * 播放视频 */
  19325. play(): void
  19326. /** [VideoContext.playbackRate(number rate)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.playbackRate.html)
  19327. *
  19328. * 需要基础库: `1.4.0`
  19329. *
  19330. * 在插件中使用:支持
  19331. *
  19332. * 设置倍速播放 */
  19333. playbackRate(
  19334. /** 倍率,支持 0.5/0.8/1.0/1.25/1.5,2.6.3 起支持 2.0 倍速 */
  19335. rate: number
  19336. ): void
  19337. /** [VideoContext.reconnectCasting()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.reconnectCasting.html)
  19338. *
  19339. * 需要基础库: `2.32.0`
  19340. *
  19341. * 在插件中使用:支持
  19342. *
  19343. * 重连投屏设备。仅支持在 tap 事件回调内调用。 */
  19344. reconnectCasting(): void
  19345. /** [VideoContext.requestBackgroundPlayback()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.requestBackgroundPlayback.html)
  19346. *
  19347. * 需要基础库: `2.14.3`
  19348. *
  19349. * 在插件中使用:支持
  19350. *
  19351. * 进入后台音频播放模式。 */
  19352. requestBackgroundPlayback(): void
  19353. /** [VideoContext.requestFullScreen(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.requestFullScreen.html)
  19354. *
  19355. * 需要基础库: `1.4.0`
  19356. *
  19357. * 在插件中使用:支持
  19358. *
  19359. * 进入全屏。若有自定义内容需在全屏时展示,需将内容节点放置到 video 节点内。 */
  19360. requestFullScreen(option: VideoContextRequestFullScreenOption): void
  19361. /** [VideoContext.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.seek.html)
  19362. *
  19363. * 在插件中使用:支持
  19364. *
  19365. * 跳转到指定位置 */
  19366. seek(
  19367. /** 跳转到的位置,单位 s */
  19368. position: number
  19369. ): void
  19370. /** [VideoContext.sendDanmu(Object data)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.sendDanmu.html)
  19371. *
  19372. * 在插件中使用:支持
  19373. *
  19374. * 发送弹幕 */
  19375. sendDanmu(
  19376. /** 弹幕内容 */
  19377. data: Danmu
  19378. ): void
  19379. /** [VideoContext.showStatusBar()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.showStatusBar.html)
  19380. *
  19381. * 需要基础库: `2.1.0`
  19382. *
  19383. * 在插件中使用:支持
  19384. *
  19385. * 显示状态栏,仅在iOS全屏下有效 */
  19386. showStatusBar(): void
  19387. /** [VideoContext.startCasting()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.startCasting.html)
  19388. *
  19389. * 需要基础库: `2.32.0`
  19390. *
  19391. * 在插件中使用:支持
  19392. *
  19393. * 开始投屏, 拉起半屏搜索设备。仅支持在 tap 事件回调内调用。 */
  19394. startCasting(): void
  19395. /** [VideoContext.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.stop.html)
  19396. *
  19397. * 需要基础库: `1.7.0`
  19398. *
  19399. * 在插件中使用:支持
  19400. *
  19401. * 停止视频 */
  19402. stop(): void
  19403. /** [VideoContext.switchCasting()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.switchCasting.html)
  19404. *
  19405. * 需要基础库: `2.32.0`
  19406. *
  19407. * 在插件中使用:支持
  19408. *
  19409. * 切换投屏设备。仅支持在 tap 事件回调内调用。 */
  19410. switchCasting(): void
  19411. }
  19412. interface VideoDecoder {
  19413. /** [Object VideoDecoder.getFrameData()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.getFrameData.html)
  19414. *
  19415. * 需要基础库: `2.11.0`
  19416. *
  19417. * 在插件中使用:支持
  19418. *
  19419. * 获取下一帧的解码数据 */
  19420. getFrameData(): FrameDataOptions
  19421. /** [Promise VideoDecoder.remove()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.remove.html)
  19422. *
  19423. * 需要基础库: `2.11.0`
  19424. *
  19425. * 在插件中使用:支持
  19426. *
  19427. * 移除解码器 */
  19428. remove(): Promise<any>
  19429. /** [Promise VideoDecoder.seek(number position)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.seek.html)
  19430. *
  19431. * 需要基础库: `2.11.0`
  19432. *
  19433. * 在插件中使用:支持
  19434. *
  19435. * 跳到某个时间点解码 */
  19436. seek(
  19437. /** 跳转的解码位置,单位 ms */
  19438. position: number
  19439. ): Promise<any>
  19440. /** [Promise VideoDecoder.start(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.start.html)
  19441. *
  19442. * 需要基础库: `2.11.0`
  19443. *
  19444. * 在插件中使用:支持
  19445. *
  19446. * 开始解码 */
  19447. start(option: VideoDecoderStartOption): Promise<any>
  19448. /** [Promise VideoDecoder.stop()](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.stop.html)
  19449. *
  19450. * 需要基础库: `2.11.0`
  19451. *
  19452. * 在插件中使用:支持
  19453. *
  19454. * 停止解码 */
  19455. stop(): Promise<any>
  19456. /** [VideoDecoder.off(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.off.html)
  19457. *
  19458. * 需要基础库: `2.11.0`
  19459. *
  19460. * 在插件中使用:支持
  19461. *
  19462. * 取消监听录制事件。当对应事件触发时,该回调函数不再执行 */
  19463. off(
  19464. /** 事件名 */
  19465. eventName: string,
  19466. /** 事件触发时执行的回调函数 */
  19467. callback: (...args: any[]) => any
  19468. ): void
  19469. /** [VideoDecoder.on(string eventName, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video-decoder/VideoDecoder.on.html)
  19470. *
  19471. * 需要基础库: `2.11.0`
  19472. *
  19473. * 在插件中使用:支持
  19474. *
  19475. * 注册监听录制事件的回调函数。当对应事件触发时,回调函数会被执行 */
  19476. on(
  19477. /** 事件名
  19478. *
  19479. * 参数 eventName 可选值:
  19480. * - 'start': 开始事件。返回 {width, height};
  19481. * - 'stop': 结束事件。;
  19482. * - 'seek': seek 完成事件。;
  19483. * - 'bufferchange': 缓冲区变化事件。;
  19484. * - 'ended': 解码结束事件。; */
  19485. eventName: 'start' | 'stop' | 'seek' | 'bufferchange' | 'ended',
  19486. /** 事件触发时执行的回调函数 */
  19487. callback: (...args: any[]) => any
  19488. ): void
  19489. }
  19490. interface VirtualPaymentError {
  19491. /** 错误信息
  19492. *
  19493. * | 错误码 | 错误信息 | 说明 |
  19494. * | - | - | - |
  19495. * | -1 | | 支付失败 |
  19496. * | -2 | | 支付取消 |
  19497. * | -4 | | 风控拦截 |
  19498. * | -5 | | 开通签约结果未知 |
  19499. * | -15001 | | 参数错误,具体原因见err_msg |
  19500. * | -15002 | | outTradeNo重复使用,请换新单号重试 |
  19501. * | -15003 | | 系统错误 |
  19502. * | -15004 | | currencyType错误,目前只能填CNY |
  19503. * | -15005 | | 用户态签名signature错误 |
  19504. * | -15006 | | 支付签名paySig错误 |
  19505. * | -15007 | | session_key过期 |
  19506. * | -15008 | | 二级商户进件未完成 |
  19507. * | -15009 | | 代币未发布 |
  19508. * | -15010 | | 道具productId未发布 |
  19509. * | -15011 | | 现网版本的env只能是0,不能填1(沙盒环境) |
  19510. * | -15012 | | 调用米大师失败导致关单,请换新单号重试 |
  19511. * | -15013 | | goodsPrice道具价格错误 |
  19512. * | -15014 | | 道具/代币发布未生效,禁止下单,大概10分钟后生效 |
  19513. * | -15016 | | signData格式有问题 |
  19514. * | -15017 | | 此商家涉嫌违规,收款功能已被限制,暂无法支付。商家可以登录微信商户平台/微信支付商家助手小程序查看原因和解决方案 |
  19515. * | -15018 | | 代币或者道具productId审核不通过 | */ errMsg: string
  19516. /** 错误码
  19517. *
  19518. * | 错误码 | 错误信息 | 说明 |
  19519. * | - | - | - |
  19520. * | -1 | | 支付失败 |
  19521. * | -2 | | 支付取消 |
  19522. * | -4 | | 风控拦截 |
  19523. * | -5 | | 开通签约结果未知 |
  19524. * | -15001 | | 参数错误,具体原因见err_msg |
  19525. * | -15002 | | outTradeNo重复使用,请换新单号重试 |
  19526. * | -15003 | | 系统错误 |
  19527. * | -15004 | | currencyType错误,目前只能填CNY |
  19528. * | -15005 | | 用户态签名signature错误 |
  19529. * | -15006 | | 支付签名paySig错误 |
  19530. * | -15007 | | session_key过期 |
  19531. * | -15008 | | 二级商户进件未完成 |
  19532. * | -15009 | | 代币未发布 |
  19533. * | -15010 | | 道具productId未发布 |
  19534. * | -15011 | | 现网版本的env只能是0,不能填1(沙盒环境) |
  19535. * | -15012 | | 调用米大师失败导致关单,请换新单号重试 |
  19536. * | -15013 | | goodsPrice道具价格错误 |
  19537. * | -15014 | | 道具/代币发布未生效,禁止下单,大概10分钟后生效 |
  19538. * | -15016 | | signData格式有问题 |
  19539. * | -15017 | | 此商家涉嫌违规,收款功能已被限制,暂无法支付。商家可以登录微信商户平台/微信支付商家助手小程序查看原因和解决方案 |
  19540. * | -15018 | | 代币或者道具productId审核不通过 | */ errCode: number
  19541. }
  19542. interface WifiError {
  19543. /** 错误信息
  19544. *
  19545. * | 错误码 | 错误信息 | 说明 |
  19546. * | - | - | - |
  19547. * | 0 | ok | 正常 |
  19548. * | 12000 | not init | 未先调用 `startWifi` 接口 |
  19549. * | 12001 | system not support | 当前系统不支持相关能力 |
  19550. * | 12002 | password error Wi-Fi | 密码错误 |
  19551. * | 12003 | connection timeout | 连接超时, 仅 Android 支持 |
  19552. * | 12004 | duplicate request | 重复连接 Wi-Fi |
  19553. * | 12005 | wifi not turned on | Android 特有,未打开 Wi-Fi 开关 |
  19554. * | 12006 | gps not turned on | Android 特有,未打开 GPS 定位开关 |
  19555. * | 12007 | user denied | 用户拒绝授权链接 Wi-Fi |
  19556. * | 12008 | invalid SSID | 无效 SSID |
  19557. * | 12009 | system config err | 系统运营商配置拒绝连接 Wi-Fi |
  19558. * | 12010 | system internal error | 系统其他错误,需要在 errmsg 打印具体的错误原因 |
  19559. * | 12011 | weapp in background | 应用在后台无法配置 Wi-Fi |
  19560. * | 12013 | wifi config may be expired | 系统保存的 Wi-Fi 配置过期,建议忘记 Wi-Fi 后重试,仅 Android 支持 |
  19561. * | 12014 | invalid WEP / WPA password | iOS 特有,无效的 WEP / WPA 密码 | */ errMsg: string
  19562. /** 错误码
  19563. *
  19564. * | 错误码 | 错误信息 | 说明 |
  19565. * | - | - | - |
  19566. * | 0 | ok | 正常 |
  19567. * | 12000 | not init | 未先调用 `startWifi` 接口 |
  19568. * | 12001 | system not support | 当前系统不支持相关能力 |
  19569. * | 12002 | password error Wi-Fi | 密码错误 |
  19570. * | 12003 | connection timeout | 连接超时, 仅 Android 支持 |
  19571. * | 12004 | duplicate request | 重复连接 Wi-Fi |
  19572. * | 12005 | wifi not turned on | Android 特有,未打开 Wi-Fi 开关 |
  19573. * | 12006 | gps not turned on | Android 特有,未打开 GPS 定位开关 |
  19574. * | 12007 | user denied | 用户拒绝授权链接 Wi-Fi |
  19575. * | 12008 | invalid SSID | 无效 SSID |
  19576. * | 12009 | system config err | 系统运营商配置拒绝连接 Wi-Fi |
  19577. * | 12010 | system internal error | 系统其他错误,需要在 errmsg 打印具体的错误原因 |
  19578. * | 12011 | weapp in background | 应用在后台无法配置 Wi-Fi |
  19579. * | 12013 | wifi config may be expired | 系统保存的 Wi-Fi 配置过期,建议忘记 Wi-Fi 后重试,仅 Android 支持 |
  19580. * | 12014 | invalid WEP / WPA password | iOS 特有,无效的 WEP / WPA 密码 | */ errCode: number
  19581. }
  19582. interface Worklet {
  19583. /** Easing 模块实现了常见的动画缓动函数(动画效果参考 https://easings.net/ ),可从 [wx.worklet](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/wx.worklet.html) 对象中读取。
  19584. *
  19585. * ****
  19586. *
  19587. * ## 示例代码
  19588. *
  19589. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/f94TCOmg7JFH)
  19590. *
  19591. * ### 预置动画函数
  19592. *
  19593. * * [Easing.bounce](#Easing.bounce) 反弹动画
  19594. * * [Easing.ease](#Easing.ease) 惯性动画
  19595. * * [Easing.elastic](#Easing.elastic) 弹性动画
  19596. *
  19597. * ### 标准缓动函数
  19598. *
  19599. * * [Easing.linear](#Easing.linear) 线性
  19600. * * [Easing.quad](#Easing.quad) 二次方
  19601. * * [Easing.cubic](#Easing.cubic) 三次方
  19602. * * [Easing.poly](#Easing.poly) 实现其它幂函数
  19603. *
  19604. * ### 其它数学函数
  19605. *
  19606. * * [Easing.bezier](#Easing.bezier) 三次贝塞尔曲线
  19607. * * [Easing.circle](#Easing.circle) 圆形曲线
  19608. * * [Easing.sin](#Easing.sin) 正弦函数
  19609. * * [Easing.exp](#Easing.exp) 指数函数
  19610. *
  19611. * ### 缓动方式
  19612. *
  19613. * 以上效果均有三种缓动方式
  19614. *
  19615. * * [Easing.in](#in) 正向执行缓动函数
  19616. * * [Easing.out](#out) 反向执行缓动函数
  19617. * * [Easing.inOut](#inout) 前半程正向,后半程反向
  19618. * 以 `sin` 函数为例,其中 `Easing.in(Easing.sin)` 和直接使用 `Easing.sin` 效果相同。
  19619. *
  19620. * 1. `Easing.in(Easing.sin)` 动画效果参考 https://easings.net/#easeInSine
  19621. * 2. `Easing.out(Easing.sin)` 动画效果参考 https://easings.net/#easeOutSine
  19622. * 3. `Easing.inOut(Easing.sin)` 动画效果参考 https://easings.net/#easeInOutSine
  19623. *
  19624. * ### Easing.bounce
  19625. *
  19626. * 简单的反弹效果,[动画效果参考](https://easings.net/#easeInBounce)
  19627. *
  19628. * ```js
  19629. Easing.bounce(t)
  19630. ```
  19631. *
  19632. * ### Easing.ease
  19633. *
  19634. * 简单的惯性动画,[动画效果参考](https://cubic-bezier.com/#.42,0,1,1)
  19635. *
  19636. * ```js
  19637. Easing.ease(t)
  19638. ```
  19639. *
  19640. * ### Easing.elastic
  19641. *
  19642. * 简单的弹性动画,类似弹簧来回摆动,高阶函数。默认弹性为 1,会稍微超出一次。弹性为 0 时 不会过冲。[动画效果参考](https://easings.net/#easeInElastic)
  19643. *
  19644. * ```js
  19645. Easing.elastic(bounciness = 1)
  19646. ```
  19647. *
  19648. * ### Easing.linear
  19649. *
  19650. * 线性函数,f(t) = t,[动画效果参考](https://cubic-bezier.com/#0,0,1,1)
  19651. *
  19652. * ```js
  19653. Easing.linear(t)
  19654. ```
  19655. * ### Easing.quad
  19656. *
  19657. * 二次方函数,f(t) = t * t,[动画效果参考](https://easings.net/#easeInQuad)
  19658. *
  19659. * ```js
  19660. Easing.quad(t)
  19661. ```
  19662. *
  19663. * ### Easing.cubic
  19664. *
  19665. * 立方函数,f(t) = t * t * t,[动画效果参考](https://easings.net/#easeInCubic)
  19666. *
  19667. * ```js
  19668. Easing.cubic(t)
  19669. ```
  19670. *
  19671. * ### Easing.poly
  19672. *
  19673. * 高阶函数,返回幂函数
  19674. *
  19675. * poly(4): [动画效果参考](https://easings.net/#easeInQuart)
  19676. *
  19677. * poly(5): [动画效果参考](https://easings.net/#easeInQuint)
  19678. *
  19679. * ```js
  19680. Easing.poly(n)
  19681. ```
  19682. *
  19683. * ### Easing.bezier
  19684. *
  19685. * 三次贝塞尔曲线,效果同 css `transition-timing-function`
  19686. *
  19687. * 调试参数可借助 [可视化工具](https://cubic-bezier.com/)
  19688. *
  19689. * ```js
  19690. Easing.bezier(x1, y1, x2, y2)
  19691. ```
  19692. *
  19693. * ### Easing.circle
  19694. *
  19695. * 圆形曲线,[动画效果参考](https://easings.net/#easeInCirc)
  19696. *
  19697. * ```js
  19698. Easing.circle(t)
  19699. ```
  19700. *
  19701. * ### Easing.sin
  19702. *
  19703. * 正弦函数,[动画效果参考](https://easings.net/#easeInSine)
  19704. *
  19705. * ```js
  19706. Easing.sin(t)
  19707. ```
  19708. *
  19709. * ### Easing.exp
  19710. *
  19711. * 指数函数,[动画效果参考](https://easings.net/#easeInExpo)
  19712. *
  19713. * ```js
  19714. Easing.exp(t)
  19715. ```
  19716. *
  19717. * ### Easing.in
  19718. *
  19719. * 正向运行 `easing function`,高阶函数。
  19720. *
  19721. * ```js
  19722. Easing.in(easing)
  19723. ```
  19724. *
  19725. * ### Easing.out
  19726. *
  19727. * 反向运行 `easing function`,高阶函数。
  19728. *
  19729. * ```js
  19730. Easing.out(easing)
  19731. ```
  19732. *
  19733. * ### Easing.inOut
  19734. *
  19735. * 前半程正向,后半程反向,高阶函数。
  19736. *
  19737. * ```js
  19738. Easing.inOut(easing)
  19739. ``` */
  19740. Easing: WorkletEasing
  19741. /** [AnimationObject worklet.decay(Object options, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.decay.html)
  19742. *
  19743. * 在插件中使用:不支持
  19744. *
  19745. * 基于滚动衰减的动画。
  19746. *
  19747. * **示例代码**
  19748. *
  19749. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/zaI8sgmw7lGW)
  19750. *
  19751. * ```html
  19752. * <pan-gesture-handler onGestureEvent="handlepan">
  19753. * <view class="circle"></view>
  19754. * </pan-gesture-handler>
  19755. * ```
  19756. *
  19757. * ```js
  19758. const { shared, decay } = wx.worklet
  19759. Page({
  19760. onLoad() {
  19761. this._offset = shared(0);
  19762. this.applyAnimatedStyle('.circle', () => {
  19763. 'worklet';
  19764. return {
  19765. transform: `translateX(${this._offset.value}px)`
  19766. };
  19767. });
  19768. },
  19769. handlepan(evt) {
  19770. 'worklet';
  19771. if (evt.state === GestureState.ACTIVE) {
  19772. this._offset.value += evt.deltaX;
  19773. } else if (evt.state === GestureState.END) {
  19774. this._offset.value = decay({
  19775. velocity: evt.velocityX,
  19776. clamp: [-200, 200],
  19777. },
  19778. () => {
  19779. 'worklet'
  19780. console.info('@@@ decay finish')
  19781. }
  19782. );
  19783. }
  19784. }
  19785. });
  19786. ``` */
  19787. decay(
  19788. /** 动画配置 */
  19789. options: DecayOption,
  19790. /** 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 */
  19791. callback: (...args: any[]) => any
  19792. ): AnimationObject
  19793. /** [AnimationObject worklet.delay(number delayMS, AnimationObject delayedAnimation)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.delay.html)
  19794. *
  19795. * 在插件中使用:不支持
  19796. *
  19797. * 延迟执行动画。 */
  19798. delay(
  19799. /** 动画开始前等待的时间,单位:毫秒。 */
  19800. delayMS: number,
  19801. /** 动画对象。 */
  19802. delayedAnimation: AnimationObject
  19803. ): AnimationObject
  19804. /** [AnimationObject worklet.repeat(AnimationObject animation, number numberOfReps, boolean reverse, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.repeat.html)
  19805. *
  19806. * 在插件中使用:不支持
  19807. *
  19808. * 重复执行动画。 */
  19809. repeat(
  19810. /** 动画对象 */
  19811. animation: AnimationObject,
  19812. /** 重复次数。为负值时一直循环,直到被取消动画。 */
  19813. numberOfReps?: number,
  19814. /** 反向运行动画,每周期结束动画由尾到头运行。该字段仅对 timing 和 spring 返回的动画对象生效。 */
  19815. reverse?: boolean,
  19816. /** 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 */
  19817. callback?: (...args: any[]) => any
  19818. ): AnimationObject
  19819. /** [AnimationObject worklet.sequence(AnimationObject animationN)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.sequence.html)
  19820. *
  19821. * 在插件中使用:不支持
  19822. *
  19823. * 组合动画序列,依次执行传入的动画。 */
  19824. sequence(
  19825. /** 动画对象 */
  19826. animationN: AnimationObject
  19827. ): AnimationObject
  19828. /** [AnimationObject worklet.spring(number|string toValue, Object options, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.spring.html)
  19829. *
  19830. * 在插件中使用:不支持
  19831. *
  19832. * 基于物理的动画。 */
  19833. spring(
  19834. /** 目标值 */
  19835. toValue: number | string,
  19836. /** 动画配置 */
  19837. options: SpringOption,
  19838. /** 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 */
  19839. callback: (...args: any[]) => any
  19840. ): AnimationObject
  19841. /** [AnimationObject worklet.timing(number toValue, Object options, function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.timing.html)
  19842. *
  19843. * 在插件中使用:不支持
  19844. *
  19845. * 基于时间的动画。 */
  19846. timing(
  19847. /** 目标值 */
  19848. toValue: number,
  19849. /** 动画配置 */
  19850. options: TimingOption,
  19851. /** 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。 */
  19852. callback: (...args: any[]) => any
  19853. ): AnimationObject
  19854. /** [DerivedValue worklet.derived(WorkletFunction updaterWorklet)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.derived.html)
  19855. *
  19856. * 在插件中使用:不支持
  19857. *
  19858. * 衍生值 `DerivedValue`,可基于已有的 `SharedValue` 生成其它共享变量。 */
  19859. derived(
  19860. /** worklet 函数类型,该函数被立即执行,返回值作为 DerivedValue 的初始值。当函数内捕获的 SharedValue 类型值发生变化时,updaterWorklet 被驱动执行,返回值用于更新 DerivedValue。可类比 computed 计算属性进行理解。 */
  19861. updaterWorklet: WorkletFunction
  19862. ): DerivedValue
  19863. /** [SharedValue worklet.shared(any initialValue)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.shared.html)
  19864. *
  19865. * 在插件中使用:不支持
  19866. *
  19867. * 创建共享变量 `SharedValue`,用于跨线程共享数据和驱动动画。 */
  19868. shared(
  19869. /** 初始值,可通过 `.value` 属性进行读取和修改。类型可以是 `number | string | bool | null | undefined | Object | Array | Function`。 */
  19870. initialValue: any
  19871. ): SharedValue
  19872. /** [function worklet.runOnJS(function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/tool-function/worklet.runOnJS.html)
  19873. *
  19874. * 在插件中使用:不支持
  19875. *
  19876. * `worklet` 函数运行在 `UI` 线程时,捕获的外部函数可能为 `worklet` 类型或普通函数,为了更明显的对其区分,要求必须使用 `runOnJS` 调回 `JS` 线程的普通函数。
  19877. * 有这样的要求是因为,调用其它 `worklet` 函数时是同步调用,但在 `UI` 线程执行 `JS` 线程的函数只能是异步,开发者容易混淆,试图同步获取 `JS` 线程的返回值。 */
  19878. runOnJS(
  19879. /** 未声明为 worklet 类型的普通函数。 */
  19880. fn: (...args: any[]) => any
  19881. ): (...args: any[]) => any
  19882. /** [function worklet.runOnUI(function fn)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/tool-function/worklet.runOnUI.html)
  19883. *
  19884. * 在插件中使用:不支持
  19885. *
  19886. * 在 UI 线程执行 worklet 函数。 */
  19887. runOnUI(
  19888. /** worklet 类型函数。 */
  19889. fn: (...args: any[]) => any
  19890. ): (...args: any[]) => any
  19891. /** [worklet.cancelAnimation(SharedValue SharedValue)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.cancelAnimation.html)
  19892. *
  19893. * 在插件中使用:不支持
  19894. *
  19895. * 取消由 `SharedValue` 驱动的动画。 */
  19896. cancelAnimation(
  19897. /** 共享变量。 */
  19898. SharedValue: SharedValue
  19899. ): void
  19900. }
  19901. interface Wx {
  19902. /** [Array.&lt;any&gt; wx.batchGetStorageSync(Array.&lt;string&gt; keyList)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchGetStorageSync.html)
  19903. *
  19904. * 需要基础库: `2.25.0`
  19905. *
  19906. * 在插件中使用:不支持
  19907. *
  19908. * 从本地缓存中同步批量获取指定 key 的内容。
  19909. *
  19910. * **示例代码**
  19911. *
  19912. * ```js
  19913. try {
  19914. var valueList = wx.batchGetStorageSync(['key'])
  19915. if (valueList) {
  19916. // Do something with return value
  19917. }
  19918. } catch (e) {
  19919. // Do something when catch error
  19920. }
  19921. ```
  19922. *
  19923. * ****
  19924. *
  19925. * 对于多个key的读取, 批量读取在性能上优于多次getStorageSync读取 */
  19926. batchGetStorageSync(
  19927. /** 本地缓存中指定的 key 数组 */
  19928. keyList: string[]
  19929. ): any[]
  19930. /** [ArrayBuffer wx.base64ToArrayBuffer(string base64)](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.base64ToArrayBuffer.html)
  19931. *
  19932. * 需要基础库: `1.1.0`
  19933. *
  19934. * 在插件中使用:支持
  19935. * @deprecated 基础库版本 [2.4.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃
  19936. *
  19937. * 将 Base64 字符串转成 ArrayBuffer 对象 */
  19938. base64ToArrayBuffer(
  19939. /** 要转化成 ArrayBuffer 对象的 Base64 字符串 */
  19940. base64: string
  19941. ): ArrayBuffer
  19942. /** [Object wx.getAccountInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/account-info/wx.getAccountInfoSync.html)
  19943. *
  19944. * 需要基础库: `2.2.2`
  19945. *
  19946. * 在插件中使用:需要基础库 `2.2.2`
  19947. *
  19948. * 获取当前账号信息。线上小程序版本号仅支持在正式版小程序中获取,开发版和体验版中无法获取。
  19949. *
  19950. * **示例代码**
  19951. *
  19952. * ```js
  19953. const accountInfo = wx.getAccountInfoSync();
  19954. console.log(accountInfo.miniProgram.appId) // 小程序 appId
  19955. console.log(accountInfo.plugin.appId) // 插件 appId
  19956. console.log(accountInfo.plugin.version) // 插件版本号, 'a.b.c' 这样的形式
  19957. ``` */
  19958. getAccountInfoSync(): AccountInfo
  19959. /** [Object wx.getAppAuthorizeSetting()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getAppAuthorizeSetting.html)
  19960. *
  19961. * 需要基础库: `2.20.1`
  19962. *
  19963. * 在插件中使用:需要基础库 `2.21.3`
  19964. *
  19965. * 获取微信APP授权设置
  19966. *
  19967. * **示例代码**
  19968. *
  19969. * ```js
  19970. const appAuthorizeSetting = wx.getAppAuthorizeSetting()
  19971. console.log(appAuthorizeSetting.albumAuthorized)
  19972. console.log(appAuthorizeSetting.bluetoothAuthorized)
  19973. console.log(appAuthorizeSetting.cameraAuthorized)
  19974. console.log(appAuthorizeSetting.locationAuthorized)
  19975. console.log(appAuthorizeSetting.locationReducedAccuracy)
  19976. console.log(appAuthorizeSetting.microphoneAuthorized)
  19977. console.log(appAuthorizeSetting.notificationAlertAuthorized)
  19978. console.log(appAuthorizeSetting.notificationAuthorized)
  19979. console.log(appAuthorizeSetting.notificationBadgeAuthorized)
  19980. console.log(appAuthorizeSetting.notificationSoundAuthorized)
  19981. console.log(appAuthorizeSetting.phoneCalendarAuthorized)
  19982. ```
  19983. *
  19984. * **返回值说明**
  19985. *
  19986. * `'authorized'` 表示已经获得授权,无需再次请求授权;
  19987. * `'denied'` 表示请求授权被拒绝,无法再次请求授权;(此情况需要引导用户[打开系统设置](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.openAppAuthorizeSetting.html),在设置页中打开权限)
  19988. * `'non determined'` 表示尚未请求授权,会在微信下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) */
  19989. getAppAuthorizeSetting(): AppAuthorizeSetting
  19990. /** [Object wx.getAppBaseInfo()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getAppBaseInfo.html)
  19991. *
  19992. * 需要基础库: `2.20.1`
  19993. *
  19994. * 在插件中使用:需要基础库 `2.21.3`
  19995. *
  19996. * 获取微信APP基础信息
  19997. *
  19998. * **示例代码**
  19999. *
  20000. * ```js
  20001. const appBaseInfo = wx.getAppBaseInfo()
  20002. console.log(appBaseInfo.SDKVersion)
  20003. console.log(appBaseInfo.enableDebug)
  20004. console.log(appBaseInfo.host)
  20005. console.log(appBaseInfo.language)
  20006. console.log(appBaseInfo.version)
  20007. console.log(appBaseInfo.theme)
  20008. ``` */
  20009. getAppBaseInfo(): AppBaseInfo
  20010. /** [Object wx.getBatteryInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfoSync.html)
  20011. *
  20012. * 在插件中使用:需要基础库 `2.15.0`
  20013. *
  20014. * [wx.getBatteryInfo](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfo.html) 的同步版本 */
  20015. getBatteryInfoSync(): GetBatteryInfoSyncResult
  20016. /** [Object wx.getDeviceInfo()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getDeviceInfo.html)
  20017. *
  20018. * 需要基础库: `2.20.1`
  20019. *
  20020. * 在插件中使用:需要基础库 `2.21.3`
  20021. *
  20022. * 获取设备基础信息
  20023. *
  20024. * **示例代码**
  20025. *
  20026. * ```js
  20027. const deviceInfo = wx.getDeviceInfo()
  20028. console.log(deviceInfo.abi)
  20029. console.log(deviceInfo.benchmarkLevel)
  20030. console.log(deviceInfo.brand)
  20031. console.log(deviceInfo.model)
  20032. console.log(deviceInfo.platform)
  20033. console.log(deviceInfo.system)
  20034. ``` */
  20035. getDeviceInfo(): DeviceInfo
  20036. /** [Object wx.getEnterOptionsSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getEnterOptionsSync.html)
  20037. *
  20038. * 需要基础库: `2.9.4`
  20039. *
  20040. * 在插件中使用:需要基础库 `2.9.4`
  20041. *
  20042. * 获取本次小程序启动时的参数。如果当前是冷启动,则返回值与 [`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) 一致。
  20043. *
  20044. * **返回有效 referrerInfo 的场景**
  20045. *
  20046. * | 场景值 | 场景 | appId含义 |
  20047. * | ------ | ------------------------------- | ---------- |
  20048. * | 1020 | 公众号 profile 页相关小程序列表 | 来源公众号 |
  20049. * | 1035 | 公众号自定义菜单 | 来源公众号 |
  20050. * | 1036 | App 分享消息卡片 | 来源App |
  20051. * | 1037 | 小程序打开小程序 | 来源小程序 |
  20052. * | 1038 | 从另一个小程序返回 | 来源小程序 |
  20053. * | 1043 | 公众号模板消息 | 来源公众号 |
  20054. *
  20055. * **不同 apiCategory 场景下的 API 限制**
  20056. *
  20057. * `X` 表示 API 被限制无法使用;不在表格中的 API 不限制。
  20058. *
  20059. * | | default | nativeFunctionalized | browseOnly | embedded |
  20060. * |-|-|-|-|-|
  20061. * |navigateToMiniProgram | | `X` | `X` | |
  20062. * |openSetting | | | `X` | |
  20063. * |&lt;button open-type="share"&gt; | | `X` | `X` | `X` |
  20064. * |&lt;button open-type="feedback"&gt; | | | `X` | |
  20065. * |&lt;button open-type="open-setting"&gt;| | | `X` | |
  20066. * |openEmbeddedMiniProgram | | `X` | `X` | `X` |
  20067. *
  20068. * **注意**
  20069. *
  20070. * 部分版本在无 `referrerInfo` 的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。 */
  20071. getEnterOptionsSync(): LaunchOptionsApp
  20072. /** [Object wx.getExptInfoSync(Array.&lt;string&gt; keys)](https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.getExptInfoSync.html)
  20073. *
  20074. * 需要基础库: `2.17.0`
  20075. *
  20076. * 在插件中使用:不支持
  20077. *
  20078. * 给定实验参数数组,获取对应的实验参数值
  20079. *
  20080. * **提示**
  20081. *
  20082. * 假设实验参数有 `color`, `size`
  20083. * 调用 wx.getExptInfoSync() 会返回 `{color:'#fff',size:20}` 类似的结果
  20084. * 而 wx.getExptInfoSync(['color']) 则只会返回 `{color:'#fff'}` */
  20085. getExptInfoSync(
  20086. /** 实验参数数组,不填则获取所有实验参数 */
  20087. keys?: string[]
  20088. ): IAnyObject
  20089. /** [Object wx.getExtConfigSync()](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfigSync.html)
  20090. *
  20091. * 需要基础库: `1.1.0`
  20092. *
  20093. * 在插件中使用:不支持
  20094. *
  20095. * [wx.getExtConfig](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfig.html) 的同步版本。
  20096. *
  20097. * **Tips**
  20098. *
  20099. * 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) 是否存在来兼容
  20100. *
  20101. * ****
  20102. *
  20103. * ```js
  20104. let extConfig = wx.getExtConfigSync? wx.getExtConfigSync(): {}
  20105. console.log(extConfig)
  20106. ``` */
  20107. getExtConfigSync(): IAnyObject
  20108. /** [Object wx.getLaunchOptionsSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getLaunchOptionsSync.html)
  20109. *
  20110. * 需要基础库: `2.1.2`
  20111. *
  20112. * 在插件中使用:需要基础库 `2.9.4`
  20113. *
  20114. * 获取小程序启动时的参数。与 [`App.onLaunch`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onlaunchobject-object) 的回调参数一致。
  20115. *
  20116. * **返回有效 referrerInfo 的场景**
  20117. *
  20118. * | 场景值 | 场景 | appId含义 |
  20119. * | ------ | ------------------------------- | ---------- |
  20120. * | 1020 | 公众号 profile 页相关小程序列表 | 来源公众号 |
  20121. * | 1035 | 公众号自定义菜单 | 来源公众号 |
  20122. * | 1036 | App 分享消息卡片 | 来源App |
  20123. * | 1037 | 小程序打开小程序 | 来源小程序 |
  20124. * | 1038 | 从另一个小程序返回 | 来源小程序 |
  20125. * | 1043 | 公众号模板消息 | 来源公众号 |
  20126. * | 1069 | 移动应用 | 来源App |
  20127. *
  20128. * **不同 apiCategory 场景下的 API 限制**
  20129. *
  20130. * `X` 表示 API 被限制无法使用;不在表格中的 API 不限制。
  20131. *
  20132. * | | default | nativeFunctionalized | browseOnly | embedded |
  20133. * |-|-|-|-|-|
  20134. * |navigateToMiniProgram | | `X` | `X` | |
  20135. * |openSetting | | | `X` | |
  20136. * |&lt;button open-type="share"&gt; | | `X` | `X` | `X` |
  20137. * |&lt;button open-type="feedback"&gt; | | | `X` | |
  20138. * |&lt;button open-type="open-setting"&gt;| | | `X` | |
  20139. * |openEmbeddedMiniProgram | | `X` | `X` | `X` |
  20140. *
  20141. * **注意**
  20142. *
  20143. * 部分版本在无`referrerInfo`的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。 */
  20144. getLaunchOptionsSync(): LaunchOptionsApp
  20145. /** [Object wx.getMenuButtonBoundingClientRect()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/menu/wx.getMenuButtonBoundingClientRect.html)
  20146. *
  20147. * 需要基础库: `2.1.0`
  20148. *
  20149. * 在插件中使用:需要基础库 `2.15.0`
  20150. *
  20151. * 获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。
  20152. *
  20153. * **示例代码**
  20154. *
  20155. * ```js
  20156. const res = wx.getMenuButtonBoundingClientRect()
  20157. console.log(res.width)
  20158. console.log(res.height)
  20159. console.log(res.top)
  20160. console.log(res.right)
  20161. console.log(res.bottom)
  20162. console.log(res.left)
  20163. ``` */
  20164. getMenuButtonBoundingClientRect(): ClientRect
  20165. /** [Object wx.getSkylineInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSkylineInfoSync.html)
  20166. *
  20167. * 需要基础库: `2.26.2`
  20168. *
  20169. * 在插件中使用:需要基础库 `2.26.2`
  20170. *
  20171. * 获取当前运行环境对于 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 的支持情况 */
  20172. getSkylineInfoSync(): SkylineInfo
  20173. /** [Object wx.getStorageInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfoSync.html)
  20174. *
  20175. * 在插件中使用:不支持
  20176. *
  20177. * [wx.getStorageInfo](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfo.html) 的同步版本
  20178. *
  20179. * **示例代码**
  20180. *
  20181. * ```js
  20182. wx.getStorageInfo({
  20183. success (res) {
  20184. console.log(res.keys)
  20185. console.log(res.currentSize)
  20186. console.log(res.limitSize)
  20187. }
  20188. })
  20189. ```
  20190. *
  20191. * ```js
  20192. try {
  20193. const res = wx.getStorageInfoSync()
  20194. console.log(res.keys)
  20195. console.log(res.currentSize)
  20196. console.log(res.limitSize)
  20197. } catch (e) {
  20198. // Do something when catch error
  20199. }
  20200. ``` */
  20201. getStorageInfoSync(): GetStorageInfoSyncOption
  20202. /** [Object wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoSync.html)
  20203. *
  20204. * 在插件中使用:需要基础库 `1.9.6`
  20205. *
  20206. * [wx.getSystemInfo](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfo.html) 的同步版本
  20207. *
  20208. * **示例代码**
  20209. *
  20210. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/WkUCgXmS7mqO)
  20211. *
  20212. * ```js
  20213. wx.getSystemInfo({
  20214. success (res) {
  20215. console.log(res.model)
  20216. console.log(res.pixelRatio)
  20217. console.log(res.windowWidth)
  20218. console.log(res.windowHeight)
  20219. console.log(res.language)
  20220. console.log(res.version)
  20221. console.log(res.platform)
  20222. }
  20223. })
  20224. ```
  20225. *
  20226. * ```js
  20227. try {
  20228. const res = wx.getSystemInfoSync()
  20229. console.log(res.model)
  20230. console.log(res.pixelRatio)
  20231. console.log(res.windowWidth)
  20232. console.log(res.windowHeight)
  20233. console.log(res.language)
  20234. console.log(res.version)
  20235. console.log(res.platform)
  20236. } catch (e) {
  20237. // Do something when catch error
  20238. }
  20239. ``` */
  20240. getSystemInfoSync(): SystemInfo
  20241. /** [Object wx.getSystemSetting()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemSetting.html)
  20242. *
  20243. * 需要基础库: `2.20.1`
  20244. *
  20245. * 在插件中使用:需要基础库 `2.21.3`
  20246. *
  20247. * 获取设备设置
  20248. *
  20249. * **示例代码**
  20250. *
  20251. * ```js
  20252. const systemSetting = wx.getSystemSetting()
  20253. console.log(systemSetting.bluetoothEnabled)
  20254. console.log(systemSetting.deviceOrientation)
  20255. console.log(systemSetting.locationEnabled)
  20256. console.log(systemSetting.wifiEnabled)
  20257. ``` */
  20258. getSystemSetting(): SystemSetting
  20259. /** [Object wx.getWindowInfo()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getWindowInfo.html)
  20260. *
  20261. * 需要基础库: `2.20.1`
  20262. *
  20263. * 在插件中使用:需要基础库 `2.21.3`
  20264. *
  20265. * 获取窗口信息
  20266. *
  20267. * **示例代码**
  20268. *
  20269. * ```js
  20270. const windowInfo = wx.getWindowInfo()
  20271. console.log(windowInfo.pixelRatio)
  20272. console.log(windowInfo.screenWidth)
  20273. console.log(windowInfo.screenHeight)
  20274. console.log(windowInfo.windowWidth)
  20275. console.log(windowInfo.windowHeight)
  20276. console.log(windowInfo.statusBarHeight)
  20277. console.log(windowInfo.safeArea)
  20278. console.log(windowInfo.screenTop)
  20279. ``` */
  20280. getWindowInfo(): WindowInfo
  20281. /** [Promise<string> wx.getRendererUserAgent(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getRendererUserAgent.html)
  20282. *
  20283. * 需要基础库: `2.26.3`
  20284. *
  20285. * 在插件中使用:需要基础库 `2.21.3`
  20286. *
  20287. * 获取 Webview 小程序的 UserAgent
  20288. *
  20289. * **示例代码**
  20290. *
  20291. * ```js
  20292. // v2.30.4 前,仅支持 promise 风格调用
  20293. wx.getRendererUserAgent().then(userAgent => console.log(userAgent))
  20294. // v2.30.4 起,除 promise 风格调用外,也支持 invoke 风格使用
  20295. wx.getRendererUserAgent({
  20296. success(res) { console.log(res.userAgent) }
  20297. })
  20298. ``` */
  20299. getRendererUserAgent(
  20300. option?: GetRendererUserAgentOption
  20301. ): Promise<string>
  20302. /** [[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)
  20303. *
  20304. * 在插件中使用:需要基础库 `1.9.6`
  20305. *
  20306. * 创建一个动画实例 [animation](https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.html)。调用实例的方法来描述动画。最后通过动画实例的 export 方法导出动画数据传递给组件的 animation 属性。 */
  20307. createAnimation(option: StepOption): Animation
  20308. /** [[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)
  20309. *
  20310. * 在插件中使用:需要基础库 `1.9.6`
  20311. * @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) 替换
  20312. *
  20313. * 创建 [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 上下文 [AudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.html) 对象。 */
  20314. createAudioContext(
  20315. /** [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 组件的 id */
  20316. id: string,
  20317. /** 在自定义组件下,当前组件实例的this,以操作组件内 [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 组件 */
  20318. component?: Component.TrivialInstance | Page.TrivialInstance
  20319. ): AudioContext
  20320. /** [[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)
  20321. *
  20322. * 需要基础库: `1.2.0`
  20323. *
  20324. * 在插件中使用:需要基础库 `1.9.6`
  20325. *
  20326. * 获取**全局唯一**的背景音频管理器。
  20327. * 小程序切入后台,如果音频处于播放状态,可以继续播放。但是后台状态不能通过调用API操纵音频的播放状态。
  20328. *
  20329. * 从微信客户端6.7.2版本开始,若需要在小程序切后台后继续播放音频,需要在 [app.json](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html) 中配置 `requiredBackgroundModes` 属性。开发版和体验版上可以直接生效,正式版还需通过审核。 */
  20330. getBackgroundAudioManager(): BackgroundAudioManager
  20331. /** [[CacheManager](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.html) wx.createCacheManager(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/wx.createCacheManager.html)
  20332. *
  20333. * 需要基础库: `2.24.0`
  20334. *
  20335. * 在插件中使用:不支持
  20336. *
  20337. * 创建缓存管理器
  20338. *
  20339. * **示例代码**
  20340. *
  20341. * <a href="https://github.com/wechat-miniprogram/miniprogram-offline-demo" target="_blank">查看完整示例代码</a>
  20342. *
  20343. * ```js
  20344. const cacheManager = createCacheManager()
  20345. cacheManager.addRule(/https:\/\/(?:.*)/ig) // 表示所有 https 请求都匹配
  20346. cacheManager.on('request', evt => {
  20347. // 在弱网时接收到 wx.request 请求
  20348. return new Promise((resolve, reject) => {
  20349. const matchRes = cm.match(evt)
  20350. if (matchRes && matchRes.data) {
  20351. // 有缓存,返回
  20352. resolve(matchRes.data)
  20353. } else {
  20354. // 没缓存,抛错
  20355. reject({ errMsg: 'no cache' })
  20356. }
  20357. })
  20358. })
  20359. ``` */
  20360. createCacheManager(option: CreateCacheManagerOption): CacheManager
  20361. /** [[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)
  20362. *
  20363. * 需要基础库: `1.6.0`
  20364. *
  20365. * 在插件中使用:需要基础库 `1.9.6`
  20366. *
  20367. * 创建 [camera](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html) 上下文 [CameraContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.html) 对象。 */
  20368. createCameraContext(): CameraContext
  20369. /** [[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)
  20370. *
  20371. * 在插件中使用:需要基础库 `1.9.6`
  20372. * @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) 替换
  20373. *
  20374. * 创建 canvas 的绘图上下文 [CanvasContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html) 对象 */
  20375. createCanvasContext(
  20376. /** 要获取上下文的 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 canvas-id 属性 */
  20377. canvasId: string,
  20378. /** 在自定义组件下,当前组件实例的this,表示在这个自定义组件下查找拥有 canvas-id 的 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) ,如果省略则不在任何自定义组件内查找 */
  20379. component?: Component.TrivialInstance | Page.TrivialInstance
  20380. ): CanvasContext
  20381. /** [[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)
  20382. *
  20383. * 在插件中使用:需要基础库 `1.9.6`
  20384. *
  20385. * 下载文件资源到本地。客户端直接发起一个 HTTPS GET 请求,返回文件的本地临时路径 (本地路径),单次下载允许的最大文件为 200MB。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
  20386. *
  20387. * 注意:请在服务端响应的 header 中指定合理的 `Content-Type` 字段,以保证客户端正确处理文件类型。
  20388. *
  20389. * **示例代码**
  20390. *
  20391. * ```js
  20392. wx.downloadFile({
  20393. url: 'https://example.com/audio/123', //仅为示例,并非真实的资源
  20394. success (res) {
  20395. // 只要服务器有响应数据,就会把响应内容写入文件并进入 success 回调,业务需要自行判断是否下载到了想要的内容
  20396. if (res.statusCode === 200) {
  20397. wx.playVoice({
  20398. filePath: res.tempFilePath
  20399. })
  20400. }
  20401. }
  20402. })
  20403. ``` */
  20404. downloadFile(option: DownloadFileOption): DownloadTask
  20405. /** [[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)
  20406. *
  20407. * 需要基础库: `1.9.9`
  20408. *
  20409. * 在插件中使用:需要基础库 `2.19.2`
  20410. *
  20411. * 获取全局唯一的文件管理器 */
  20412. getFileSystemManager(): FileSystemManager
  20413. /** [[InferenceSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.html) wx.createInferenceSession(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/wx.createInferenceSession.html)
  20414. *
  20415. * 需要基础库: `2.30.0`
  20416. *
  20417. * 在插件中使用:需要基础库 `2.30.0`
  20418. *
  20419. * 创建 AI 推理 Session。使用前可参考[AI指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/inference/tutorial.html)
  20420. *
  20421. * **示例代码**
  20422. *
  20423. * ```js
  20424. // 创建会话,加载模型
  20425. const session = wx.createInferenceSession({
  20426. model: `${wx.env.USER_DATA_PATH}/MNIST.onnx`,
  20427. precisionLevel: 4,
  20428. typicalShape:{input1:[1, 3, 224, 224], input2:[1, 1, 224, 224]}, //除非使用动态轴,一般不用显式指定
  20429. allowNPU: false,
  20430. allowQuantize: false
  20431. })
  20432. // 监听error事件
  20433. session.onError(err => {
  20434. console.error(err)
  20435. })
  20436. // 监听模型加载完成事件
  20437. session.onLoad(() => {
  20438. // 运行推理
  20439. // 其中input1, input2, output0 必须与使用的onnx模型中实际的输入输出名字完全一致,不可随意填写。
  20440. // 模型输入输出信息可以通过Netron 打开onnx模型看到
  20441. session.run({
  20442. input1: {
  20443. type: 'float32',
  20444. data: new Float32Array(3 * 224 * 224).buffer,
  20445. shape: [1, 3, 224, 224] // NCHW 顺序
  20446. },
  20447. // 多个input的添加方法,假设第二个input需要数据类型为uint8
  20448. input2: {
  20449. type: 'uint8',
  20450. data: new Uint8Array(224 * 224).buffer,
  20451. shape: [1, 1, 224, 224]
  20452. },
  20453. }).then(res => {
  20454. console.log(res.output0)
  20455. })
  20456. })
  20457. // 销毁Session
  20458. // session完成创建后可以多次调用run进行推理,直到调用`session.destroy()`释放相关内存。
  20459. // 销毁会话
  20460. session.destroy()
  20461. ``` */
  20462. createInferenceSession(
  20463. option: CreateInferenceSessionOption
  20464. ): InferenceSession
  20465. /** [[InnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.html) wx.createInnerAudioContext(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html)
  20466. *
  20467. * 需要基础库: `1.6.0`
  20468. *
  20469. * 在插件中使用:需要基础库 `1.9.6`
  20470. *
  20471. * 创建内部 [audio](https://developers.weixin.qq.com/miniprogram/dev/component/audio.html) 上下文 [InnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.html) 对象。
  20472. *
  20473. * **示例代码**
  20474. *
  20475. * ```js
  20476. const innerAudioContext = wx.createInnerAudioContext({
  20477. useWebAudioImplement: false // 是否使用 WebAudio 作为底层音频驱动,默认关闭。对于短音频、播放频繁的音频建议开启此选项,开启后将获得更优的性能表现。由于开启此选项后也会带来一定的内存增长,因此对于长音频建议关闭此选项
  20478. })
  20479. innerAudioContext.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46'
  20480. innerAudioContext.play() // 播放
  20481. innerAudioContext.pause() // 暂停
  20482. innerAudioContext.stop() // 停止
  20483. ``` */
  20484. createInnerAudioContext(
  20485. option?: CreateInnerAudioContextOption
  20486. ): InnerAudioContext
  20487. /** [[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)
  20488. *
  20489. * 需要基础库: `1.9.3`
  20490. *
  20491. * 在插件中使用:需要基础库 `1.9.6`
  20492. *
  20493. * 创建并返回一个 IntersectionObserver 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createIntersectionObserver([options])` 来代替。
  20494. *
  20495. * **示例代码**
  20496. *
  20497. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/LAbMxkmI7F2A) */
  20498. createIntersectionObserver(
  20499. /** 自定义组件实例 */
  20500. component: IAnyObject,
  20501. /** 选项 */
  20502. options?: CreateIntersectionObserverOption
  20503. ): IntersectionObserver
  20504. /** [[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)
  20505. *
  20506. * 需要基础库: `2.6.0`
  20507. *
  20508. * 在插件中使用:需要基础库 `2.8.1`
  20509. *
  20510. * 创建插屏广告组件。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API。每次调用该方法创建插屏广告都会返回一个全新的实例(小程序端的插屏广告实例不允许跨页面使用)。 */
  20511. createInterstitialAd(option: CreateInterstitialAdOption): InterstitialAd
  20512. /** [[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)
  20513. *
  20514. * 需要基础库: `1.7.0`
  20515. *
  20516. * 在插件中使用:需要基础库 `1.9.6`
  20517. *
  20518. * 创建 [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 对象。 */
  20519. createLivePlayerContext(
  20520. /** [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 组件的 id */
  20521. id: string,
  20522. /** 在自定义组件下,当前组件实例的this,以操作组件内 [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 组件 */
  20523. component?: Component.TrivialInstance | Page.TrivialInstance
  20524. ): LivePlayerContext
  20525. /** [[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)
  20526. *
  20527. * 需要基础库: `1.7.0`
  20528. *
  20529. * 在插件中使用:需要基础库 `1.9.6`
  20530. *
  20531. * 创建 [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) 对象。 */
  20532. createLivePusherContext(): LivePusherContext
  20533. /** [[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)
  20534. *
  20535. * 需要基础库: `2.1.0`
  20536. *
  20537. * 在插件中使用:不支持
  20538. *
  20539. * 获取日志管理器对象。
  20540. *
  20541. * **示例代码**
  20542. *
  20543. * ```js
  20544. const logger = wx.getLogManager({level: 1})
  20545. logger.log({str: 'hello world'}, 'basic log', 100, [1, 2, 3])
  20546. logger.info({str: 'hello world'}, 'info log', 100, [1, 2, 3])
  20547. logger.debug({str: 'hello world'}, 'debug log', 100, [1, 2, 3])
  20548. logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3])
  20549. ``` */
  20550. getLogManager(option: GetLogManagerOption): LogManager
  20551. /** [[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)
  20552. *
  20553. * 在插件中使用:需要基础库 `1.9.6`
  20554. *
  20555. * 创建 [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 对象。 */
  20556. createMapContext(
  20557. /** [map](https://developers.weixin.qq.com/miniprogram/dev/component/map.html) 组件的 id */
  20558. mapId: string,
  20559. /** 在自定义组件下,当前组件实例的this,以操作组件内 [map](https://developers.weixin.qq.com/miniprogram/dev/component/map.html) 组件 */
  20560. component?: Component.TrivialInstance | Page.TrivialInstance
  20561. ): MapContext
  20562. /** [[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)
  20563. *
  20564. * 需要基础库: `2.13.0`
  20565. *
  20566. * 在插件中使用:支持
  20567. *
  20568. * 创建媒体音频播放器对象 [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) 输出的音频。
  20569. *
  20570. * **示例代码**
  20571. *
  20572. * ```js
  20573. // 创建视频解码器,具体参数见 createVideoDecoder 文档
  20574. const videoDecoder = wx.createVideoDecoder()
  20575. // 创建媒体音频播放器
  20576. const mediaAudioPlayer = wx.createMediaAudioPlayer()
  20577. // 启动视频解码器
  20578. videoDecoder.start()
  20579. // 启动播放器
  20580. mediaAudioPlayer.start().then(() => {
  20581. // 添加播放器音频来源
  20582. mediaAudioPlayer.addAudioSource(videoDecoder).then(res => {
  20583. videoDecoder.getFrameData() // 建议在 requestAnimationFrame 里获取每一帧视频数据
  20584. console.log(res)
  20585. })
  20586. // 移除播放器音频来源
  20587. mediaAudioPlayer.removeAudioSource(videoDecoder).then()
  20588. // 停止播放器
  20589. mediaAudioPlayer.stop().then()
  20590. // 销毁播放器
  20591. mediaAudioPlayer.destroy().then()
  20592. // 设置播放器音量
  20593. mediaAudioPlayer.volume = 0.5
  20594. })
  20595. ```
  20596. *
  20597. * **完整demo(小游戏)**
  20598. *
  20599. * - https://developers.weixin.qq.com/s/SF2duHmb7MjI */
  20600. createMediaAudioPlayer(): MediaAudioPlayer
  20601. /** [[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)
  20602. *
  20603. * 需要基础库: `2.9.0`
  20604. *
  20605. * 在插件中使用:需要基础库 `2.10.0`
  20606. *
  20607. * 创建音视频处理容器,最终可将容器中的轨道合成一个视频 */
  20608. createMediaContainer(): MediaContainer
  20609. /** [[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)
  20610. *
  20611. * 需要基础库: `2.11.0`
  20612. *
  20613. * 在插件中使用:需要基础库 `2.11.0`
  20614. *
  20615. * 创建 WebGL 画面录制器,可逐帧录制在 WebGL 上渲染的画面并导出视频文件
  20616. *
  20617. * **示例代码**
  20618. *
  20619. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/MCz3kPmC7zpa)
  20620. *
  20621. * **低版本异步接口兼容**
  20622. *
  20623. * 对基础库 2.16.1 版本前的 mediaRecorder,所有的接口都没有返回 Promise 对象,若需要兼容低版本,则可采用如下方式的写法:
  20624. * ```javascript
  20625. // 启动 mediaRecorder
  20626. await new Promise(resolve => {
  20627. recorder.on('start', resolve)
  20628. recorder.start()
  20629. })
  20630. // 逐帧绘制
  20631. while (frames--) {
  20632. await new Promise(resolve => recorder.requestFrame(resolve))
  20633. render()
  20634. }
  20635. // 绘制完成,生成视频
  20636. const {tempFilePath} = await new Promise(resolve => {
  20637. recorder.on('stop', resolve)
  20638. recorder.stop()
  20639. })
  20640. ``` */
  20641. createMediaRecorder(
  20642. /** WebGL 对象,通过 [SelectorQuery](https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html) 获取到的 node 对象或通过 [wx.createOffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html) 创建的离屏 WebGL Canvas 对象 */
  20643. canvas: IAnyObject,
  20644. options: CreateMediaRecorderOption
  20645. ): MediaRecorder
  20646. /** [[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)
  20647. *
  20648. * 需要基础库: `2.11.2`
  20649. *
  20650. * 在插件中使用:需要基础库 `2.11.2`
  20651. *
  20652. * 获取 NFC 实例
  20653. *
  20654. * **示例代码**
  20655. *
  20656. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/1WsbDwmb75ig) */
  20657. getNFCAdapter(): NFCAdapter
  20658. /** [[OffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.html) wx.createOffscreenCanvas(object object, number width, number height, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html)
  20659. *
  20660. * 需要基础库: `2.16.1`
  20661. *
  20662. * 在插件中使用:需要基础库 `2.16.1`
  20663. *
  20664. * 创建离屏 canvas 实例
  20665. *
  20666. * **离屏 Canvas 类型不可混用**
  20667. *
  20668. * 由于 webgl canvas 和 2d canvas 的底层实现方式不同,因此必须要在调用 `wx.createOffscreenCanvas` 时提前指定类型。
  20669. *
  20670. * 指定类型后,离屏 canvas `getContext(type)` 调用不允许混用,如不能对 webgl canvas 调用 `getContext('2d')`。
  20671. *
  20672. * 同样的,不同类型 canvas 调用 `createImage` 创建的图片对象也不支持混用,使用时请注意尽量使用 canvas 自身的 `createImage` 创建图片对象。
  20673. *
  20674. * **与 MediaRecorder 结合**
  20675. *
  20676. * 离屏 webgl canvas 支持作为参数传递给 [`wx.createMediaRecorder`](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/wx.createMediaRecorder.html), 离屏 2d canvas 暂不支持。
  20677. *
  20678. * **旧版 createOffscreenCanvas**
  20679. *
  20680. * 旧版函数签名为 `wx.createOffscreenCanvas(width: number, height: number, this: object): OffscreenCanvas`,从基础库 2.7.0 开始支持
  20681. *
  20682. * 从基础库 2.16.1 开始改为 `wx.createOffscreenCanvas(options: object): OffscreenCanvas`,向下兼容旧版入参。
  20683. * 但需注意旧版入参只能创建 webgl 类型,如需创建 2d 类型则必须使用新版。 */
  20684. createOffscreenCanvas(
  20685. /** 画布宽度 */
  20686. width: number,
  20687. /** 画布高度 */
  20688. height: number,
  20689. /** 在自定义组件下,当前组件实例的 this */
  20690. component?: Component.TrivialInstance | Page.TrivialInstance
  20691. ): OffscreenCanvas
  20692. /** [[OffscreenCanvas](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/OffscreenCanvas.html) wx.createOffscreenCanvas(object object, number width, number height, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.createOffscreenCanvas.html)
  20693. *
  20694. * 需要基础库: `2.16.1`
  20695. *
  20696. * 在插件中使用:需要基础库 `2.16.1`
  20697. *
  20698. * 创建离屏 canvas 实例
  20699. *
  20700. * **离屏 Canvas 类型不可混用**
  20701. *
  20702. * 由于 webgl canvas 和 2d canvas 的底层实现方式不同,因此必须要在调用 `wx.createOffscreenCanvas` 时提前指定类型。
  20703. *
  20704. * 指定类型后,离屏 canvas `getContext(type)` 调用不允许混用,如不能对 webgl canvas 调用 `getContext('2d')`。
  20705. *
  20706. * 同样的,不同类型 canvas 调用 `createImage` 创建的图片对象也不支持混用,使用时请注意尽量使用 canvas 自身的 `createImage` 创建图片对象。
  20707. *
  20708. * **与 MediaRecorder 结合**
  20709. *
  20710. * 离屏 webgl canvas 支持作为参数传递给 [`wx.createMediaRecorder`](https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/wx.createMediaRecorder.html), 离屏 2d canvas 暂不支持。
  20711. *
  20712. * **旧版 createOffscreenCanvas**
  20713. *
  20714. * 旧版函数签名为 `wx.createOffscreenCanvas(width: number, height: number, this: object): OffscreenCanvas`,从基础库 2.7.0 开始支持
  20715. *
  20716. * 从基础库 2.16.1 开始改为 `wx.createOffscreenCanvas(options: object): OffscreenCanvas`,向下兼容旧版入参。
  20717. * 但需注意旧版入参只能创建 webgl 类型,如需创建 2d 类型则必须使用新版。 */
  20718. createOffscreenCanvas(
  20719. option: CreateOffscreenCanvasOption
  20720. ): OffscreenCanvas
  20721. /** [[Performance](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.html) wx.getPerformance()](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.getPerformance.html)
  20722. *
  20723. * 需要基础库: `2.11.0`
  20724. *
  20725. * 在插件中使用:支持
  20726. *
  20727. * 获取当前小程序性能相关的信息。关于小程序启动性能优化的更多内容,请参考[启动性能指南](https://developers.weixin.qq.com/miniprogram/dev/framework/performance/tips/start.html)。
  20728. *
  20729. * ****
  20730. *
  20731. * 目前支持获取以下几类性能指标,具体内容请参考 [PerformanceEntry](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/PerformanceEntry.html):
  20732. *
  20733. * | 指标类型(entryType) | 指标名称 | 最低版本 |
  20734. * | ------------------- | ---------------- | ------ |
  20735. * | 路由(navigation) | route: 路由性能 | |
  20736. * | 路由(navigation) | appLaunch: 小程序启动耗时 | |
  20737. * | 渲染(render) | firstRender: 页面首次渲染耗时 | |
  20738. * | 渲染(render) | firstPaint: 页面首次绘制 | <2.21.2> |
  20739. * | 渲染(render) | firstContentfulPaint: 页面首次内容绘制 | <2.21.2> |
  20740. * | 渲染(render) | largestContentfulPaint: 页面最大内容绘制 | <2.23.1> |
  20741. * | 脚本(script) | evaluateScript: 注入脚本耗时 | |
  20742. * | 包加载(loadPackage)| downloadPackage: 代码包下载耗时 | <2.24.0> |
  20743. * | 资源(resource) | resourceTiming: 视图层资源加载耗时 | <2.24.0> |
  20744. *
  20745. * **示例代码**
  20746. *
  20747. * ```js
  20748. const performance = wx.getPerformance()
  20749. const observer = performance.createObserver((entryList) => {
  20750. console.log(entryList.getEntries())
  20751. })
  20752. observer.observe({ entryTypes: ['render', 'script', 'navigation'] })
  20753. ```
  20754. *
  20755. * **注意**
  20756. *
  20757. * - 目前,当开启代码 [按需注入](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/lazyload.html) 时,`evaluateScript` 将仅包含公有部分代码(2.21.2 开始会区分公共部分/页面和组件的部分),页面和组件的代码注入的时间会包含在 `firstRender` 中(因为页面和组件的代码注入过程成为了首次渲染过程的一部分)。因此开启按需注入后,脚本耗时降低,渲染时间提高属于正常现象,优化效果可以关注整体启动耗时(`appLaunch`)来评估。
  20758. * - firstPaint 和 firstContentfulPaint 指标在开启 vConsole 的情况下,由于绘制 vConsole 面板,会导致数据提前。 */
  20759. getPerformance(): Performance
  20760. /** [[PreDownloadSubpackageTask](https://developers.weixin.qq.com/miniprogram/dev/api/base/subpackage/PreDownloadSubpackageTask.html) wx.preDownloadSubpackage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/subpackage/wx.preDownloadSubpackage.html)
  20761. *
  20762. * 需要基础库: `2.27.3`
  20763. *
  20764. * 在插件中使用:不支持
  20765. *
  20766. * 触发分包预下载。
  20767. *
  20768. * **示例代码**
  20769. *
  20770. * ```js
  20771. // 首先要在 app.json / game.json 中配置workers作为分包
  20772. {
  20773. "workers": {
  20774. "path": "myWorkersFolder",
  20775. "isSubpackage": true // true 表示把 worker 打包为分包。默认 false。填 false 时等同于 { "workers": "myWorkersFolder" }
  20776. }
  20777. }
  20778. ```
  20779. * ```js
  20780. // 然后调用 wx.preDownloadSubpackage 下载 worker 分包,下载成功后才可以创建 worker
  20781. var task = wx.preDownloadSubpackage({
  20782. packageType: "workers",
  20783. success(res) {
  20784. console.log("load worker success", res)
  20785. wx.createWorker("myWorkersFolder/request/index.js") // 创建 worker。 如果 worker 分包没下载完就调 createWorker 的话将报错
  20786. },
  20787. fail(res) {
  20788. console.log("load worker fail", res)
  20789. }
  20790. })
  20791. task.onProgressUpdate(res => {
  20792. console.log(res.progress) // 可通过 onProgressUpdate 接口监听下载进度
  20793. console.log(res.totalBytesWritten)
  20794. console.log(res.totalBytesExpectedToWrite)
  20795. })
  20796. ``` */
  20797. preDownloadSubpackage(
  20798. option: PreDownloadSubpackageOption
  20799. ): PreDownloadSubpackageTask
  20800. /** [[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)
  20801. *
  20802. * 需要基础库: `2.7.1`
  20803. *
  20804. * 在插件中使用:需要基础库 `2.16.0`
  20805. *
  20806. * 获取实时日志管理器对象。
  20807. *
  20808. * **示例代码**
  20809. *
  20810. * ```js
  20811. // 小程序端
  20812. const logger = wx.getRealtimeLogManager()
  20813. logger.info({str: 'hello world'}, 'info log', 100, [1, 2, 3])
  20814. logger.error({str: 'hello world'}, 'error log', 100, [1, 2, 3])
  20815. logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3])
  20816. // 插件端,基础库 2.16.0 版本后支持,只允许采用 key-value 的新格式上报
  20817. const logManager = wx.getRealtimeLogManager()
  20818. const logger = logManager.tag('plugin-log1')
  20819. logger.info('key1', 'value1')
  20820. logger.error('key2', {str: 'value2'})
  20821. logger.warn('key3', 'value3')
  20822. ``` */
  20823. getRealtimeLogManager(): RealtimeLogManager
  20824. /** [[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)
  20825. *
  20826. * 需要基础库: `1.6.0`
  20827. *
  20828. * 在插件中使用:需要基础库 `1.9.94`
  20829. *
  20830. * 获取**全局唯一**的录音管理器 RecorderManager */
  20831. getRecorderManager(): RecorderManager
  20832. /** [[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)
  20833. *
  20834. * 在插件中使用:需要基础库 `1.9.6`
  20835. *
  20836. * 发起 HTTPS 网络请求。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
  20837. *
  20838. * **data 参数说明**
  20839. *
  20840. * 最终发送给服务器的数据是 String 类型,如果传入的 data 不是 String 类型,会被转换成 String 。转换规则如下:
  20841. * - 对于 `GET` 方法的数据,会将数据转换成 query string(`encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...`)
  20842. * - 对于 `POST` 方法且 `header['content-type']` 为 `application/json` 的数据,会对数据进行 JSON 序列化
  20843. * - 对于 `POST` 方法且 `header['content-type']` 为 `application/x-www-form-urlencoded` 的数据,会将数据转换成 query string `(encodeURIComponent(k)=encodeURIComponent(v)&encodeURIComponent(k)=encodeURIComponent(v)...)`
  20844. *
  20845. * **示例代码**
  20846. *
  20847. * ```js
  20848. wx.request({
  20849. url: 'example.php', //仅为示例,并非真实的接口地址
  20850. data: {
  20851. x: '',
  20852. y: ''
  20853. },
  20854. header: {
  20855. 'content-type': 'application/json' // 默认值
  20856. },
  20857. success (res) {
  20858. console.log(res.data)
  20859. }
  20860. })
  20861. ``` */
  20862. request<
  20863. T extends string | IAnyObject | ArrayBuffer =
  20864. | string
  20865. | IAnyObject
  20866. | ArrayBuffer
  20867. >(
  20868. option: RequestOption<T>
  20869. ): RequestTask
  20870. /** [[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)
  20871. *
  20872. * 需要基础库: `2.0.4`
  20873. *
  20874. * 在插件中使用:需要基础库 `2.8.1`
  20875. *
  20876. * 创建激励视频广告组件。请通过 [wx.getSystemInfoSync()](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoSync.html) 返回对象的 SDKVersion 判断基础库版本号后再使用该 API(小游戏端要求 >= 2.0.4, 小程序端要求 >= 2.6.0)。调用该方法创建的激励视频广告是一个单例(小游戏端是全局单例,小程序端是页面内单例,在小程序端的单例对象不允许跨页面使用)。 */
  20877. createRewardedVideoAd(
  20878. option: CreateRewardedVideoAdOption
  20879. ): RewardedVideoAd
  20880. /** [[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)
  20881. *
  20882. * 需要基础库: `1.4.0`
  20883. *
  20884. * 在插件中使用:需要基础库 `1.9.6`
  20885. *
  20886. * 返回一个 SelectorQuery 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createSelectorQuery()` 来代替。
  20887. *
  20888. * **示例代码**
  20889. *
  20890. * ```js
  20891. const query = wx.createSelectorQuery()
  20892. query.select('#the-id').boundingClientRect()
  20893. query.selectViewport().scrollOffset()
  20894. query.exec(function(res){
  20895. res[0].top // #the-id节点的上边界坐标
  20896. res[1].scrollTop // 显示区域的竖直滚动位置
  20897. })
  20898. ``` */
  20899. createSelectorQuery(): SelectorQuery
  20900. /** [[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)
  20901. *
  20902. * 在插件中使用:需要基础库 `1.9.6`
  20903. *
  20904. * @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
  20905. *
  20906. * 创建一个 WebSocket 连接。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
  20907. *
  20908. * **并发数**
  20909. *
  20910. * - 1.7.0 及以上版本,最多可以同时存在 5 个 WebSocket 连接。
  20911. * - 1.7.0 以下版本,一个小程序同时只能有一个 WebSocket 连接,如果当前已存在一个 WebSocket 连接,会自动关闭该连接,并重新创建一个 WebSocket 连接。
  20912. *
  20913. * **示例代码**
  20914. *
  20915. * ```js
  20916. wx.connectSocket({
  20917. url: 'wss://example.qq.com',
  20918. header:{
  20919. 'content-type': 'application/json'
  20920. }
  20921. })
  20922. ``` */
  20923. connectSocket(option: ConnectSocketOption): SocketTask
  20924. /** [[TCPSocket](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/TCPSocket.html) wx.createTCPSocket()](https://developers.weixin.qq.com/miniprogram/dev/api/network/tcp/wx.createTCPSocket.html)
  20925. *
  20926. * 需要基础库: `2.18.0`
  20927. *
  20928. * 在插件中使用:支持
  20929. *
  20930. * 创建一个 TCP Socket 实例。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
  20931. *
  20932. * **连接限制**
  20933. *
  20934. * - 允许与局域网内的非本机 IP 通信
  20935. * - 允许与配置过的服务器域名通信,详见[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)
  20936. * - 禁止与以下端口号连接:`1024 以下` `1099` `1433` `1521` `1719` `1720` `1723` `2049` `2375` `3128` `3306` `3389` `3659` `4045` `5060` `5061` `5432` `5984` `6379` `6000` `6566` `7001` `7002` `8000-8100` `8443` `8888` `9200` `9300` `10051` `10080` `11211` `27017` `27018` `27019`
  20937. * - 每 5 分钟内最多创建 20 个 TCPSocket */
  20938. createTCPSocket(): TCPSocket
  20939. /** [[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)
  20940. *
  20941. * 需要基础库: `2.7.0`
  20942. *
  20943. * 在插件中使用:需要基础库 `2.11.1`
  20944. *
  20945. * 创建一个 UDP Socket 实例。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。 */
  20946. createUDPSocket(): UDPSocket
  20947. /** [[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)
  20948. *
  20949. * 需要基础库: `1.9.90`
  20950. *
  20951. * 在插件中使用:不支持
  20952. *
  20953. * 获取**全局唯一**的版本更新管理器,用于管理小程序更新。关于小程序的更新机制,可以查看[运行机制](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/operating-mechanism.html)文档。
  20954. *
  20955. * **示例代码**
  20956. *
  20957. * [示例代码](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html#示例代码) */
  20958. getUpdateManager(): UpdateManager
  20959. /** [[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)
  20960. *
  20961. * 在插件中使用:需要基础库 `1.9.6`
  20962. *
  20963. * 将本地资源上传到服务器。客户端发起一个 HTTPS POST 请求,其中 `content-type` 为 `multipart/form-data`。使用前请注意阅读[相关说明](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html)。
  20964. *
  20965. * **示例代码**
  20966. *
  20967. * ```js
  20968. wx.chooseImage({
  20969. success (res) {
  20970. const tempFilePaths = res.tempFilePaths
  20971. wx.uploadFile({
  20972. url: 'https://example.weixin.qq.com/upload', //仅为示例,非真实的接口地址
  20973. filePath: tempFilePaths[0],
  20974. name: 'file',
  20975. formData: {
  20976. 'user': 'test'
  20977. },
  20978. success (res){
  20979. const data = res.data
  20980. //do something
  20981. }
  20982. })
  20983. }
  20984. })
  20985. ``` */
  20986. uploadFile(option: UploadFileOption): UploadTask
  20987. /** [[UserCryptoManager](https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/UserCryptoManager.html) wx.getUserCryptoManager()](https://developers.weixin.qq.com/miniprogram/dev/api/base/crypto/wx.getUserCryptoManager.html)
  20988. *
  20989. * 需要基础库: `2.17.3`
  20990. *
  20991. * 在插件中使用:不支持
  20992. *
  20993. * 获取用户加密模块 */
  20994. getUserCryptoManager(): UserCryptoManager
  20995. /** [[VKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.html) wx.createVKSession(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html)
  20996. *
  20997. * 需要基础库: `2.20.0`
  20998. *
  20999. * 在插件中使用:需要基础库 `2.20.0`
  21000. *
  21001. * 创建 vision kit 会话对象。详见[指南](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/base.html)
  21002. *
  21003. * **示例代码**
  21004. *
  21005. * v1 版本:[VisionKit基础能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/visionkit-basic)
  21006. * v2 版本:[VisionKit-v2基础能力使用参考](https://github.com/wechat-miniprogram/miniprogram-demo/tree/master/miniprogram/packageAPI/pages/ar/visionkit-basic-v2)
  21007. * ```js
  21008. // 以下 demo 以 v2 为例
  21009. // 创建 session 对象
  21010. const ssession = wx.createVKSession({
  21011. track: {
  21012. plane: {mode: 3},
  21013. },
  21014. version: 'v2',
  21015. gl, // WebGLRenderingContext
  21016. })
  21017. // 逐帧分析
  21018. const onFrame = timestamp => {
  21019. // 开发者可以自己控制帧率
  21020. const frame = session.getVKFrame(canvasWidth, canvasHeight)
  21021. if (frame) {
  21022. // 分析完毕,可以拿到帧对象
  21023. doRender(frame)
  21024. }
  21025. session.requestAnimationFrame(onFrame)
  21026. }
  21027. session.start(err => {
  21028. if (!err) session.requestAnimationFrame(onFrame)
  21029. })
  21030. // 渲染函数
  21031. const doRender = frame => {
  21032. // ...
  21033. }
  21034. ``` */
  21035. createVKSession(option: VKConfig): VKSession
  21036. /** [[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)
  21037. *
  21038. * 在插件中使用:需要基础库 `1.9.6`
  21039. *
  21040. * 创建 [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 对象。 */
  21041. createVideoContext(
  21042. /** [video](https://developers.weixin.qq.com/miniprogram/dev/component/video.html) 组件的 id */
  21043. id: string,
  21044. /** 在自定义组件下,当前组件实例的this,以操作组件内 [video](https://developers.weixin.qq.com/miniprogram/dev/component/video.html) 组件 */
  21045. component?: Component.TrivialInstance | Page.TrivialInstance
  21046. ): VideoContext
  21047. /** [[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)
  21048. *
  21049. * 需要基础库: `2.11.0`
  21050. *
  21051. * 在插件中使用:需要基础库 `2.11.0`
  21052. *
  21053. * 创建视频解码器,可逐帧获取解码后的数据 */
  21054. createVideoDecoder(): VideoDecoder
  21055. /** [[WebAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/WebAudioContext.html) wx.createWebAudioContext()](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createWebAudioContext.html)
  21056. *
  21057. * 需要基础库: `2.19.0`
  21058. *
  21059. * 在插件中使用:不支持
  21060. *
  21061. * 创建 WebAudio 上下文。 */
  21062. createWebAudioContext(): WebAudioContext
  21063. /** [[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)
  21064. *
  21065. * 需要基础库: `1.9.90`
  21066. *
  21067. * 在插件中使用:需要基础库 `2.18.1`
  21068. *
  21069. * 创建一个 Worker 线程
  21070. *
  21071. * **示例代码**
  21072. *
  21073. * ```js
  21074. // 创建普通worker
  21075. wx.createWorker('workers/index.js')
  21076. ```
  21077. * ```js
  21078. function createNewWorker() {
  21079. const worker = wx.createWorker('workers/index.js', {
  21080. useExperimentalWorker: true
  21081. })
  21082. // 监听worker被系统回收事件
  21083. worker.onProcessKilled(() => {
  21084. // 重新创建一个worker
  21085. createNewWorker()
  21086. })
  21087. }
  21088. // 创建实验worker
  21089. createNewWorker()
  21090. ``` */
  21091. createWorker(
  21092. /** worker 入口文件的**绝对路径** */
  21093. scriptPath: string,
  21094. /** 可选参数 */
  21095. options?: CreateWorkerOption
  21096. ): Worker
  21097. /** [any wx.getStorageSync(string key)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageSync.html)
  21098. *
  21099. * 在插件中使用:需要基础库 `1.9.6`
  21100. *
  21101. * 从本地缓存中同步获取指定 key 的内容。
  21102. *
  21103. * **注意**
  21104. *
  21105. * storage 应只用来进行数据的持久化存储,不应用于运行时的数据传递或全局状态管理。启动过程中过多的同步读写存储,会显著影响启动耗时。
  21106. *
  21107. * **示例代码**
  21108. *
  21109. * ```js
  21110. try {
  21111. var value = wx.getStorageSync('key')
  21112. if (value) {
  21113. // Do something with return value
  21114. }
  21115. } catch (e) {
  21116. // Do something when catch error
  21117. }
  21118. ``` */
  21119. getStorageSync<T = any>(
  21120. /** 本地缓存中指定的 key */
  21121. key: string
  21122. ): T
  21123. /** [boolean wx.canIUse(string schema)](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.canIUse.html)
  21124. *
  21125. * 需要基础库: `1.1.1`
  21126. *
  21127. * 在插件中使用:不支持
  21128. *
  21129. * 判断小程序的API,回调,参数,组件等是否在当前版本可用。
  21130. *
  21131. * **参数说明**
  21132. *
  21133. * - `${API}` 代表 API 名字
  21134. * - `${method}` 代表调用方式,有效值为return, success, object, callback
  21135. * - `${param}` 代表参数或者返回值
  21136. * - `${option}` 代表参数的可选值或者返回值的属性
  21137. * - `${component}` 代表组件名字
  21138. * - `${attribute}` 代表组件属性
  21139. * - `${option}` 代表组件属性的可选值
  21140. *
  21141. * **示例代码**
  21142. *
  21143. * ```js
  21144. // 对象的属性或方法
  21145. wx.canIUse('console.log')
  21146. wx.canIUse('CameraContext.onCameraFrame')
  21147. wx.canIUse('CameraFrameListener.start')
  21148. wx.canIUse('Image.src')
  21149. // wx接口参数、回调或者返回值
  21150. wx.canIUse('openBluetoothAdapter')
  21151. wx.canIUse('getSystemInfoSync.return.safeArea.left')
  21152. wx.canIUse('getSystemInfo.success.screenWidth')
  21153. wx.canIUse('showToast.object.image')
  21154. wx.canIUse('onCompassChange.callback.direction')
  21155. wx.canIUse('request.object.method.GET')
  21156. // 组件的属性
  21157. wx.canIUse('live-player')
  21158. wx.canIUse('text.selectable')
  21159. wx.canIUse('button.open-type.contact')
  21160. ``` */
  21161. canIUse(
  21162. /** 使用 `${API}.${method}.${param}.${option}` 或者 `${component}.${attribute}.${option}` 方式来调用 */
  21163. schema: string
  21164. ): boolean
  21165. /** [boolean wx.checkIsPictureInPictureActive()](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.checkIsPictureInPictureActive.html)
  21166. *
  21167. * 需要基础库: `2.29.2`
  21168. *
  21169. * 在插件中使用:不支持
  21170. *
  21171. * 返回当前是否存在小窗播放(小窗在 video/live-player/live-pusher 下可用) */
  21172. checkIsPictureInPictureActive(): boolean
  21173. /** [boolean wx.isVKSupport(string version)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.isVKSupport.html)
  21174. *
  21175. * 需要基础库: `2.22.0`
  21176. *
  21177. * 在插件中使用:需要基础库 `2.22.0`
  21178. *
  21179. * 判断支持版本
  21180. *
  21181. * **示例代码**
  21182. *
  21183. * ```js
  21184. const isSupportV2 = wx.isVKSupport('v2')
  21185. ``` */
  21186. isVKSupport(
  21187. /** 参数 version 可选值:
  21188. * - 'v1': 旧版本;
  21189. * - 'v2': v2 版本,目前只有 iOS 基础库 2.22.0 以上支持; */
  21190. version: 'v1' | 'v2'
  21191. ): boolean
  21192. /** [string wx.arrayBufferToBase64(ArrayBuffer arrayBuffer)](https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.arrayBufferToBase64.html)
  21193. *
  21194. * 需要基础库: `1.1.0`
  21195. *
  21196. * 在插件中使用:支持
  21197. * @deprecated 基础库版本 [2.4.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃
  21198. *
  21199. * 将 ArrayBuffer 对象转成 Base64 字符串 */
  21200. arrayBufferToBase64(
  21201. /** 要转换成 Base64 字符串的 ArrayBuffer 对象 */
  21202. arrayBuffer: ArrayBuffer
  21203. ): string
  21204. /** [string wx.createBufferURL(ArrayBuffer|TypedArray buffer)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.createBufferURL.html)
  21205. *
  21206. * 需要基础库: `2.14.0`
  21207. *
  21208. * 在插件中使用:不支持
  21209. *
  21210. * 根据传入的 buffer 创建一个唯一的 URL 存在内存中 */
  21211. createBufferURL(
  21212. /** 需要存入内存的二进制数据 */
  21213. buffer:
  21214. | ArrayBuffer
  21215. | Int8Array
  21216. | Uint8Array
  21217. | Uint8ClampedArray
  21218. | Int16Array
  21219. | Uint16Array
  21220. | Int32Array
  21221. | Uint32Array
  21222. | Float32Array
  21223. | Float64Array
  21224. ): string
  21225. /** [string wx.getApiCategory()](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.getApiCategory.html)
  21226. *
  21227. * 需要基础库: `2.33.0`
  21228. *
  21229. * 在插件中使用:不支持
  21230. *
  21231. * 获取当前 API 类别
  21232. *
  21233. * **不同 apiCategory 场景下的 API 限制**
  21234. *
  21235. * `X` 表示 API 被限制无法使用;不在表格中的 API 不限制。
  21236. *
  21237. * | | default | nativeFunctionalized | browseOnly | embedded |
  21238. * |-|-|-|-|-|
  21239. * |navigateToMiniProgram | | `X` | `X` | |
  21240. * |openSetting | | | `X` | |
  21241. * |&lt;button open-type="share"&gt; | | `X` | `X` | `X` |
  21242. * |&lt;button open-type="feedback"&gt; | | | `X` | |
  21243. * |&lt;button open-type="open-setting"&gt;| | | `X` | |
  21244. * |openEmbeddedMiniProgram | | `X` | `X` | `X` | */
  21245. getApiCategory(): string
  21246. /** [wx.addCard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/card/wx.addCard.html)
  21247. *
  21248. * 需要基础库: `1.1.0`
  21249. *
  21250. * 在插件中使用:不支持
  21251. *
  21252. * 批量添加卡券。只有通过 [认证](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)。
  21253. *
  21254. * **cardExt 说明**
  21255. *
  21256. * cardExt 是卡券的扩展参数,其值是一个 JSON 字符串。
  21257. *
  21258. * **示例代码**
  21259. *
  21260. * ```js
  21261. wx.addCard({
  21262. cardList: [
  21263. {
  21264. cardId: '',
  21265. cardExt: '{"code": "", "openid": "", "timestamp": "", "signature":""}'
  21266. }, {
  21267. cardId: '',
  21268. cardExt: '{"code": "", "openid": "", "timestamp": "", "signature":""}'
  21269. }
  21270. ],
  21271. success (res) {
  21272. console.log(res.cardList) // 卡券添加结果
  21273. }
  21274. })
  21275. ``` */
  21276. addCard<T extends AddCardOption = AddCardOption>(
  21277. option: T
  21278. ): PromisifySuccessResult<T, AddCardOption>
  21279. /** [wx.addFileToFavorites(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/favorites/wx.addFileToFavorites.html)
  21280. *
  21281. * 需要基础库: `2.16.1`
  21282. *
  21283. * 在插件中使用:不支持
  21284. *
  21285. * 收藏文件 */
  21286. addFileToFavorites<
  21287. T extends AddFileToFavoritesOption = AddFileToFavoritesOption
  21288. >(
  21289. option: T
  21290. ): PromisifySuccessResult<T, AddFileToFavoritesOption>
  21291. /** [wx.addPhoneCalendar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneCalendar.html)
  21292. *
  21293. * 需要基础库: `2.15.0`
  21294. *
  21295. * 在插件中使用:不支持
  21296. *
  21297. * 向系统日历添加事件 */
  21298. addPhoneCalendar<
  21299. T extends AddPhoneCalendarOption = AddPhoneCalendarOption
  21300. >(
  21301. option: T
  21302. ): PromisifySuccessResult<T, AddPhoneCalendarOption>
  21303. /** [wx.addPhoneContact(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.addPhoneContact.html)
  21304. *
  21305. * 需要基础库: `1.2.0`
  21306. *
  21307. * 在插件中使用:需要基础库 `1.9.6`
  21308. *
  21309. * 添加手机通讯录联系人。用户可以选择将该表单以「新增联系人」或「添加到已有联系人」的方式,写入手机系统通讯录。 */
  21310. addPhoneContact<
  21311. T extends AddPhoneContactOption = AddPhoneContactOption
  21312. >(
  21313. option: T
  21314. ): PromisifySuccessResult<T, AddPhoneContactOption>
  21315. /** [wx.addPhoneRepeatCalendar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/calendar/wx.addPhoneRepeatCalendar.html)
  21316. *
  21317. * 需要基础库: `2.15.0`
  21318. *
  21319. * 在插件中使用:不支持
  21320. *
  21321. * 向系统日历添加重复事件 */
  21322. addPhoneRepeatCalendar<
  21323. T extends AddPhoneRepeatCalendarOption = AddPhoneRepeatCalendarOption
  21324. >(
  21325. option: T
  21326. ): PromisifySuccessResult<T, AddPhoneRepeatCalendarOption>
  21327. /** [wx.addVideoToFavorites(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/favorites/wx.addVideoToFavorites.html)
  21328. *
  21329. * 需要基础库: `2.16.1`
  21330. *
  21331. * 在插件中使用:不支持
  21332. *
  21333. * 收藏视频 */
  21334. addVideoToFavorites<
  21335. T extends AddVideoToFavoritesOption = AddVideoToFavoritesOption
  21336. >(
  21337. option: T
  21338. ): PromisifySuccessResult<T, AddVideoToFavoritesOption>
  21339. /** [wx.authPrivateMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.authPrivateMessage.html)
  21340. *
  21341. * 需要基础库: `2.13.0`
  21342. *
  21343. * 在插件中使用:不支持
  21344. *
  21345. * 验证私密消息。用法详情见 [小程序私密消息使用指南](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share/private-message.html)
  21346. *
  21347. * **示例代码**
  21348. *
  21349. * ```js
  21350. wx.authPrivateMessage({
  21351. shareTicket: 'xxxxxx',
  21352. success(res) {
  21353. console.log('authPrivateMessage success', res)
  21354. // res
  21355. // {
  21356. // errMsg: 'authPrivateMessage:ok'
  21357. // valid: true
  21358. // iv: 'xxxx',
  21359. // encryptedData: 'xxxxxx'
  21360. // }
  21361. },
  21362. fail(res) {
  21363. console.log('authPrivateMessage fail', res)
  21364. }
  21365. })
  21366. ``` */
  21367. authPrivateMessage(option?: AuthPrivateMessageOption): void
  21368. /** [wx.authorize(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorize.html)
  21369. *
  21370. * 需要基础库: `1.2.0`
  21371. *
  21372. * 在插件中使用:不支持
  21373. *
  21374. * 提前向用户发起授权请求。调用后会立刻弹窗询问用户是否同意授权小程序使用某项功能或获取用户的某些数据,但不会实际调用对应接口。如果用户之前已经同意授权,则不会出现弹窗,直接返回成功。更多用法详见 [用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)。
  21375. * > 小程序插件可以使用 [wx.authorizeForMiniProgram](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorizeForMiniProgram.html)
  21376. *
  21377. * **示例代码**
  21378. *
  21379. * ```js
  21380. // 可以通过 wx.getSetting 先查询一下用户是否授权了 "scope.record" 这个 scope
  21381. wx.getSetting({
  21382. success(res) {
  21383. if (!res.authSetting['scope.record']) {
  21384. wx.authorize({
  21385. scope: 'scope.record',
  21386. success () {
  21387. // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
  21388. wx.startRecord()
  21389. }
  21390. })
  21391. }
  21392. }
  21393. })
  21394. ``` */
  21395. authorize<T extends AuthorizeOption = AuthorizeOption>(
  21396. option: T
  21397. ): PromisifySuccessResult<T, AuthorizeOption>
  21398. /** [wx.authorizeForMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorizeForMiniProgram.html)
  21399. *
  21400. * 需要基础库: `2.14.4`
  21401. *
  21402. * 在插件中使用:需要基础库 `2.14.4`
  21403. *
  21404. * **仅小程序插件中能调用该接口**,用法同 [wx.authorize](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/authorize/wx.authorize.html)。目前仅支持三种 scope(见下)
  21405. *
  21406. * **示例代码**
  21407. *
  21408. * ```js
  21409. wx.authorizeForMiniProgram({
  21410. scope: 'scope.record',
  21411. success () {
  21412. // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
  21413. wx.startRecord()
  21414. }
  21415. })
  21416. ``` */
  21417. authorizeForMiniProgram(option: AuthorizeForMiniProgramOption): void
  21418. /** [wx.batchGetStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchGetStorage.html)
  21419. *
  21420. * 需要基础库: `2.25.0`
  21421. *
  21422. * 在插件中使用:不支持
  21423. *
  21424. * 从本地缓存中异步批量获取指定 key 的内容。
  21425. *
  21426. * **示例代码**
  21427. *
  21428. * ```js
  21429. wx.batchGetStorage({
  21430. keyList: ['key'],
  21431. success (res) {
  21432. console.log(res)
  21433. }
  21434. })
  21435. ``` */
  21436. batchGetStorage<
  21437. T extends BatchGetStorageOption = BatchGetStorageOption
  21438. >(
  21439. option: T
  21440. ): PromisifySuccessResult<T, BatchGetStorageOption>
  21441. /** [wx.batchSetStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchSetStorage.html)
  21442. *
  21443. * 需要基础库: `2.25.0`
  21444. *
  21445. * 在插件中使用:需要基础库 `1.9.6`
  21446. *
  21447. * 将数据批量存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
  21448. *
  21449. * **示例代码**
  21450. *
  21451. * ```js
  21452. wx.setStorage({
  21453. key:"key",
  21454. data:"value"
  21455. })
  21456. ```
  21457. *
  21458. * ```js
  21459. // 开启加密存储
  21460. wx.batchSetStorage({
  21461. kvList: [{
  21462. key: 'key',
  21463. value: 'value',
  21464. }],
  21465. })
  21466. ``` */
  21467. batchSetStorage<
  21468. T extends BatchSetStorageOption = BatchSetStorageOption
  21469. >(
  21470. option: T
  21471. ): PromisifySuccessResult<T, BatchSetStorageOption>
  21472. /** [wx.batchSetStorageSync(Array.&lt;Object&gt; kvList)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.batchSetStorageSync.html)
  21473. *
  21474. * 需要基础库: `2.25.0`
  21475. *
  21476. * 在插件中使用:需要基础库 `1.9.6`
  21477. *
  21478. * 将数据批量存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
  21479. *
  21480. * **示例代码**
  21481. *
  21482. * ```js
  21483. try {
  21484. wx.batchSetStorageSync([{key: 'key', value: 'value'}])
  21485. } catch (e) { }
  21486. ``` */
  21487. batchSetStorageSync(kvList: KvList[]): void
  21488. /** [wx.canvasGetImageData(Object object, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasGetImageData.html)
  21489. *
  21490. * 需要基础库: `1.9.0`
  21491. *
  21492. * 在插件中使用:需要基础库 `1.9.6`
  21493. *
  21494. * 获取 canvas 区域隐含的像素数据。
  21495. *
  21496. * **示例代码**
  21497. *
  21498. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/yufmRjmZ7W8f)
  21499. *
  21500. * ```js
  21501. wx.canvasGetImageData({
  21502. canvasId: 'myCanvas',
  21503. x: 0,
  21504. y: 0,
  21505. width: 100,
  21506. height: 100,
  21507. success(res) {
  21508. console.log(res.width) // 100
  21509. console.log(res.height) // 100
  21510. console.log(res.data instanceof Uint8ClampedArray) // true
  21511. console.log(res.data.length) // 100 * 100 * 4
  21512. }
  21513. })
  21514. ``` */
  21515. canvasGetImageData<
  21516. T extends CanvasGetImageDataOption = CanvasGetImageDataOption
  21517. >(
  21518. option: T,
  21519. /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 */
  21520. component?: Component.TrivialInstance | Page.TrivialInstance
  21521. ): PromisifySuccessResult<T, CanvasGetImageDataOption>
  21522. /** [wx.canvasPutImageData(Object object, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasPutImageData.html)
  21523. *
  21524. * 需要基础库: `1.9.0`
  21525. *
  21526. * 在插件中使用:需要基础库 `1.9.6`
  21527. *
  21528. * 将像素数据绘制到画布。在自定义组件下,第二个参数传入自定义组件实例 this,以操作组件内 <canvas> 组件 */
  21529. canvasPutImageData<
  21530. T extends CanvasPutImageDataOption = CanvasPutImageDataOption
  21531. >(
  21532. option: T,
  21533. /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 */
  21534. component?: Component.TrivialInstance | Page.TrivialInstance
  21535. ): PromisifySuccessResult<T, CanvasPutImageDataOption>
  21536. /** [wx.canvasToTempFilePath(Object object, Object this)](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/wx.canvasToTempFilePath.html)
  21537. *
  21538. * 在插件中使用:需要基础库 `1.9.6`
  21539. *
  21540. * 把当前画布指定区域的内容导出生成指定大小的图片。在 `draw()` 回调里调用该方法才能保证图片导出成功。暂不支持离屏 canvas。 */
  21541. canvasToTempFilePath<
  21542. T extends CanvasToTempFilePathOption = CanvasToTempFilePathOption
  21543. >(
  21544. option: T,
  21545. /** 在自定义组件下,当前组件实例的this,以操作组件内 [canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 组件 */
  21546. component?: Component.TrivialInstance | Page.TrivialInstance
  21547. ): PromisifySuccessResult<T, CanvasToTempFilePathOption>
  21548. /** [wx.checkIsAddedToMyMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/my-miniprogram/wx.checkIsAddedToMyMiniProgram.html)
  21549. *
  21550. * 需要基础库: `2.29.1`
  21551. *
  21552. * 在插件中使用:不支持
  21553. *
  21554. * 检查小程序是否被添加至 「我的小程序」 */
  21555. checkIsAddedToMyMiniProgram(
  21556. option: CheckIsAddedToMyMiniProgramOption
  21557. ): void
  21558. /** [wx.checkIsOpenAccessibility(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accessibility/wx.checkIsOpenAccessibility.html)
  21559. *
  21560. * 需要基础库: `2.13.0`
  21561. *
  21562. * 在插件中使用:不支持
  21563. *
  21564. * 检测是否开启视觉无障碍功能。 */
  21565. checkIsOpenAccessibility<
  21566. T extends CheckIsOpenAccessibilityOption = CheckIsOpenAccessibilityOption
  21567. >(
  21568. option?: T
  21569. ): PromisifySuccessResult<T, CheckIsOpenAccessibilityOption>
  21570. /** [wx.checkIsSoterEnrolledInDevice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.checkIsSoterEnrolledInDevice.html)
  21571. *
  21572. * 需要基础库: `1.6.0`
  21573. *
  21574. * 在插件中使用:不支持
  21575. *
  21576. * 获取设备内是否录入如指纹等生物信息的接口
  21577. *
  21578. * **示例代码**
  21579. *
  21580. * ```js
  21581. wx.checkIsSoterEnrolledInDevice({
  21582. checkAuthMode: 'fingerPrint',
  21583. success(res) {
  21584. console.log(res.isEnrolled)
  21585. }
  21586. })
  21587. ``` */
  21588. checkIsSoterEnrolledInDevice<
  21589. T extends CheckIsSoterEnrolledInDeviceOption = CheckIsSoterEnrolledInDeviceOption
  21590. >(
  21591. option: T
  21592. ): PromisifySuccessResult<T, CheckIsSoterEnrolledInDeviceOption>
  21593. /** [wx.checkIsSupportSoterAuthentication(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.checkIsSupportSoterAuthentication.html)
  21594. *
  21595. * 需要基础库: `1.5.0`
  21596. *
  21597. * 在插件中使用:不支持
  21598. *
  21599. * 获取本机支持的 SOTER 生物认证方式
  21600. *
  21601. * **示例代码**
  21602. *
  21603. * ```js
  21604. wx.checkIsSupportSoterAuthentication({
  21605. success(res) {
  21606. // res.supportMode = [] 不具备任何被SOTER支持的生物识别方式
  21607. // res.supportMode = ['fingerPrint'] 只支持指纹识别
  21608. // res.supportMode = ['fingerPrint', 'facial'] 支持指纹识别和人脸识别
  21609. }
  21610. })
  21611. ``` */
  21612. checkIsSupportSoterAuthentication<
  21613. T extends CheckIsSupportSoterAuthenticationOption = CheckIsSupportSoterAuthenticationOption
  21614. >(
  21615. option?: T
  21616. ): PromisifySuccessResult<T, CheckIsSupportSoterAuthenticationOption>
  21617. /** [wx.checkSession(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.checkSession.html)
  21618. *
  21619. * 在插件中使用:不支持
  21620. *
  21621. * 检查登录态是否过期。
  21622. * 通过 wx.login 接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能失效。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。开发者只需要调用 wx.checkSession 接口检测当前用户登录态是否有效。
  21623. *
  21624. * 登录态过期后开发者可以再调用 wx.login 获取新的用户登录态。调用成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。
  21625. *
  21626. * **示例代码**
  21627. *
  21628. * ```js
  21629. wx.checkSession({
  21630. success () {
  21631. //session_key 未过期,并且在本生命周期一直有效
  21632. },
  21633. fail () {
  21634. // session_key 已经失效,需要重新执行登录流程
  21635. wx.login() //重新登录
  21636. }
  21637. })
  21638. ``` */
  21639. checkSession<T extends CheckSessionOption = CheckSessionOption>(
  21640. option?: T
  21641. ): PromisifySuccessResult<T, CheckSessionOption>
  21642. /** [wx.chooseAddress(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/address/wx.chooseAddress.html)
  21643. *
  21644. * 需要基础库: `1.1.0`
  21645. *
  21646. * 在插件中使用:需要基础库 `2.16.1`
  21647. *
  21648. * 获取用户收货地址。调起用户编辑收货地址原生界面,并在编辑完成后返回用户选择的地址。
  21649. * ## 使用方法
  21650. * 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
  21651. * ## 申请开通
  21652. * 暂只针对具备与地理位置强相关的使用场景的小程序开放,在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。
  21653. * 接口权限申请入口将于2022年3月11日开始内测,于3月31日全量上线。并从4月18日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
  21654. *
  21655. * **示例代码**
  21656. *
  21657. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/024hHnmd772y)
  21658. * ```js
  21659. wx.chooseAddress({
  21660. success (res) {
  21661. console.log(res.userName)
  21662. console.log(res.postalCode)
  21663. console.log(res.provinceName)
  21664. console.log(res.cityName)
  21665. console.log(res.countyName)
  21666. console.log(res.detailInfo)
  21667. console.log(res.nationalCode)
  21668. console.log(res.telNumber)
  21669. }
  21670. })
  21671. ``` */
  21672. chooseAddress<T extends ChooseAddressOption = ChooseAddressOption>(
  21673. option?: T
  21674. ): PromisifySuccessResult<T, ChooseAddressOption>
  21675. /** [wx.chooseContact(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/contact/wx.chooseContact.html)
  21676. *
  21677. * 需要基础库: `2.8.0`
  21678. *
  21679. * 在插件中使用:不支持
  21680. *
  21681. * 拉起手机通讯录,选择联系人。 */
  21682. chooseContact(option?: ChooseContactOption): void
  21683. /** [wx.chooseImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html)
  21684. *
  21685. * 在插件中使用:需要基础库 `1.9.6`
  21686. * @deprecated 基础库版本 [2.21.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.chooseMedia](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html) 替换
  21687. *
  21688. * 从本地相册选择图片或使用相机拍照。
  21689. *
  21690. * ****
  21691. *
  21692. * ```js
  21693. wx.chooseImage({
  21694. count: 1,
  21695. sizeType: ['original', 'compressed'],
  21696. sourceType: ['album', 'camera'],
  21697. success (res) {
  21698. // tempFilePath可以作为img标签的src属性显示图片
  21699. const tempFilePaths = res.tempFilePaths
  21700. }
  21701. })
  21702. ``` */
  21703. chooseImage<T extends ChooseImageOption = ChooseImageOption>(
  21704. option?: T
  21705. ): PromisifySuccessResult<T, ChooseImageOption>
  21706. /** [wx.chooseInvoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoice.html)
  21707. *
  21708. * 需要基础库: `2.3.0`
  21709. *
  21710. * 在插件中使用:需要基础库 `2.16.1`
  21711. *
  21712. * 选择用户已有的发票。
  21713. *
  21714. * **通过 cardId 和 encryptCode 获得报销发票的信息**
  21715. *
  21716. * 请参考[微信电子发票文档](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=21517918939oae3U)中,「查询报销发票信息」部分。
  21717. * 其中 `access_token` 的获取请参考[auth.getAccessToken](#)文档 */
  21718. chooseInvoice<T extends ChooseInvoiceOption = ChooseInvoiceOption>(
  21719. option?: T
  21720. ): PromisifySuccessResult<T, ChooseInvoiceOption>
  21721. /** [wx.chooseInvoiceTitle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/invoice/wx.chooseInvoiceTitle.html)
  21722. *
  21723. * 需要基础库: `1.5.0`
  21724. *
  21725. * 在插件中使用:需要基础库 `2.16.1`
  21726. *
  21727. * 选择用户的发票抬头。当前小程序必须关联一个公众号,且这个公众号是完成了[微信认证](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1496554031_RD4xe)的,才能调用 chooseInvoiceTitle。
  21728. *
  21729. * **示例代码**
  21730. *
  21731. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/GJ4S9nmQ7x2E)
  21732. *
  21733. * ```js
  21734. wx.chooseInvoiceTitle({
  21735. success(res) {}
  21736. })
  21737. ``` */
  21738. chooseInvoiceTitle<
  21739. T extends ChooseInvoiceTitleOption = ChooseInvoiceTitleOption
  21740. >(
  21741. option?: T
  21742. ): PromisifySuccessResult<T, ChooseInvoiceTitleOption>
  21743. /** [wx.chooseLicensePlate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/license-plate/wx.chooseLicensePlate.html)
  21744. *
  21745. * 需要基础库: `2.19.0`
  21746. *
  21747. * 在插件中使用:不支持
  21748. *
  21749. * 选择车牌号 */
  21750. chooseLicensePlate<
  21751. T extends ChooseLicensePlateOption = ChooseLicensePlateOption
  21752. >(
  21753. option?: T
  21754. ): PromisifySuccessResult<T, ChooseLicensePlateOption>
  21755. /** [wx.chooseLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.chooseLocation.html)
  21756. *
  21757. * 在插件中使用:需要基础库 `1.9.6`
  21758. *
  21759. * @warning **为确保选择地理位置接口的合理使用,位置接口调整参考 [选择地理位置接口调整公告](https://developers.weixin.qq.com/community/develop/doc/0006e45df2cac030e6edf367c56001)**
  21760. *
  21761. * 打开地图选择位置。
  21762. * ## 使用方法
  21763. * 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
  21764. * ## 申请开通
  21765. * 暂只针对具备与地理位置强相关的使用场景的小程序开放,在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。
  21766. * 接口权限申请入口将于2022年3月11日开始内测,于3月31日全量上线。并从4月18日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
  21767. *
  21768. * **示例**
  21769. *
  21770. * ![](https://res.wx.qq.com/op_res/WDFC8aB4FI8rJ9oEmbYfbH_Fl3EIv91471YVxezVfLRESkUuCgfODZcbOoyteKU4j-OLZa2EFKY9BDPd3g-tfg#width:260px) */
  21771. chooseLocation<T extends ChooseLocationOption = ChooseLocationOption>(
  21772. option: T
  21773. ): PromisifySuccessResult<T, ChooseLocationOption>
  21774. /** [wx.chooseMedia(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html)
  21775. *
  21776. * 需要基础库: `2.10.0`
  21777. *
  21778. * 在插件中使用:需要基础库 `2.11.1`
  21779. *
  21780. * 拍摄或从手机相册中选择图片或视频。
  21781. *
  21782. * **示例代码**
  21783. *
  21784. * ```js
  21785. wx.chooseMedia({
  21786. count: 9,
  21787. mediaType: ['image','video'],
  21788. sourceType: ['album', 'camera'],
  21789. maxDuration: 30,
  21790. camera: 'back',
  21791. success(res) {
  21792. console.log(res.tempFiles.tempFilePath)
  21793. console.log(res.tempFiles.size)
  21794. }
  21795. })
  21796. ``` */
  21797. chooseMedia<T extends ChooseMediaOption = ChooseMediaOption>(
  21798. option: T
  21799. ): PromisifySuccessResult<T, ChooseMediaOption>
  21800. /** [wx.chooseMessageFile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseMessageFile.html)
  21801. *
  21802. * 需要基础库: `2.5.0`
  21803. *
  21804. * 在插件中使用:不支持
  21805. *
  21806. * 从客户端会话选择文件。
  21807. *
  21808. * ****
  21809. *
  21810. * ```js
  21811. wx.chooseMessageFile({
  21812. count: 10,
  21813. type: 'image',
  21814. success (res) {
  21815. // tempFilePath可以作为img标签的src属性显示图片
  21816. const tempFilePaths = res.tempFiles
  21817. }
  21818. })
  21819. ``` */
  21820. chooseMessageFile<
  21821. T extends ChooseMessageFileOption = ChooseMessageFileOption
  21822. >(
  21823. option: T
  21824. ): PromisifySuccessResult<T, ChooseMessageFileOption>
  21825. /** [wx.choosePoi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.choosePoi.html)
  21826. *
  21827. * 在插件中使用:不支持
  21828. *
  21829. * @warning **为确保选择地理位置接口的合理使用,位置接口调整参考 [选择地理位置接口调整公告](https://developers.weixin.qq.com/community/develop/doc/0006e45df2cac030e6edf367c56001)**
  21830. *
  21831. * 打开POI列表选择位置,支持模糊定位(精确到市)和精确定位混选。
  21832. * ## 使用方法
  21833. * 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
  21834. * ## 申请开通
  21835. * 暂只针对具备与地理位置强相关的使用场景的小程序开放,在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。
  21836. * 接口权限申请入口将于2022年3月11日开始内测,于3月31日全量上线。并从4月18日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
  21837. *
  21838. * **示例**
  21839. *
  21840. * ![](https://res.wx.qq.com/op_res/lzDsNyBNifLczyLX0ms7ZpPQysgAgdhrQTGzzTQPiXkAB2HJIf1Slvl4rnN9I1q0AT3xqoGTg98jMsNexDLbbA#width:260px) */
  21841. choosePoi<T extends ChoosePoiOption = ChoosePoiOption>(
  21842. option: T
  21843. ): PromisifySuccessResult<T, ChoosePoiOption>
  21844. /** [wx.chooseVideo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseVideo.html)
  21845. *
  21846. * 在插件中使用:需要基础库 `1.9.6`
  21847. * @deprecated 基础库版本 [2.21.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃,请使用 [wx.chooseMedia](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html) 替换
  21848. *
  21849. * 拍摄视频或从手机相册中选视频。
  21850. *
  21851. * **示例代码**
  21852. *
  21853. * ```js
  21854. wx.chooseVideo({
  21855. sourceType: ['album','camera'],
  21856. maxDuration: 60,
  21857. camera: 'back',
  21858. success(res) {
  21859. console.log(res.tempFilePath)
  21860. }
  21861. })
  21862. ``` */
  21863. chooseVideo<T extends ChooseVideoOption = ChooseVideoOption>(
  21864. option: T
  21865. ): PromisifySuccessResult<T, ChooseVideoOption>
  21866. /** [wx.clearStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorage.html)
  21867. *
  21868. * 在插件中使用:不支持
  21869. *
  21870. * 清理本地数据缓存。
  21871. *
  21872. * **示例代码**
  21873. *
  21874. * ```js
  21875. wx.clearStorage()
  21876. ```
  21877. *
  21878. * ```js
  21879. try {
  21880. wx.clearStorageSync()
  21881. } catch(e) {
  21882. // Do something when catch error
  21883. }
  21884. ``` */
  21885. clearStorage<T extends ClearStorageOption = ClearStorageOption>(
  21886. option?: T
  21887. ): PromisifySuccessResult<T, ClearStorageOption>
  21888. /** [wx.clearStorageSync()](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorageSync.html)
  21889. *
  21890. * 在插件中使用:不支持
  21891. *
  21892. * [wx.clearStorage](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.clearStorage.html) 的同步版本
  21893. *
  21894. * **示例代码**
  21895. *
  21896. * ```js
  21897. wx.clearStorage()
  21898. ```
  21899. *
  21900. * ```js
  21901. try {
  21902. wx.clearStorageSync()
  21903. } catch(e) {
  21904. // Do something when catch error
  21905. }
  21906. ``` */
  21907. clearStorageSync(): void
  21908. /** [wx.closeBLEConnection(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.closeBLEConnection.html)
  21909. *
  21910. * 需要基础库: `1.1.0`
  21911. *
  21912. * 在插件中使用:需要基础库 `1.9.6`
  21913. *
  21914. * 断开与蓝牙低功耗设备的连接。
  21915. *
  21916. * **示例代码**
  21917. *
  21918. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  21919. * ```js
  21920. wx.closeBLEConnection({
  21921. deviceId,
  21922. success (res) {
  21923. console.log(res)
  21924. }
  21925. })
  21926. ``` */
  21927. closeBLEConnection<
  21928. T extends CloseBLEConnectionOption = CloseBLEConnectionOption
  21929. >(
  21930. option: T
  21931. ): PromisifySuccessResult<T, CloseBLEConnectionOption>
  21932. /** [wx.closeBluetoothAdapter(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.closeBluetoothAdapter.html)
  21933. *
  21934. * 需要基础库: `1.1.0`
  21935. *
  21936. * 在插件中使用:需要基础库 `1.9.6`
  21937. *
  21938. * 关闭蓝牙模块。调用该方法将断开所有已建立的连接并释放系统资源。建议在使用蓝牙流程后,与 [wx.openBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html) 成对调用。
  21939. *
  21940. * **示例代码**
  21941. *
  21942. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  21943. * ```js
  21944. wx.closeBluetoothAdapter({
  21945. success (res) {
  21946. console.log(res)
  21947. }
  21948. })
  21949. ``` */
  21950. closeBluetoothAdapter<
  21951. T extends CloseBluetoothAdapterOption = CloseBluetoothAdapterOption
  21952. >(
  21953. option?: T
  21954. ): PromisifySuccessResult<T, CloseBluetoothAdapterOption>
  21955. /** [wx.closeSocket(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.closeSocket.html)
  21956. *
  21957. * 在插件中使用:不支持
  21958. *
  21959. * @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
  21960. *
  21961. * 关闭 WebSocket 连接。
  21962. *
  21963. * **示例代码**
  21964. *
  21965. * ```js
  21966. wx.connectSocket({
  21967. url: 'test.php'
  21968. })
  21969. //注意这里有时序问题,
  21970. //如果 wx.connectSocket 还没回调 wx.onSocketOpen,而先调用 wx.closeSocket,那么就做不到关闭 WebSocket 的目的。
  21971. //必须在 WebSocket 打开期间调用 wx.closeSocket 才能关闭。
  21972. wx.onSocketOpen(function() {
  21973. wx.closeSocket()
  21974. })
  21975. wx.onSocketClose(function(res) {
  21976. console.log('WebSocket 已关闭!')
  21977. })
  21978. ``` */
  21979. closeSocket<T extends CloseSocketOption = CloseSocketOption>(
  21980. option?: T
  21981. ): PromisifySuccessResult<T, CloseSocketOption>
  21982. /** [wx.compressImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.compressImage.html)
  21983. *
  21984. * 需要基础库: `2.4.0`
  21985. *
  21986. * 在插件中使用:需要基础库 `2.12.0`
  21987. *
  21988. * 压缩图片接口,可选压缩质量
  21989. *
  21990. * **示例代码**
  21991. *
  21992. * ```js
  21993. wx.compressImage({
  21994. src: '', // 图片路径
  21995. quality: 80 // 压缩质量
  21996. })
  21997. ``` */
  21998. compressImage<T extends CompressImageOption = CompressImageOption>(
  21999. option: T
  22000. ): PromisifySuccessResult<T, CompressImageOption>
  22001. /** [wx.compressVideo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.compressVideo.html)
  22002. *
  22003. * 需要基础库: `2.11.0`
  22004. *
  22005. * 在插件中使用:需要基础库 `2.11.1`
  22006. *
  22007. * 压缩视频接口。开发者可指定压缩质量 `quality` 进行压缩。当需要更精细的控制时,可指定 `bitrate`、`fps`、和 `resolution`,当 `quality` 传入时,这三个参数将被忽略。原视频的相关信息可通过 [getVideoInfo](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.getVideoInfo.html) 获取。 */
  22008. compressVideo<T extends CompressVideoOption = CompressVideoOption>(
  22009. option: T
  22010. ): PromisifySuccessResult<T, CompressVideoOption>
  22011. /** [wx.connectWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.connectWifi.html)
  22012. *
  22013. * 需要基础库: `1.6.0`
  22014. *
  22015. * 在插件中使用:需要基础库 `2.9.1`
  22016. *
  22017. * 连接 Wi-Fi。若已知 Wi-Fi 信息,可以直接利用该接口连接。仅 Android 与 iOS 11 以上版本支持。
  22018. *
  22019. * **示例代码**
  22020. *
  22021. * ```js
  22022. wx.connectWifi({
  22023. SSID: '',
  22024. password: '',
  22025. success (res) {
  22026. console.log(res.errMsg)
  22027. }
  22028. })
  22029. ```
  22030. *
  22031. * **注意**
  22032. *
  22033. * - Android 微信客户端 7.0.22 以上版本,connectWifi 的实现在 Android 10 及以上的手机无法生效,对于 Android 10 及以上版本,设备连接 wifi 之后,(受系统能力限制)其他进程无法使用当前连接的 wifi ;即连接上的 wifi 只对当前小程序有效,如果想要对整个系统生效,需要配置 maunal 来连接 wifi。
  22034. * - iOS 系统底层没有给开发者提供因 wifi 密码错误而连接失败的事件,但用户可以收到密码错误的系统弹窗。建议开发者通过 onWifiConnected 事件来判断 wifi 是否连接成功;即设置定时器,若超时后仍没有 onWifiConnected 事件,则认定此次 wifi 连接无效。
  22035. * - Android / iOS 在系统已经连上目标 wifi 的情况下,小程序再次连接目标 wifi,此时无论输入的密码是否正确,系统都会默认此次连接成功,且没有 onWifiConnected 事件。
  22036. * - onWifiConnected 事件可能会返回空对象,此时代表 wifi 断开连接,开发者可忽略这种情况。 */
  22037. connectWifi<T extends ConnectWifiOption = ConnectWifiOption>(
  22038. option: T
  22039. ): PromisifySuccessResult<T, ConnectWifiOption>
  22040. /** [wx.createBLEConnection(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html)
  22041. *
  22042. * 需要基础库: `1.1.0`
  22043. *
  22044. * 在插件中使用:需要基础库 `1.9.6`
  22045. *
  22046. * 连接蓝牙低功耗设备。
  22047. *
  22048. * 若小程序在之前已有搜索过某个蓝牙设备,并成功建立连接,可直接传入之前搜索获取的 deviceId 直接尝试连接该设备,无需再次进行搜索操作。
  22049. *
  22050. * **注意**
  22051. *
  22052. * - 请保证尽量成对的调用 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 和 [wx.closeBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.closeBLEConnection.html) 接口。安卓如果重复调用 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 创建连接,有可能导致系统持有同一设备多个连接的实例,导致调用 `closeBLEConnection` 的时候并不能真正的断开与设备的连接。
  22053. * - 蓝牙连接随时可能断开,建议监听 [wx.onBLEConnectionStateChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLEConnectionStateChange.html) 回调事件,当蓝牙设备断开时按需执行重连操作
  22054. * - 若对未连接的设备或已断开连接的设备调用数据读写操作的接口,会返回 10006 错误,建议进行重连操作。
  22055. *
  22056. * **示例代码**
  22057. *
  22058. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  22059. * ```js
  22060. wx.createBLEConnection({
  22061. deviceId,
  22062. success (res) {
  22063. console.log(res)
  22064. }
  22065. })
  22066. ``` */
  22067. createBLEConnection<
  22068. T extends CreateBLEConnectionOption = CreateBLEConnectionOption
  22069. >(
  22070. option: T
  22071. ): PromisifySuccessResult<T, CreateBLEConnectionOption>
  22072. /** [wx.createBLEPeripheralServer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.createBLEPeripheralServer.html)
  22073. *
  22074. * 需要基础库: `2.10.3`
  22075. *
  22076. * 在插件中使用:需要基础库 `2.22.1`
  22077. *
  22078. * 建立本地作为蓝牙低功耗外围设备的服务端,可创建多个。 */
  22079. createBLEPeripheralServer<
  22080. T extends CreateBLEPeripheralServerOption = CreateBLEPeripheralServerOption
  22081. >(
  22082. option?: T
  22083. ): PromisifySuccessResult<T, CreateBLEPeripheralServerOption>
  22084. /** [wx.cropImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.cropImage.html)
  22085. *
  22086. * 需要基础库: `2.26.0`
  22087. *
  22088. * 在插件中使用:不支持
  22089. *
  22090. * 裁剪图片接口
  22091. *
  22092. * **示例代码**
  22093. *
  22094. * ```js
  22095. wx.cropImage({
  22096. src: '', // 图片路径
  22097. cropScale: '16:9', // 裁剪比例
  22098. })
  22099. ``` */
  22100. cropImage(option: CropImageOption): void
  22101. /** [wx.disableAlertBeforeUnload(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.disableAlertBeforeUnload.html)
  22102. *
  22103. * 需要基础库: `2.12.0`
  22104. *
  22105. * 在插件中使用:不支持
  22106. *
  22107. * 关闭小程序页面返回询问对话框。 */
  22108. disableAlertBeforeUnload(option?: DisableAlertBeforeUnloadOption): void
  22109. /** [wx.editImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.editImage.html)
  22110. *
  22111. * 需要基础库: `2.22.0`
  22112. *
  22113. * 在插件中使用:不支持
  22114. *
  22115. * 编辑图片接口
  22116. *
  22117. * **示例代码**
  22118. *
  22119. * ```js
  22120. wx.editImage({
  22121. src: '', // 图片路径
  22122. })
  22123. ``` */
  22124. editImage(option: EditImageOption): void
  22125. /** [wx.enableAlertBeforeUnload(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.enableAlertBeforeUnload.html)
  22126. *
  22127. * 需要基础库: `2.12.0`
  22128. *
  22129. * 在插件中使用:不支持
  22130. *
  22131. * 开启小程序页面返回询问对话框。
  22132. *
  22133. * ## 弹窗条件
  22134. * * 当用户在小程序内非首页页面/最底层页
  22135. * * 官方导航栏上的的返回
  22136. * * 全屏模式下自绘返回键
  22137. * * android 系统 back 键时
  22138. *
  22139. * ## 注意事项
  22140. * * 手势滑动返回时不做拦截
  22141. * * 在任何场景下,此功能都不应拦住用户退出小程序的行为
  22142. *
  22143. * **示例代码**
  22144. *
  22145. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/MTPm9Cmh7VfT) */
  22146. enableAlertBeforeUnload(option: EnableAlertBeforeUnloadOption): void
  22147. /** [wx.exitMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.exitMiniProgram.html)
  22148. *
  22149. * 需要基础库: `2.17.3`
  22150. *
  22151. * 在插件中使用:需要基础库 `2.30.1`
  22152. *
  22153. * 退出当前小程序。必须有点击行为才能调用成功。 */
  22154. exitMiniProgram<
  22155. T extends ExitMiniProgramOption = ExitMiniProgramOption
  22156. >(
  22157. option?: T
  22158. ): PromisifySuccessResult<T, ExitMiniProgramOption>
  22159. /** [wx.exitVoIPChat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.exitVoIPChat.html)
  22160. *
  22161. * 需要基础库: `2.7.0`
  22162. *
  22163. * 在插件中使用:需要基础库 `2.9.0`
  22164. *
  22165. * 退出(销毁)实时语音通话 */
  22166. exitVoIPChat<T extends ExitVoIPChatOption = ExitVoIPChatOption>(
  22167. option?: T
  22168. ): PromisifySuccessResult<T, ExitVoIPChatOption>
  22169. /** [wx.faceDetect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/face/wx.faceDetect.html)
  22170. *
  22171. * 需要基础库: `2.18.0`
  22172. *
  22173. * 在插件中使用:需要基础库 `2.21.3`
  22174. *
  22175. * @warning **该接口已停止维护,推荐使用 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 代替**
  22176. *
  22177. * 人脸检测,使用前需要通过 wx.initFaceDetect 进行一次初始化,推荐使用相机接口返回的帧数据。本接口不再维护,请使用 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 接口代替。详情参考[人脸检测指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/face.html)
  22178. *
  22179. * ****
  22180. *
  22181. * ### 特别说明
  22182. * 若小程序人脸识别功能涉及采集、存储用户生物特征(如人脸照片或视频、身份证和手持身份证、身份证照和免冠照等),此类型服务需使用[微信原生人脸识别接口](https://developers.weixin.qq.com/community/develop/doc/000442d352c1202bd498ecb105c00d?highline=%E4%BA%BA%E8%84%B8%E6%A0%B8%E8%BA%AB)。 */
  22183. faceDetect(option: FaceDetectOption): void
  22184. /** [wx.getAvailableAudioSources(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.getAvailableAudioSources.html)
  22185. *
  22186. * 需要基础库: `2.1.0`
  22187. *
  22188. * 在插件中使用:需要基础库 `2.15.0`
  22189. *
  22190. * 获取当前支持的音频输入源 */
  22191. getAvailableAudioSources<
  22192. T extends GetAvailableAudioSourcesOption = GetAvailableAudioSourcesOption
  22193. >(
  22194. option?: T
  22195. ): PromisifySuccessResult<T, GetAvailableAudioSourcesOption>
  22196. /** [wx.getBLEDeviceCharacteristics(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceCharacteristics.html)
  22197. *
  22198. * 需要基础库: `1.1.0`
  22199. *
  22200. * 在插件中使用:需要基础库 `1.9.6`
  22201. *
  22202. * 获取蓝牙低功耗设备某个服务中所有特征 (characteristic)。
  22203. *
  22204. * **示例代码**
  22205. *
  22206. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  22207. * ```js
  22208. wx.getBLEDeviceCharacteristics({
  22209. // 这里的 deviceId 需要已经通过 wx.createBLEConnection 与对应设备建立链接
  22210. deviceId,
  22211. // 这里的 serviceId 需要在 wx.getBLEDeviceServices 接口中获取
  22212. serviceId,
  22213. success (res) {
  22214. console.log('device getBLEDeviceCharacteristics:', res.characteristics)
  22215. }
  22216. })
  22217. ``` */
  22218. getBLEDeviceCharacteristics<
  22219. T extends GetBLEDeviceCharacteristicsOption = GetBLEDeviceCharacteristicsOption
  22220. >(
  22221. option: T
  22222. ): PromisifySuccessResult<T, GetBLEDeviceCharacteristicsOption>
  22223. /** [wx.getBLEDeviceRSSI(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceRSSI.html)
  22224. *
  22225. * 需要基础库: `2.11.0`
  22226. *
  22227. * 在插件中使用:需要基础库 `2.11.0`
  22228. *
  22229. * 获取蓝牙低功耗设备的信号强度 (Received Signal Strength Indication, RSSI)。 */
  22230. getBLEDeviceRSSI<
  22231. T extends GetBLEDeviceRSSIOption = GetBLEDeviceRSSIOption
  22232. >(
  22233. option: T
  22234. ): PromisifySuccessResult<T, GetBLEDeviceRSSIOption>
  22235. /** [wx.getBLEDeviceServices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEDeviceServices.html)
  22236. *
  22237. * 需要基础库: `1.1.0`
  22238. *
  22239. * 在插件中使用:需要基础库 `1.9.6`
  22240. *
  22241. * 获取蓝牙低功耗设备所有服务 (service)。
  22242. *
  22243. * **示例代码**
  22244. *
  22245. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  22246. * ```js
  22247. wx.getBLEDeviceServices({
  22248. // 这里的 deviceId 需要已经通过 wx.createBLEConnection 与对应设备建立连接
  22249. deviceId,
  22250. success (res) {
  22251. console.log('device services:', res.services)
  22252. }
  22253. })
  22254. ``` */
  22255. getBLEDeviceServices<
  22256. T extends GetBLEDeviceServicesOption = GetBLEDeviceServicesOption
  22257. >(
  22258. option: T
  22259. ): PromisifySuccessResult<T, GetBLEDeviceServicesOption>
  22260. /** [wx.getBLEMTU(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.getBLEMTU.html)
  22261. *
  22262. * 需要基础库: `2.20.1`
  22263. *
  22264. * 在插件中使用:需要基础库 `2.20.1`
  22265. *
  22266. * 获取蓝牙低功耗的最大传输单元。需在 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 调用成功后调用。
  22267. *
  22268. * **注意**
  22269. *
  22270. * - 小程序中 MTU 为 ATT_MTU,包含 Op-Code 和 Attribute Handle 的长度,实际可以传输的数据长度为 `ATT_MTU - 3`
  22271. * - iOS 系统中 MTU 为固定值;安卓系统中,MTU 会在系统协商成功之后发生改变,建议使用 [wx.onBLEMTUChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLEMTUChange.html) 监听。
  22272. *
  22273. * **示例代码**
  22274. *
  22275. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  22276. * ```js
  22277. wx.getBLEMTU({
  22278. deviceId: '',
  22279. writeType: 'write',
  22280. success (res) {
  22281. console.log(res)
  22282. }
  22283. })
  22284. ``` */
  22285. getBLEMTU<T extends GetBLEMTUOption = GetBLEMTUOption>(
  22286. option: T
  22287. ): PromisifySuccessResult<T, GetBLEMTUOption>
  22288. /** [wx.getBackgroundAudioPlayerState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioPlayerState.html)
  22289. *
  22290. * 在插件中使用:需要基础库 `1.9.6`
  22291. * @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) 替换
  22292. *
  22293. * 获取后台音乐播放状态。
  22294. *
  22295. * **示例代码**
  22296. *
  22297. * ```js
  22298. wx.getBackgroundAudioPlayerState({
  22299. success (res) {
  22300. const status = res.status
  22301. const dataUrl = res.dataUrl
  22302. const currentPosition = res.currentPosition
  22303. const duration = res.duration
  22304. const downloadPercent = res.downloadPercent
  22305. }
  22306. })
  22307. ``` */
  22308. getBackgroundAudioPlayerState<
  22309. T extends GetBackgroundAudioPlayerStateOption = GetBackgroundAudioPlayerStateOption
  22310. >(
  22311. option?: T
  22312. ): PromisifySuccessResult<T, GetBackgroundAudioPlayerStateOption>
  22313. /** [wx.getBackgroundFetchData(object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchData.html)
  22314. *
  22315. * 需要基础库: `2.8.0`
  22316. *
  22317. * 在插件中使用:不支持
  22318. *
  22319. * 拉取 backgroundFetch 客户端缓存数据。
  22320. * 当调用接口时,若当次请求未结束,会先返回本地的旧数据(之前打开小程序时请求的),如果本地没有旧数据,安卓上会返回fail,不会等待请求完成,iOS上会返回success但fetchedData为空,也不会等待请求完成。 */
  22321. getBackgroundFetchData<
  22322. T extends GetBackgroundFetchDataOption = GetBackgroundFetchDataOption
  22323. >(
  22324. option: T
  22325. ): PromisifySuccessResult<T, GetBackgroundFetchDataOption>
  22326. /** [wx.getBackgroundFetchToken(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchToken.html)
  22327. *
  22328. * 需要基础库: `2.8.0`
  22329. *
  22330. * 在插件中使用:不支持
  22331. *
  22332. * 获取设置过的自定义登录态。若无,则返回 fail。 */
  22333. getBackgroundFetchToken<
  22334. T extends GetBackgroundFetchTokenOption = GetBackgroundFetchTokenOption
  22335. >(
  22336. option?: T
  22337. ): PromisifySuccessResult<T, GetBackgroundFetchTokenOption>
  22338. /** [wx.getBatteryInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfo.html)
  22339. *
  22340. * 在插件中使用:需要基础库 `2.15.0`
  22341. *
  22342. * 获取设备电量。同步 API [wx.getBatteryInfoSync](https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfoSync.html) 在 iOS 上不可用。 */
  22343. getBatteryInfo<T extends GetBatteryInfoOption = GetBatteryInfoOption>(
  22344. option?: T
  22345. ): PromisifySuccessResult<T, GetBatteryInfoOption>
  22346. /** [wx.getBeacons(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.getBeacons.html)
  22347. *
  22348. * 需要基础库: `1.2.0`
  22349. *
  22350. * 在插件中使用:需要基础库 `1.9.6`
  22351. *
  22352. * 获取所有已搜索到的 Beacon 设备 */
  22353. getBeacons<T extends GetBeaconsOption = GetBeaconsOption>(
  22354. option?: T
  22355. ): PromisifySuccessResult<T, GetBeaconsOption>
  22356. /** [wx.getBluetoothAdapterState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getBluetoothAdapterState.html)
  22357. *
  22358. * 需要基础库: `1.1.0`
  22359. *
  22360. * 在插件中使用:需要基础库 `1.9.6`
  22361. *
  22362. * 获取本机蓝牙适配器状态。
  22363. *
  22364. * **示例代码**
  22365. *
  22366. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  22367. * ```js
  22368. wx.getBluetoothAdapterState({
  22369. success (res) {
  22370. console.log(res)
  22371. }
  22372. })
  22373. ``` */
  22374. getBluetoothAdapterState<
  22375. T extends GetBluetoothAdapterStateOption = GetBluetoothAdapterStateOption
  22376. >(
  22377. option?: T
  22378. ): PromisifySuccessResult<T, GetBluetoothAdapterStateOption>
  22379. /** [wx.getBluetoothDevices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getBluetoothDevices.html)
  22380. *
  22381. * 需要基础库: `1.1.0`
  22382. *
  22383. * 在插件中使用:需要基础库 `1.9.6`
  22384. *
  22385. * 获取在蓝牙模块生效期间所有搜索到的蓝牙设备。包括已经和本机处于连接状态的设备。
  22386. *
  22387. * **示例代码**
  22388. *
  22389. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  22390. *
  22391. * ```js
  22392. // ArrayBuffer转16进度字符串示例
  22393. function ab2hex(buffer) {
  22394. var hexArr = Array.prototype.map.call(
  22395. new Uint8Array(buffer),
  22396. function(bit) {
  22397. return ('00' + bit.toString(16)).slice(-2)
  22398. }
  22399. )
  22400. return hexArr.join('');
  22401. }
  22402. wx.getBluetoothDevices({
  22403. success: function (res) {
  22404. console.log(res)
  22405. if (res.devices[0]) {
  22406. console.log(ab2hex(res.devices[0].advertisData))
  22407. }
  22408. }
  22409. })
  22410. ```
  22411. *
  22412. * **注意**
  22413. *
  22414. * - 该接口获取到的设备列表为**蓝牙模块生效期间所有搜索到的蓝牙设备**,若在蓝牙模块使用流程结束后未及时调用 [wx.closeBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.closeBluetoothAdapter.html) 释放资源,会存在调用该接口会返回之前的蓝牙使用流程中搜索到的蓝牙设备,可能设备已经不在用户身边,无法连接。 */
  22415. getBluetoothDevices<
  22416. T extends GetBluetoothDevicesOption = GetBluetoothDevicesOption
  22417. >(
  22418. option?: T
  22419. ): PromisifySuccessResult<T, GetBluetoothDevicesOption>
  22420. /** [wx.getChannelsLiveInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.getChannelsLiveInfo.html)
  22421. *
  22422. * 需要基础库: `2.15.0`
  22423. *
  22424. * 在插件中使用:不支持
  22425. *
  22426. * 获取视频号直播信息 */
  22427. getChannelsLiveInfo(option: GetChannelsLiveInfoOption): void
  22428. /** [wx.getChannelsLiveNoticeInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.getChannelsLiveNoticeInfo.html)
  22429. *
  22430. * 需要基础库: `2.19.0`
  22431. *
  22432. * 在插件中使用:不支持
  22433. *
  22434. * 获取视频号直播预告信息 */
  22435. getChannelsLiveNoticeInfo(option: GetChannelsLiveNoticeInfoOption): void
  22436. /** [wx.getChannelsShareKey(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.getChannelsShareKey.html)
  22437. *
  22438. * 需要基础库: `2.22.1`
  22439. *
  22440. * 在插件中使用:不支持
  22441. *
  22442. * 获取视频号直播卡片/视频卡片的分享来源,仅当卡片携带了分享信息、同时用户已授权该小程序获取视频号分享信息且启动场景值为 1177、1184、1195、1208 时可用。 */
  22443. getChannelsShareKey(option?: GetChannelsShareKeyOption): void
  22444. /** [wx.getClipboardData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.getClipboardData.html)
  22445. *
  22446. * 需要基础库: `1.1.0`
  22447. *
  22448. * 在插件中使用:需要基础库 `1.9.6`
  22449. *
  22450. * 获取系统剪贴板的内容
  22451. *
  22452. * **示例代码**
  22453. *
  22454. * ```js
  22455. wx.getClipboardData({
  22456. success (res){
  22457. console.log(res.data)
  22458. }
  22459. })
  22460. ``` */
  22461. getClipboardData<
  22462. T extends GetClipboardDataOption = GetClipboardDataOption
  22463. >(
  22464. option?: T
  22465. ): PromisifySuccessResult<T, GetClipboardDataOption>
  22466. /** [wx.getCommonConfig(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.getCommonConfig.html)
  22467. *
  22468. * 需要基础库: `2.33.0`
  22469. *
  22470. * 在插件中使用:不支持
  22471. *
  22472. * 给定实验参数数组,获取对应的实验参数值。
  22473. *
  22474. * **示例代码**
  22475. *
  22476. * ```js
  22477. wx.getCommonConfig({
  22478. keys:["key1", "key2"],
  22479. mode: 0,
  22480. success: (res)=>{
  22481. console.log("success")
  22482. console.log(res)
  22483. },
  22484. fail: (res)=>{
  22485. console.log("fail")
  22486. console.log(res)
  22487. }})
  22488. ``` */
  22489. getCommonConfig(option: GetCommonConfigOption): void
  22490. /** [wx.getConnectedBluetoothDevices(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.getConnectedBluetoothDevices.html)
  22491. *
  22492. * 需要基础库: `1.1.0`
  22493. *
  22494. * 在插件中使用:需要基础库 `1.9.6`
  22495. *
  22496. * 根据主服务 UUID 获取已连接的蓝牙设备。
  22497. *
  22498. * **示例代码**
  22499. *
  22500. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  22501. * ```js
  22502. wx.getConnectedBluetoothDevices({
  22503. services: ['FEE7'],
  22504. success (res) {
  22505. console.log(res)
  22506. }
  22507. })
  22508. ``` */
  22509. getConnectedBluetoothDevices<
  22510. T extends GetConnectedBluetoothDevicesOption = GetConnectedBluetoothDevicesOption
  22511. >(
  22512. option: T
  22513. ): PromisifySuccessResult<T, GetConnectedBluetoothDevicesOption>
  22514. /** [wx.getConnectedWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.getConnectedWifi.html)
  22515. *
  22516. * 需要基础库: `1.6.0`
  22517. *
  22518. * 在插件中使用:需要基础库 `2.9.1`
  22519. *
  22520. * 获取已连接中的 Wi-Fi 信息。 */
  22521. getConnectedWifi<
  22522. T extends GetConnectedWifiOption = GetConnectedWifiOption
  22523. >(
  22524. option: T
  22525. ): PromisifySuccessResult<T, GetConnectedWifiOption>
  22526. /** [wx.getDeviceVoIPList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/device-voip/wx.getDeviceVoIPList.html)
  22527. *
  22528. * 需要基础库: `2.30.3`
  22529. *
  22530. * 在插件中使用:不支持
  22531. *
  22532. * 查询当前用户授权的音视频通话设备(组)信息
  22533. *
  22534. * **示例代码**
  22535. *
  22536. * ```js
  22537. wx.getDeviceVoIPList({
  22538. success(res) {
  22539. console.log(res)
  22540. },
  22541. fail(res) {
  22542. console.log(res)
  22543. }
  22544. })
  22545. ``` */
  22546. getDeviceVoIPList(option?: GetDeviceVoIPListOption): void
  22547. /** [wx.getExtConfig(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ext/wx.getExtConfig.html)
  22548. *
  22549. * 需要基础库: `1.1.0`
  22550. *
  22551. * 在插件中使用:不支持
  22552. *
  22553. * 获取[第三方平台](https://developers.weixin.qq.com/miniprogram/dev/devtools/ext.html)自定义的数据字段。
  22554. *
  22555. * **Tips**
  22556. *
  22557. * 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) 是否存在来兼容
  22558. *
  22559. * ****
  22560. *
  22561. * ```js
  22562. if (wx.getExtConfig) {
  22563. wx.getExtConfig({
  22564. success (res) {
  22565. console.log(res.extConfig)
  22566. }
  22567. })
  22568. }
  22569. ``` */
  22570. getExtConfig<T extends GetExtConfigOption = GetExtConfigOption>(
  22571. option?: T
  22572. ): PromisifySuccessResult<T, GetExtConfigOption>
  22573. /** [wx.getFuzzyLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getFuzzyLocation.html)
  22574. *
  22575. * 需要基础库: `2.25.0`
  22576. *
  22577. * 在插件中使用:支持
  22578. *
  22579. * 获取当前的模糊地理位置。
  22580. * ## 使用方法
  22581. * 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
  22582. * ## 申请开通
  22583. * 暂只针对具备与地理位置强相关的使用场景的小程序开放,在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。 从2022年7月14日开始在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
  22584. *
  22585. * **示例代码**
  22586. *
  22587. * ```js
  22588. wx.getFuzzyLocation({
  22589. type: 'wgs84',
  22590. success (res) {
  22591. const latitude = res.latitude
  22592. const longitude = res.longitude
  22593. }
  22594. })
  22595. ``` */
  22596. getFuzzyLocation(option: GetFuzzyLocationOption): void
  22597. /** [wx.getGroupEnterInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/group/wx.getGroupEnterInfo.html)
  22598. *
  22599. * 需要基础库: `2.10.4`
  22600. *
  22601. * 在插件中使用:不支持
  22602. *
  22603. * 获取微信群聊场景下的小程序启动信息。群聊场景包括群聊小程序消息卡片、群待办、群工具。可用于获取当前群的 opengid。
  22604. * ## 注意事项
  22605. * - 基础库 v2.10.4 开始支持获取群工具小程序启动信息
  22606. * - 基础库 v2.17.3 开始支持获取群聊小程序消息卡片、群待办小程序启动信息
  22607. *
  22608. * **示例代码**
  22609. *
  22610. * ```js
  22611. wx.getGroupEnterInfo({
  22612. success(res) {
  22613. // res
  22614. {
  22615. errMsg: 'getGroupEnterInfo:ok',
  22616. encryptedData: '',
  22617. iv: ''
  22618. }
  22619. },
  22620. fail() {
  22621. }
  22622. })
  22623. ```
  22624. *
  22625. * 敏感数据有两种获取方式,一是使用 [加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) 。
  22626. * 获取得到的开放数据为以下 json 结构(其中 opengid 为当前群的唯一标识):
  22627. *
  22628. * ```json
  22629. {
  22630. "opengid": "OPENGID"
  22631. }
  22632. ```
  22633. *
  22634. * **Tips**
  22635. *
  22636. * - 如需要展示群名称,小程序可以使用[开放数据组件](https://developers.weixin.qq.com/miniprogram/dev/component/open-data.html)
  22637. * - 小游戏可以通过 `wx.getGroupInfo` 接口获取群名称 */
  22638. getGroupEnterInfo(option: GetGroupEnterInfoOption): void
  22639. /** [wx.getHCEState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc-hce/wx.getHCEState.html)
  22640. *
  22641. * 需要基础库: `1.7.0`
  22642. *
  22643. * 在插件中使用:需要基础库 `2.1.0`
  22644. *
  22645. * 判断当前设备是否支持 HCE 能力。
  22646. *
  22647. * **示例代码**
  22648. *
  22649. * ```js
  22650. wx.getHCEState({
  22651. success (res) {
  22652. console.log(res.errCode)
  22653. }
  22654. })
  22655. ``` */
  22656. getHCEState<T extends GetHCEStateOption = GetHCEStateOption>(
  22657. option?: T
  22658. ): PromisifySuccessResult<T, GetHCEStateOption>
  22659. /** [wx.getImageInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.getImageInfo.html)
  22660. *
  22661. * 在插件中使用:需要基础库 `1.9.6`
  22662. *
  22663. * 获取图片信息。网络图片需先配置download域名才能生效。
  22664. *
  22665. * **示例代码**
  22666. *
  22667. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/Kd47Sbmr6yYu)
  22668. *
  22669. * ```js
  22670. wx.getImageInfo({
  22671. src: 'images/a.jpg',
  22672. success (res) {
  22673. console.log(res.width)
  22674. console.log(res.height)
  22675. }
  22676. })
  22677. wx.chooseImage({
  22678. success (res) {
  22679. wx.getImageInfo({
  22680. src: res.tempFilePaths[0],
  22681. success (res) {
  22682. console.log(res.width)
  22683. console.log(res.height)
  22684. }
  22685. })
  22686. }
  22687. })
  22688. ``` */
  22689. getImageInfo<T extends GetImageInfoOption = GetImageInfoOption>(
  22690. option: T
  22691. ): PromisifySuccessResult<T, GetImageInfoOption>
  22692. /** [wx.getInferenceEnvInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/wx.getInferenceEnvInfo.html)
  22693. *
  22694. * 需要基础库: `2.30.1`
  22695. *
  22696. * 在插件中使用:需要基础库 `2.30.1`
  22697. *
  22698. * 获取通用AI推理引擎版本。使用前可参考[AI指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/inference/tutorial.html)
  22699. *
  22700. * **示例代码**
  22701. *
  22702. * ```js
  22703. // 获取通用AI推理引擎版本
  22704. wx.getInferenceEnvInfo({
  22705. complete: (res) => {
  22706. console.log(res.ver)
  22707. console.log(res.errMsg)
  22708. },
  22709. })
  22710. ``` */
  22711. getInferenceEnvInfo(option?: GetInferenceEnvInfoOption): void
  22712. /** [wx.getLocalIPAddress(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.getLocalIPAddress.html)
  22713. *
  22714. * 需要基础库: `2.20.1`
  22715. *
  22716. * 在插件中使用:需要基础库 `2.21.3`
  22717. *
  22718. * 获取局域网IP地址
  22719. *
  22720. * **示例代码**
  22721. *
  22722. * ```js
  22723. wx.getLocalIPAddress({
  22724. success (res) {
  22725. const localip = res.localip
  22726. }
  22727. })
  22728. ``` */
  22729. getLocalIPAddress(option: GetLocalIPAddressOption): void
  22730. /** [wx.getLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getLocation.html)
  22731. *
  22732. * 在插件中使用:需要基础库 `1.9.6`
  22733. *
  22734. * 获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用。开启高精度定位,接口耗时会增加,可指定 highAccuracyExpireTime 作为超时时间。地图相关使用的坐标格式应为 gcj02。
  22735. * 高频率调用会导致耗电,如有需要可使用持续定位接口 `wx.onLocationChange`。
  22736. * 基础库 `2.17.0` 版本起 `wx.getLocation` 增加调用频率限制,[相关公告](https://developers.weixin.qq.com/community/develop/doc/000aee91a98d206bc6dbe722b51801)。
  22737. *
  22738. * ## 使用方法
  22739. * 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
  22740. *
  22741. * ## 申请开通
  22742. * 暂只针对如下类目的小程序开放,需要先通过类目审核,再在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。
  22743. * 接口权限申请入口将于2022年3月11日开始内测,于3月31日全量上线。并从4月18日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
  22744. *
  22745. * ### 国内主体开放类目
  22746. *
  22747. * | 一级类目/主体类型 | 二级类目 | 应用场景 |
  22748. * | -------------- | -------| -------- |
  22749. * | 电商平台 | / | 售卖商品线下发货、线下收货服务 |
  22750. * | 商家自营 | / | 提供售卖商品线下发货、线下收货服务、线下商超导览、导航服务 |
  22751. * | 医疗服务 | 公立医疗机构、三级私立医疗机构、其他私立医疗机构、就医服务、其他医学健康服务、药品(非处方药)销售、非处方药销售平台、医疗器械生产企业、医疗器械自营、医疗器械经营销售平台、互联网医院血液、干细胞服务、临床试验 | 1、实际物品/药品接收服务 2、基于地理位置取号并现场报到、附近医院导航等服务 |
  22752. * | 交通服务 | / | 代驾服务、租车网点导航等相关服务 |
  22753. * | 生活服务 | / | 上门服务作业等线下场景 |
  22754. * | 物流服务 | 收件/派件、查件、邮政、装卸搬运、快递柜、货物运输 | 快递/货物收发服务 |
  22755. * | 餐饮服务 | 点餐平台、外卖平台、餐饮服务场所/餐饮服务管理企业 | 线下送餐服务 |
  22756. * | 工具 | 天气、信息查询、办公、设备管理 | 与地理位置相关的服务,比如潮汐查询、海拔查询、天气查询、智能穿戴、智能门禁、与地理位置相关的打卡服务等 |
  22757. * | 金融 | 银行、非金融机构自营小额贷款/融资担保/商业保理、保险 | 提供线下网点预约、基于地理位置取号并现场报到、附近网点导航等服务 |
  22758. * | 旅游 | 景区服务、住宿服务 | 提供景区导航、导览服务、酒店导航服务 |
  22759. * | 汽车服务 | 维修保养、汽车用品、汽车经销商/4S店、汽车厂商、汽车预售、二手车 | 提供汽车售卖、维保洗美服务、查找附近的维修点/洗车网点等导航服务 |
  22760. * | IT科技 | 基础电信运营商、电信业务代理商 | 提供运营商线下网点的预约、基于地理位置取号并现场报到、网点导航等服务 |
  22761. * | 房地产服务 | 物业管理、房屋中介、房屋装修 | 提供房地产开发商及物业公司门店导览导航服务 |
  22762. * | 政务民生 | / | 提供政务单位相关业务 |
  22763. * | 政府主体账号 | / | 提供政务单位相关业务 |
  22764. *
  22765. * ### 海外主体开放类目
  22766. *
  22767. * | 一级类目/主体类型 | 二级类目 | 应用场景 |
  22768. * | -------------- | -------| -------- |
  22769. * | 出行与交通 | / | 代驾服务、租车网点导航等相关服务 |
  22770. * | 快递业与邮政 | / | 快递/货物收发服务 |
  22771. * | 餐饮 | / | 线下送餐服务 |
  22772. * | 电商平台 | / | 售卖商品线下发货、线下收货服务 |
  22773. * | 出行与交通 | / | 代驾服务、租车网点导航等相关服务 |
  22774. * | 跨境电商 | / | 提供售卖商品线下发货、收货服务、线下商超导览、导航服务 |
  22775. * | 本地服务 | 服装/鞋/箱包、玩具、家电/数码/手机、美妆/洗护、珠宝/饰品/眼镜/钟表、运动/户外/乐器、鲜花/园艺/工艺品、家居/家饰/家纺、办公/文具、机械/电子器件、酒、食品、百货、超市/便利店、宠物食品/用品 | 提供售卖商品线下发货、线下收货服务、线下商超导览、导航服务 |
  22776. * | 生活服务 | 家政、外送 | 上门服务作业等线下场景 |
  22777. *
  22778. * **示例代码**
  22779. *
  22780. * ```js
  22781. wx.getLocation({
  22782. type: 'wgs84',
  22783. success (res) {
  22784. const latitude = res.latitude
  22785. const longitude = res.longitude
  22786. const speed = res.speed
  22787. const accuracy = res.accuracy
  22788. }
  22789. })
  22790. ```
  22791. *
  22792. * **注意**
  22793. *
  22794. * - `2.17.0 起 `wx.getLocation` 增加调用频率限制,[相关公告](https://developers.weixin.qq.com/community/develop/doc/000aee91a98d206bc6dbe722b51801)
  22795. * - 工具中定位模拟使用IP定位,可能会有一定误差。且工具目前仅支持 gcj02 坐标。
  22796. * - 使用第三方服务进行逆地址解析时,请确认第三方服务默认的坐标系,正确进行坐标转换。 */
  22797. getLocation<T extends GetLocationOption = GetLocationOption>(
  22798. option: T
  22799. ): PromisifySuccessResult<T, GetLocationOption>
  22800. /** [wx.getNetworkType(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.getNetworkType.html)
  22801. *
  22802. * 在插件中使用:需要基础库 `1.9.6`
  22803. *
  22804. * 获取网络类型
  22805. *
  22806. * **示例代码**
  22807. *
  22808. * ```js
  22809. wx.getNetworkType({
  22810. success (res) {
  22811. const networkType = res.networkType
  22812. }
  22813. })
  22814. ``` */
  22815. getNetworkType<T extends GetNetworkTypeOption = GetNetworkTypeOption>(
  22816. option?: T
  22817. ): PromisifySuccessResult<T, GetNetworkTypeOption>
  22818. /** [wx.getPrivacySetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.getPrivacySetting.html)
  22819. *
  22820. * 需要基础库: `2.32.3`
  22821. *
  22822. * 在插件中使用:不支持
  22823. *
  22824. * 查询隐私授权情况。隐私合规开发指南详情可见[《小程序隐私协议开发指南》](https://developers.weixin.qq.com/miniprogram/dev/framework/user-privacy/PrivacyAuthorize.html)
  22825. *
  22826. * ****
  22827. *
  22828. * ## 具体说明:
  22829. *
  22830. * 1. 一定要调用 wx.getPrivacySetting 接口吗?
  22831. *
  22832. * - 不是,wx.getPrivacySetting 只是一个辅助接口,可以根据实际情况选择使用。
  22833. *
  22834. * **示例代码**
  22835. *
  22836. * ```html
  22837. * // page.wxml
  22838. * <view wx:if="{{showPrivacy}}">
  22839. * <view>隐私弹窗内容....</view>
  22840. * <button id="agree-btn" open-type="agreePrivacyAuthorization" bindagreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
  22841. * </view>
  22842. * ```
  22843. * ```js
  22844. Page({
  22845. data: {
  22846. showPrivacy: false
  22847. },
  22848. onLoad() {
  22849. wx.getPrivacySetting({
  22850. success: res => {
  22851. console.log(res) // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }
  22852. if (res.needAuthorization) {
  22853. // 需要弹出隐私协议
  22854. this.setData({
  22855. showPrivacy: true
  22856. })
  22857. } else {
  22858. // 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用隐私接口
  22859. }
  22860. },
  22861. fail: () => {},
  22862. complete: () => {}
  22863. })
  22864. },
  22865. handleAgreePrivacyAuthorization() {
  22866. // 用户同意隐私协议事件回调
  22867. // 用户点击了同意,之后所有隐私接口和组件都可以调用了
  22868. // wx.getUserProfile()
  22869. // wx.chooseMedia()
  22870. // wx.getClipboardData()
  22871. // wx.startRecord()
  22872. }
  22873. })
  22874. ```
  22875. *
  22876. * **完整示例demo**
  22877. *
  22878. * demo1: 演示使用 `wx.getPrivacySetting` 和 `<button open-type="agreePrivacyAuthorization">` 在首页处理隐私弹窗逻辑
  22879. * [https://developers.weixin.qq.com/s/gi71sGm67hK0](https://developers.weixin.qq.com/s/gi71sGm67hK0)
  22880. *
  22881. * demo2: 演示使用 `wx.onNeedPrivacyAuthorization` 和 `<button open-type="agreePrivacyAuthorization">` 在多个页面处理隐私弹窗逻辑,同时演示了如何处理多个隐私接口同时调用。
  22882. * [https://developers.weixin.qq.com/s/hndZUOmA7gKn](https://developers.weixin.qq.com/s/hndZUOmA7gKn)
  22883. *
  22884. * demo3: 演示 `wx.onNeedPrivacyAuthorization`、`wx.requirePrivacyAuthorize`、`<button open-type="agreePrivacyAuthorization">` 和 `<input type="nickname">` 组件如何结合使用
  22885. * [https://developers.weixin.qq.com/s/jX7xWGmA7UKa](https://developers.weixin.qq.com/s/jX7xWGmA7UKa)
  22886. *
  22887. * demo4: 演示使用 `wx.onNeedPrivacyAuthorization` 和 `<button open-type="agreePrivacyAuthorization">` 在多个 tabBar 页面处理隐私弹窗逻辑。
  22888. * [https://developers.weixin.qq.com/s/g6BWZGmt7XK9](https://developers.weixin.qq.com/s/g6BWZGmt7XK9) */
  22889. getPrivacySetting(option: GetPrivacySettingOption): void
  22890. /** [wx.getRandomValues(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/crypto/wx.getRandomValues.html)
  22891. *
  22892. * 需要基础库: `2.15.0`
  22893. *
  22894. * 在插件中使用:不支持
  22895. *
  22896. * 获取密码学安全随机数
  22897. *
  22898. * **示例代码**
  22899. *
  22900. * ```js
  22901. wx.getRandomValues({
  22902. length: 6 // 生成 6 个字节长度的随机数,
  22903. success: res => {
  22904. console.log(wx.arrayBufferToBase64(res.randomValues)) // 转换为 base64 字符串后打印
  22905. }
  22906. })
  22907. ``` */
  22908. getRandomValues<
  22909. T extends GetRandomValuesOption = GetRandomValuesOption
  22910. >(
  22911. option: T
  22912. ): PromisifySuccessResult<T, GetRandomValuesOption>
  22913. /** [wx.getScreenBrightness(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenBrightness.html)
  22914. *
  22915. * 需要基础库: `1.2.0`
  22916. *
  22917. * 在插件中使用:需要基础库 `1.9.6`
  22918. *
  22919. * 获取屏幕亮度
  22920. *
  22921. * **说明**
  22922. *
  22923. * - 若安卓系统设置中开启了自动调节亮度功能,则屏幕亮度会根据光线自动调整,该接口仅能获取自动调节亮度之前的值,而非实时的亮度值。 */
  22924. getScreenBrightness<
  22925. T extends GetScreenBrightnessOption = GetScreenBrightnessOption
  22926. >(
  22927. option?: T
  22928. ): PromisifySuccessResult<T, GetScreenBrightnessOption>
  22929. /** [wx.getScreenRecordingState(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenRecordingState.html)
  22930. *
  22931. * 需要基础库: `2.24.0`
  22932. *
  22933. * 在插件中使用:不支持
  22934. *
  22935. * 查询用户是否在录屏。
  22936. *
  22937. * **示例代码**
  22938. *
  22939. * ```js
  22940. * wx.getScreenRecordingState({
  22941. * success: function (res) {
  22942. * console.log(res.state)
  22943. * },
  22944. * }) */
  22945. getScreenRecordingState(option?: GetScreenRecordingStateOption): void
  22946. /** [wx.getSelectedTextRange(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.getSelectedTextRange.html)
  22947. *
  22948. * 需要基础库: `2.7.0`
  22949. *
  22950. * 在插件中使用:不支持
  22951. *
  22952. * 在input、textarea等focus之后,获取输入框的光标位置。注意:只有在focus的时候调用此接口才有效。
  22953. *
  22954. * **示例代码**
  22955. *
  22956. * ```js
  22957. wx.getSelectedTextRange({
  22958. complete: res => {
  22959. console.log('getSelectedTextRange res', res.start, res.end)
  22960. }
  22961. })
  22962. ``` */
  22963. getSelectedTextRange<
  22964. T extends GetSelectedTextRangeOption = GetSelectedTextRangeOption
  22965. >(
  22966. option?: T
  22967. ): PromisifySuccessResult<T, GetSelectedTextRangeOption>
  22968. /** [wx.getSetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.getSetting.html)
  22969. *
  22970. * 需要基础库: `1.2.0`
  22971. *
  22972. * 在插件中使用:需要基础库 `2.6.3`
  22973. *
  22974. * 在插件中使用时,接口有以下不同:
  22975. * - `withSubscriptions` 无效(插件暂无订阅消息)
  22976. * - 返回值中的 `authSetting` 字段中是插件的权限(如用户信息功能页授权)
  22977. * - [2.14.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起返回值中有 `miniprogramAuthSetting` 字段,内容等于当前小程序 `getSetting` 的结果(不含订阅状态)
  22978. *
  22979. * 获取用户的当前设置。**返回值中只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
  22980. *
  22981. * **示例代码**
  22982. *
  22983. * ```js
  22984. wx.getSetting({
  22985. success (res) {
  22986. console.log(res.authSetting)
  22987. // res.authSetting = {
  22988. // "scope.userInfo": true,
  22989. // "scope.userLocation": true
  22990. // }
  22991. }
  22992. })
  22993. ```
  22994. *
  22995. * ```js
  22996. wx.getSetting({
  22997. withSubscriptions: true,
  22998. success (res) {
  22999. console.log(res.authSetting)
  23000. // res.authSetting = {
  23001. // "scope.userInfo": true,
  23002. // "scope.userLocation": true
  23003. // }
  23004. console.log(res.subscriptionsSetting)
  23005. // res.subscriptionsSetting = {
  23006. // mainSwitch: true, // 订阅消息总开关
  23007. // itemSettings: { // 每一项开关
  23008. // SYS_MSG_TYPE_INTERACTIVE: 'accept', // 小游戏系统订阅消息
  23009. // SYS_MSG_TYPE_RANK: 'accept'
  23010. // zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: 'reject', // 普通一次性订阅消息
  23011. // ke_OZC_66gZxALLcsuI7ilCJSP2OJ2vWo2ooUPpkWrw: 'ban',
  23012. // }
  23013. // }
  23014. }
  23015. })
  23016. ``` */
  23017. getSetting<T extends GetSettingOption = GetSettingOption>(
  23018. option?: T
  23019. ): PromisifySuccessResult<T, GetSettingOption>
  23020. /** [wx.getShareInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.getShareInfo.html)
  23021. *
  23022. * 需要基础库: `1.1.0`
  23023. *
  23024. * 在插件中使用:需要基础库 `2.1.0`
  23025. *
  23026. * 在插件中使用时,只能在当前插件的页面中调用
  23027. *
  23028. * 获取转发详细信息(主要是获取群ID)。 从群聊内的小程序消息卡片打开小程序时,调用此接口才有效。从基础库 v2.17.3 开始,推荐用 [wx.getGroupEnterInfo](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/group/wx.getGroupEnterInfo.html) 替代此接口。
  23029. *
  23030. * **示例代码**
  23031. *
  23032. * 敏感数据获取方式 [加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) 。
  23033. * 获取得到的开放数据为以下 json 结构(其中 openGId 为当前群的唯一标识):
  23034. *
  23035. * ```json
  23036. {
  23037. "openGId": "OPENGID"
  23038. }
  23039. ```
  23040. *
  23041. * **Tips**
  23042. *
  23043. * - 如需要展示群名称,小程序可以使用 [开放数据组件](https://developers.weixin.qq.com/miniprogram/dev/component/open-data.html)
  23044. * - 小游戏可以通过 [`wx.getGroupInfo`](#) 接口获取群名称 */
  23045. getShareInfo<T extends GetShareInfoOption = GetShareInfoOption>(
  23046. option: T
  23047. ): PromisifySuccessResult<T, GetShareInfoOption>
  23048. /** [wx.getSkylineInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSkylineInfo.html)
  23049. *
  23050. * 需要基础库: `2.26.2`
  23051. *
  23052. * 在插件中使用:需要基础库 `2.26.2`
  23053. *
  23054. * 获取当前运行环境对于 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 的支持情况 */
  23055. getSkylineInfo(option?: GetSkylineInfoOption): void
  23056. /** [wx.getStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorage.html)
  23057. *
  23058. * 在插件中使用:需要基础库 `1.9.6`
  23059. *
  23060. * 从本地缓存中异步获取指定 key 的内容。
  23061. *
  23062. * **示例代码**
  23063. *
  23064. * ```js
  23065. wx.getStorage({
  23066. key: 'key',
  23067. success (res) {
  23068. console.log(res.data)
  23069. }
  23070. })
  23071. ```
  23072. *
  23073. * ```js
  23074. // 开启加密存储
  23075. wx.setStorage({
  23076. key: "key",
  23077. data: "value",
  23078. encrypt: true, // 若开启加密存储,setStorage 和 getStorage 需要同时声明 encrypt 的值为 true
  23079. success() {
  23080. wx.getStorage({
  23081. key: "key",
  23082. encrypt: true, // 若开启加密存储,setStorage 和 getStorage 需要同时声明 encrypt 的值为 true
  23083. success(res) {
  23084. console.log(res.data)
  23085. }
  23086. })
  23087. }
  23088. })
  23089. ``` */
  23090. getStorage<
  23091. T = any,
  23092. U extends GetStorageOption<T> = GetStorageOption<T>
  23093. >(
  23094. option: U
  23095. ): PromisifySuccessResult<U, GetStorageOption<T>>
  23096. /** [wx.getStorageInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.getStorageInfo.html)
  23097. *
  23098. * 在插件中使用:不支持
  23099. *
  23100. * 异步获取当前storage的相关信息。
  23101. *
  23102. * **示例代码**
  23103. *
  23104. * ```js
  23105. wx.getStorageInfo({
  23106. success (res) {
  23107. console.log(res.keys)
  23108. console.log(res.currentSize)
  23109. console.log(res.limitSize)
  23110. }
  23111. })
  23112. ```
  23113. *
  23114. * ```js
  23115. try {
  23116. const res = wx.getStorageInfoSync()
  23117. console.log(res.keys)
  23118. console.log(res.currentSize)
  23119. console.log(res.limitSize)
  23120. } catch (e) {
  23121. // Do something when catch error
  23122. }
  23123. ``` */
  23124. getStorageInfo<T extends GetStorageInfoOption = GetStorageInfoOption>(
  23125. option?: T
  23126. ): PromisifySuccessResult<T, GetStorageInfoOption>
  23127. /** [wx.getSystemInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfo.html)
  23128. *
  23129. * 在插件中使用:需要基础库 `1.9.6`
  23130. *
  23131. * 获取系统信息。**由于历史原因,wx.getSystemInfo 是异步的调用格式,但是是同步返回,需要异步获取系统信息请使用 [wx.getSystemInfoAsync](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoAsync.html)。**
  23132. *
  23133. * **示例代码**
  23134. *
  23135. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/WkUCgXmS7mqO)
  23136. *
  23137. * ```js
  23138. wx.getSystemInfo({
  23139. success (res) {
  23140. console.log(res.model)
  23141. console.log(res.pixelRatio)
  23142. console.log(res.windowWidth)
  23143. console.log(res.windowHeight)
  23144. console.log(res.language)
  23145. console.log(res.version)
  23146. console.log(res.platform)
  23147. }
  23148. })
  23149. ```
  23150. *
  23151. * ```js
  23152. try {
  23153. const res = wx.getSystemInfoSync()
  23154. console.log(res.model)
  23155. console.log(res.pixelRatio)
  23156. console.log(res.windowWidth)
  23157. console.log(res.windowHeight)
  23158. console.log(res.language)
  23159. console.log(res.version)
  23160. console.log(res.platform)
  23161. } catch (e) {
  23162. // Do something when catch error
  23163. }
  23164. ``` */
  23165. getSystemInfo<T extends GetSystemInfoOption = GetSystemInfoOption>(
  23166. option?: T
  23167. ): PromisifySuccessResult<T, GetSystemInfoOption>
  23168. /** [wx.getSystemInfoAsync(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoAsync.html)
  23169. *
  23170. * 需要基础库: `2.14.1`
  23171. *
  23172. * 在插件中使用:不支持
  23173. *
  23174. * 异步获取系统信息。需要一定的微信客户端版本支持,在不支持的客户端上,会使用同步实现来返回。
  23175. *
  23176. * **示例代码**
  23177. *
  23178. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/WkUCgXmS7mqO)
  23179. *
  23180. * ```js
  23181. wx.getSystemInfoAsync({
  23182. success (res) {
  23183. console.log(res.model)
  23184. console.log(res.pixelRatio)
  23185. console.log(res.windowWidth)
  23186. console.log(res.windowHeight)
  23187. console.log(res.language)
  23188. console.log(res.version)
  23189. console.log(res.platform)
  23190. }
  23191. })
  23192. ``` */
  23193. getSystemInfoAsync(option?: GetSystemInfoAsyncOption): void
  23194. /** [wx.getUserInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserInfo.html)
  23195. *
  23196. * 在插件中使用:需要基础库 `2.3.1`
  23197. *
  23198. * 在插件中使用时,需要在用户信息功能页中获得用户授权或满足一定条件后调用。否则将返回 fail。详见 [用户信息功能页](https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/functional-pages/user-info.html)
  23199. *
  23200. * @warning **用户头像昵称获取规则已调整,参考 [用户信息接口调整说明](https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801)、[小程序用户头像昵称获取规则调整公告](https://developers.weixin.qq.com/community/develop/doc/00022c683e8a80b29bed2142b56c01)**
  23201. *
  23202. * 获取用户信息。
  23203. *
  23204. * **示例代码**
  23205. *
  23206. * ```js
  23207. // 必须是在用户已经授权的情况下调用
  23208. wx.getUserInfo({
  23209. success: function(res) {
  23210. var userInfo = res.userInfo
  23211. var nickName = userInfo.nickName
  23212. var avatarUrl = userInfo.avatarUrl
  23213. var gender = userInfo.gender //性别 0:未知、1:男、2:女
  23214. var province = userInfo.province
  23215. var city = userInfo.city
  23216. var country = userInfo.country
  23217. }
  23218. })
  23219. ```
  23220. *
  23221. * 敏感数据有两种获取方式:
  23222. * 1. 使用 [加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法)
  23223. * 2. 使用 [云调用直接获取开放数据](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#云调用直接获取开放数据)
  23224. * 获取得到的开放数据为以下 json 结构:
  23225. *
  23226. * ```json
  23227. {
  23228. "openId": "OPENID",
  23229. "nickName": "NICKNAME",
  23230. "gender": GENDER,
  23231. "city": "CITY",
  23232. "province": "PROVINCE",
  23233. "country": "COUNTRY",
  23234. "avatarUrl": "AVATARURL",
  23235. "unionId": "UNIONID",
  23236. "watermark": {
  23237. "appid":"APPID",
  23238. "timestamp":TIMESTAMP
  23239. }
  23240. }
  23241. ```
  23242. *
  23243. * **小程序用户信息组件示例代码**
  23244. *
  23245. * ```html
  23246. * <!-- 如果只是展示用户头像昵称,可以使用 <open-data /> 组件 -->
  23247. * <open-data type="userAvatarUrl"></open-data>
  23248. * <open-data type="userNickName"></open-data>
  23249. * <!-- 需要使用 button 来授权登录 -->
  23250. * <button wx:if="{{canIUse}}" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">授权登录</button>
  23251. * <view wx:else>请升级微信版本</view>
  23252. * ```
  23253. *
  23254. * ```js
  23255. Page({
  23256. data: {
  23257. canIUse: wx.canIUse('button.open-type.getUserInfo')
  23258. },
  23259. onLoad: function() {
  23260. // 查看是否授权
  23261. wx.getSetting({
  23262. success (res){
  23263. if (res.authSetting['scope.userInfo']) {
  23264. // 已经授权,可以直接调用 getUserInfo 获取头像昵称
  23265. wx.getUserInfo({
  23266. success: function(res) {
  23267. console.log(res.userInfo)
  23268. }
  23269. })
  23270. }
  23271. }
  23272. })
  23273. },
  23274. bindGetUserInfo (e) {
  23275. console.log(e.detail.userInfo)
  23276. }
  23277. })
  23278. ``` */
  23279. getUserInfo<T extends GetUserInfoOption = GetUserInfoOption>(
  23280. option: T
  23281. ): PromisifySuccessResult<T, GetUserInfoOption>
  23282. /** [wx.getUserProfile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/user-info/wx.getUserProfile.html)
  23283. *
  23284. * 需要基础库: `2.10.4`
  23285. *
  23286. * 在插件中使用:不支持
  23287. *
  23288. * @warning **用户头像昵称获取规则已调整,参考 [小程序用户头像昵称获取规则调整公告](https://developers.weixin.qq.com/community/develop/doc/00022c683e8a80b29bed2142b56c01)**
  23289. *
  23290. * 获取用户信息。页面产生点击事件(例如 `button` 上 `bindtap` 的回调中)后才可调用,每次请求都会弹出授权窗口,用户同意后返回 `userInfo`。该接口用于替换 `wx.getUserInfo`,详见 [用户信息接口调整说明](https://developers.weixin.qq.com/community/develop/doc/000cacfa20ce88df04cb468bc52801?highLine=login)。
  23291. *
  23292. * **示例代码**
  23293. *
  23294. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/tsJaq2mP7Mp4)
  23295. *
  23296. * **Bug & Tip**
  23297. *
  23298. * 1. `tip`:仅小程序中 `wx.getUserInfo` 接口进行调整,小游戏中不受影响;
  23299. * 2. `tip`:开发者工具中仅 2.10.4 及以上版本可访问 `wx.getUserProfile` 接口,在真机上可参考示例代码进行判断,无需根据版本号或者 `canIUse` 进行条件。
  23300. * 3. `tip`:`wx.getUserProfile` 返回的加密数据中不包含 `openId` 和 `unionId` 字段。
  23301. * 4. `bug`:开发者工具中 `2.10.4`~`2.16.1` 基础库版本通过 `<button open-type="getUserInfo">` 会返回真实数据,真机上此区间会按照公告返回匿名数据。
  23302. *
  23303. * ```html
  23304. * <view class="container">
  23305. * <view class="userinfo">
  23306. * <block wx:if="{{!hasUserInfo}}">
  23307. * <button wx:if="{{canIUseGetUserProfile}}" bindtap="getUserProfile"> 获取头像昵称 </button>
  23308. * <button wx:else open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button>
  23309. * </block>
  23310. * <block wx:else>
  23311. * <image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image>
  23312. * <text class="userinfo-nickname">{{userInfo.nickName}}</text>
  23313. * </block>
  23314. * </view>
  23315. * </view>
  23316. * ```
  23317. *
  23318. * ```js
  23319. Page({
  23320. data: {
  23321. userInfo: {},
  23322. hasUserInfo: false,
  23323. canIUseGetUserProfile: false,
  23324. },
  23325. onLoad() {
  23326. if (wx.getUserProfile) {
  23327. this.setData({
  23328. canIUseGetUserProfile: true
  23329. })
  23330. }
  23331. },
  23332. getUserProfile(e) {
  23333. // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认
  23334. // 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
  23335. wx.getUserProfile({
  23336. desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
  23337. success: (res) => {
  23338. this.setData({
  23339. userInfo: res.userInfo,
  23340. hasUserInfo: true
  23341. })
  23342. }
  23343. })
  23344. },
  23345. getUserInfo(e) {
  23346. // 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息
  23347. this.setData({
  23348. userInfo: e.detail.userInfo,
  23349. hasUserInfo: true
  23350. })
  23351. },
  23352. })
  23353. ``` */
  23354. getUserProfile<T extends GetUserProfileOption = GetUserProfileOption>(
  23355. option: T
  23356. ): PromisifySuccessResult<T, GetUserProfileOption>
  23357. /** [wx.getVideoInfo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.getVideoInfo.html)
  23358. *
  23359. * 需要基础库: `2.11.0`
  23360. *
  23361. * 在插件中使用:支持
  23362. *
  23363. * 获取视频详细信息。 */
  23364. getVideoInfo<T extends GetVideoInfoOption = GetVideoInfoOption>(
  23365. option: T
  23366. ): PromisifySuccessResult<T, GetVideoInfoOption>
  23367. /** [wx.getWeRunData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.getWeRunData.html)
  23368. *
  23369. * 需要基础库: `1.2.0`
  23370. *
  23371. * 在插件中使用:不支持
  23372. *
  23373. * 获取用户过去三十一天微信运动步数。需要先调用 [wx.login](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html) 接口。步数信息会在用户主动进入小程序时更新。
  23374. *
  23375. * **示例代码**
  23376. *
  23377. * ```js
  23378. wx.getWeRunData({
  23379. success (res) {
  23380. // 拿 encryptedData 到开发者后台解密开放数据
  23381. const encryptedData = res.encryptedData
  23382. // 或拿 cloudID 通过云调用直接获取开放数据
  23383. const cloudID = res.cloudID
  23384. }
  23385. })
  23386. ```
  23387. *
  23388. * **开放数据 JSON 结构**
  23389. *
  23390. * 敏感数据有两种获取方式,一是使用 [加密数据解密算法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/signature.html#加密数据解密算法) 。
  23391. * 获取得到的开放数据为以下 json 结构:
  23392. *
  23393. * ```json
  23394. {
  23395. "stepInfoList": [
  23396. {
  23397. "timestamp": 1445866601,
  23398. "step": 100
  23399. },
  23400. {
  23401. "timestamp": 1445876601,
  23402. "step": 120
  23403. }
  23404. ]
  23405. }
  23406. ```
  23407. *
  23408. * stepInfoList 中,每一项结构如下:
  23409. *
  23410. * | 属性 | 类型 | 说明 |
  23411. * | --- | ---- | --- |
  23412. * | timestamp | number | 时间戳,表示数据对应的时间 |
  23413. * | step | number | 微信运动步数 | */
  23414. getWeRunData<T extends GetWeRunDataOption = GetWeRunDataOption>(
  23415. option?: T
  23416. ): PromisifySuccessResult<T, GetWeRunDataOption>
  23417. /** [wx.getWifiList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.getWifiList.html)
  23418. *
  23419. * 需要基础库: `1.6.0`
  23420. *
  23421. * 在插件中使用:需要基础库 `2.9.1`
  23422. *
  23423. * 请求获取 Wi-Fi 列表。`wifiList` 数据会在 [onGetWifiList](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onGetWifiList.html) 注册的回调中返回。 **Android 调用前需要 [用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.userLocation。**
  23424. *
  23425. * iOS 上将跳转到系统设置中的微信设置页,需要用户手动进入「无线局域网」设置页,并在系统扫描到设备后,小程序才能收到 onGetWifiList 回调。Android 不会跳转。
  23426. *
  23427. * **注意**
  23428. *
  23429. * 因系统问题,本方法在 iOS 11.0 及 11.1 两个版本失效。但在 iOS 11.2 中已修复。 */
  23430. getWifiList<T extends GetWifiListOption = GetWifiListOption>(
  23431. option?: T
  23432. ): PromisifySuccessResult<T, GetWifiListOption>
  23433. /** [wx.hideHomeButton(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideHomeButton.html)
  23434. *
  23435. * 需要基础库: `2.8.3`
  23436. *
  23437. * 在插件中使用:不支持
  23438. *
  23439. * 隐藏返回首页按钮。微信7.0.7版本起,当用户打开的小程序最底层页面是非首页时,默认展示“返回首页”按钮,开发者可在页面 onShow 中调用 hideHomeButton 进行隐藏。 */
  23440. hideHomeButton<T extends HideHomeButtonOption = HideHomeButtonOption>(
  23441. option?: T
  23442. ): PromisifySuccessResult<T, HideHomeButtonOption>
  23443. /** [wx.hideKeyboard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.hideKeyboard.html)
  23444. *
  23445. * 需要基础库: `2.8.2`
  23446. *
  23447. * 在插件中使用:不支持
  23448. *
  23449. * 在input、textarea等focus拉起键盘之后,手动调用此接口收起键盘
  23450. *
  23451. * **示例代码**
  23452. *
  23453. * ```js
  23454. wx.hideKeyboard({
  23455. complete: res => {
  23456. console.log('hideKeyboard res', res)
  23457. }
  23458. })
  23459. ``` */
  23460. hideKeyboard<T extends HideKeyboardOption = HideKeyboardOption>(
  23461. option?: T
  23462. ): PromisifySuccessResult<T, HideKeyboardOption>
  23463. /** [wx.hideLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideLoading.html)
  23464. *
  23465. * 需要基础库: `1.1.0`
  23466. *
  23467. * 在插件中使用:需要基础库 `1.9.6`
  23468. *
  23469. * 隐藏 loading 提示框 */
  23470. hideLoading<T extends HideLoadingOption = HideLoadingOption>(
  23471. option?: T
  23472. ): PromisifySuccessResult<T, HideLoadingOption>
  23473. /** [wx.hideNavigationBarLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.hideNavigationBarLoading.html)
  23474. *
  23475. * 在插件中使用:需要基础库 `2.1.0`
  23476. *
  23477. * 在插件中使用时,只能在当前插件的页面中调用
  23478. *
  23479. * 在当前页面隐藏导航条加载动画 */
  23480. hideNavigationBarLoading<
  23481. T extends HideNavigationBarLoadingOption = HideNavigationBarLoadingOption
  23482. >(
  23483. option?: T
  23484. ): PromisifySuccessResult<T, HideNavigationBarLoadingOption>
  23485. /** [wx.hideShareMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.hideShareMenu.html)
  23486. *
  23487. * 需要基础库: `1.1.0`
  23488. *
  23489. * 在插件中使用:需要基础库 `2.1.0`
  23490. *
  23491. * 在插件中使用时,只能在当前插件的页面中调用
  23492. *
  23493. * 隐藏当前页面的转发按钮
  23494. *
  23495. * ****
  23496. *
  23497. * ## 注意事项
  23498. * - "shareAppMessage"表示“发送给朋友”按钮,"shareTimeline"表示“分享到朋友圈”按钮
  23499. * - 隐藏“发送给朋友”按钮时必须同时隐藏“分享到朋友圈”按钮,隐藏“分享到朋友圈”按钮时则允许不隐藏“发送给朋友”按钮
  23500. *
  23501. * **示例代码**
  23502. *
  23503. * ```js
  23504. wx.hideShareMenu({
  23505. menus: ['shareAppMessage', 'shareTimeline']
  23506. })
  23507. ``` */
  23508. hideShareMenu<T extends HideShareMenuOption = HideShareMenuOption>(
  23509. option?: T
  23510. ): PromisifySuccessResult<T, HideShareMenuOption>
  23511. /** [wx.hideTabBar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBar.html)
  23512. *
  23513. * 需要基础库: `1.9.0`
  23514. *
  23515. * 在插件中使用:不支持
  23516. *
  23517. * 隐藏 tabBar */
  23518. hideTabBar<T extends HideTabBarOption = HideTabBarOption>(
  23519. option: T
  23520. ): PromisifySuccessResult<T, HideTabBarOption>
  23521. /** [wx.hideTabBarRedDot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.hideTabBarRedDot.html)
  23522. *
  23523. * 需要基础库: `1.9.0`
  23524. *
  23525. * 在插件中使用:不支持
  23526. *
  23527. * 隐藏 tabBar 某一项的右上角的红点 */
  23528. hideTabBarRedDot<
  23529. T extends HideTabBarRedDotOption = HideTabBarRedDotOption
  23530. >(
  23531. option: T
  23532. ): PromisifySuccessResult<T, HideTabBarRedDotOption>
  23533. /** [wx.hideToast(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.hideToast.html)
  23534. *
  23535. * 在插件中使用:需要基础库 `1.9.6`
  23536. *
  23537. * 隐藏消息提示框 */
  23538. hideToast<T extends HideToastOption = HideToastOption>(
  23539. option?: T
  23540. ): PromisifySuccessResult<T, HideToastOption>
  23541. /** [wx.initFaceDetect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/face/wx.initFaceDetect.html)
  23542. *
  23543. * 需要基础库: `2.18.0`
  23544. *
  23545. * 在插件中使用:需要基础库 `2.21.3`
  23546. *
  23547. * @warning **该接口已停止维护,推荐使用 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 代替**
  23548. *
  23549. * 初始化人脸检测。本接口不再维护,请使用 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 接口代替。详情参考[人脸检测指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/face.html)
  23550. *
  23551. * ****
  23552. *
  23553. * ### 特别说明
  23554. * 若小程序人脸识别功能涉及采集、存储用户生物特征(如人脸照片或视频、身份证和手持身份证、身份证照和免冠照等),此类型服务需使用[微信原生人脸识别接口](https://developers.weixin.qq.com/community/develop/doc/000442d352c1202bd498ecb105c00d?highline=%E4%BA%BA%E8%84%B8%E6%A0%B8%E8%BA%AB)。 */
  23555. initFaceDetect(option?: InitFaceDetectOption): void
  23556. /** [wx.isBluetoothDevicePaired(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.isBluetoothDevicePaired.html)
  23557. *
  23558. * 需要基础库: `2.20.1`
  23559. *
  23560. * 在插件中使用:需要基础库 `2.19.1`
  23561. *
  23562. * 查询蓝牙设备是否配对,仅安卓支持。 */
  23563. isBluetoothDevicePaired<
  23564. T extends IsBluetoothDevicePairedOption = IsBluetoothDevicePairedOption
  23565. >(
  23566. option: T
  23567. ): PromisifySuccessResult<T, IsBluetoothDevicePairedOption>
  23568. /** [wx.join1v1Chat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.join1v1Chat.html)
  23569. *
  23570. * 需要基础库: `2.20.1`
  23571. *
  23572. * 在插件中使用:不支持
  23573. *
  23574. * 加入(创建)双人通话。 */
  23575. join1v1Chat(option: Join1v1ChatOption): void
  23576. /** [wx.joinVoIPChat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.joinVoIPChat.html)
  23577. *
  23578. * 需要基础库: `2.7.0`
  23579. *
  23580. * 在插件中使用:需要基础库 `2.9.0`
  23581. *
  23582. * 加入 (创建) 实时语音通话,更多信息可见 [实时语音指南](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/voip-chat.html)。调用前需要用户授权 `scope.record`,若房间类型为视频房间需要用户授权 `scope.camera`。 */
  23583. joinVoIPChat<T extends JoinVoIPChatOption = JoinVoIPChatOption>(
  23584. option: T
  23585. ): PromisifySuccessResult<T, JoinVoIPChatOption>
  23586. /** [wx.loadFontFace(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/font/wx.loadFontFace.html)
  23587. *
  23588. * 需要基础库: `2.1.0`
  23589. *
  23590. * 在插件中使用:需要基础库 `2.15.0`
  23591. *
  23592. * 动态加载网络字体,文件地址需为下载类型。[2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)起支持全局生效,需在 `app.js` 中调用。
  23593. *
  23594. * 注意:
  23595. * 1. 字体文件返回的 contet-type 参考 [font](https://www.iana.org/assignments/media-types/media-types.xhtml#font),格式不正确时会解析失败。
  23596. * 2. 字体链接必须是https(ios不支持http)
  23597. * 3. 字体链接必须是同源下的,或开启了cors支持,小程序的域名是`servicewechat.com`
  23598. * 4. 工具里提示 Faild to load font可以忽略
  23599. * 5. [2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 以前仅在调用页面生效。
  23600. *
  23601. * **示例代码**
  23602. *
  23603. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/b6Zrajm67R2x)
  23604. * ```js
  23605. wx.loadFontFace({
  23606. family: 'Bitstream Vera Serif Bold',
  23607. source: 'url("https://sungd.github.io/Pacifico.ttf")',
  23608. success: console.log
  23609. })
  23610. ``` */
  23611. loadFontFace<T extends LoadFontFaceOption = LoadFontFaceOption>(
  23612. option: T
  23613. ): PromisifySuccessResult<T, LoadFontFaceOption>
  23614. /** [wx.login(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.login.html)
  23615. *
  23616. * 在插件中使用:需要基础库 `2.3.1`
  23617. *
  23618. * 在插件中使用时,需要在用户信息功能页中获得用户授权或满足一定条件后调用。否则将返回 fail。详见 [用户信息功能页](https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/functional-pages/user-info.html)
  23619. *
  23620. * 调用接口获取登录凭证(code)。通过凭证进而换取用户登录态信息,包括用户在当前小程序的唯一标识(openid)、微信开放平台账号下的唯一标识(unionid,若当前小程序已绑定到微信开放平台账号)及本次登录的会话密钥(session_key)等。用户数据的加解密通讯需要依赖会话密钥完成。
  23621. *
  23622. * **示例代码**
  23623. *
  23624. * ```js
  23625. wx.login({
  23626. success (res) {
  23627. if (res.code) {
  23628. //发起网络请求
  23629. wx.request({
  23630. url: 'https://example.com/onLogin',
  23631. data: {
  23632. code: res.code
  23633. }
  23634. })
  23635. } else {
  23636. console.log('登录失败!' + res.errMsg)
  23637. }
  23638. }
  23639. })
  23640. ``` */
  23641. login<T extends LoginOption = LoginOption>(
  23642. option?: T
  23643. ): PromisifySuccessResult<T, LoginOption>
  23644. /** [wx.makeBluetoothPair(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.makeBluetoothPair.html)
  23645. *
  23646. * 需要基础库: `2.12.0`
  23647. *
  23648. * 在插件中使用:需要基础库 `2.12.0`
  23649. *
  23650. * 蓝牙配对接口,仅安卓支持。
  23651. *
  23652. * 通常情况下(需要指定 `pin` 码或者密码时)系统会接管配对流程,直接调用 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 即可。该接口只应当在开发者不想让用户手动输入 `pin` 码且真机验证确认可以正常生效情况下用。 */
  23653. makeBluetoothPair<
  23654. T extends MakeBluetoothPairOption = MakeBluetoothPairOption
  23655. >(
  23656. option: T
  23657. ): PromisifySuccessResult<T, MakeBluetoothPairOption>
  23658. /** [wx.makePhoneCall(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/phone/wx.makePhoneCall.html)
  23659. *
  23660. * 在插件中使用:需要基础库 `1.9.6`
  23661. *
  23662. * 拨打电话
  23663. *
  23664. * **示例代码**
  23665. *
  23666. * ```js
  23667. wx.makePhoneCall({
  23668. phoneNumber: '1340000' //仅为示例,并非真实的电话号码
  23669. })
  23670. ``` */
  23671. makePhoneCall<T extends MakePhoneCallOption = MakePhoneCallOption>(
  23672. option: T
  23673. ): PromisifySuccessResult<T, MakePhoneCallOption>
  23674. /** [wx.navigateBack(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html)
  23675. *
  23676. * 在插件中使用:需要基础库 `2.1.0`
  23677. *
  23678. * 在插件中使用时,只能在当前插件的页面中调用
  23679. *
  23680. * 关闭当前页面,返回上一页面或多级页面。可通过 [getCurrentPages](https://developers.weixin.qq.com/miniprogram/dev/reference/api/getCurrentPages.html) 获取当前的页面栈,决定需要返回几层。 */
  23681. navigateBack<T extends NavigateBackOption = NavigateBackOption>(
  23682. option?: T
  23683. ): PromisifySuccessResult<T, NavigateBackOption>
  23684. /** [wx.navigateBackMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.navigateBackMiniProgram.html)
  23685. *
  23686. * 需要基础库: `1.3.0`
  23687. *
  23688. * 在插件中使用:不支持
  23689. *
  23690. * 返回到上一个小程序。只有在当前小程序是被其他小程序打开时可以调用成功
  23691. *
  23692. * 注意:**微信客户端 iOS 6.5.9,Android 6.5.10 及以上版本支持**
  23693. *
  23694. * **示例代码**
  23695. *
  23696. * ```js
  23697. wx.navigateBackMiniProgram({
  23698. extraData: {
  23699. foo: 'bar'
  23700. },
  23701. success(res) {
  23702. // 返回成功
  23703. }
  23704. })
  23705. ``` */
  23706. navigateBackMiniProgram<
  23707. T extends NavigateBackMiniProgramOption = NavigateBackMiniProgramOption
  23708. >(
  23709. option: T
  23710. ): PromisifySuccessResult<T, NavigateBackMiniProgramOption>
  23711. /** [wx.navigateTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateTo.html)
  23712. *
  23713. * 在插件中使用:需要基础库 `2.2.2`
  23714. *
  23715. * 在插件中使用时,只能在当前插件的页面中调用
  23716. *
  23717. * 保留当前页面,跳转到应用内的某个页面。但是不能跳到 tabbar 页面。使用 [wx.navigateBack](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html) 可以返回到原页面。小程序中页面栈最多十层。
  23718. *
  23719. * **示例代码**
  23720. *
  23721. * ```js
  23722. wx.navigateTo({
  23723. url: 'test?id=1',
  23724. events: {
  23725. // 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
  23726. acceptDataFromOpenedPage: function(data) {
  23727. console.log(data)
  23728. },
  23729. someEvent: function(data) {
  23730. console.log(data)
  23731. }
  23732. ...
  23733. },
  23734. success: function(res) {
  23735. // 通过eventChannel向被打开页面传送数据
  23736. res.eventChannel.emit('acceptDataFromOpenerPage', { data: 'test' })
  23737. }
  23738. })
  23739. ```
  23740. *
  23741. * ```javascript
  23742. //test.js
  23743. Page({
  23744. onLoad: function(option){
  23745. console.log(option.query)
  23746. const eventChannel = this.getOpenerEventChannel()
  23747. eventChannel.emit('acceptDataFromOpenedPage', {data: 'test'});
  23748. eventChannel.emit('someEvent', {data: 'test'});
  23749. // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
  23750. eventChannel.on('acceptDataFromOpenerPage', function(data) {
  23751. console.log(data)
  23752. })
  23753. }
  23754. })
  23755. ``` */
  23756. navigateTo<T extends NavigateToOption = NavigateToOption>(
  23757. option: T
  23758. ): PromisifySuccessResult<T, NavigateToOption>
  23759. /** [wx.navigateToMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.navigateToMiniProgram.html)
  23760. *
  23761. * 需要基础库: `1.3.0`
  23762. *
  23763. * 在插件中使用:需要基础库 `2.18.1`
  23764. *
  23765. * 打开另一个小程序
  23766. *
  23767. * **使用限制**
  23768. *
  23769. * ##### 需要用户触发跳转
  23770. * 从 2.3.0 版本开始,若用户未点击小程序页面任意位置,则开发者将无法调用此接口自动跳转至其他小程序。
  23771. * ##### 需要用户确认跳转
  23772. * 从 2.3.0 版本开始,在跳转至其他小程序前,将统一增加弹窗,询问是否跳转,用户确认后才可以跳转其他小程序。如果用户点击取消,则回调 `fail cancel`。
  23773. * ##### 无需声明跳转名单,不限跳转数量(众测中)
  23774. * 1. 从2020年4月24日起,使用跳转其他小程序功能将无需在全局配置中声明跳转名单,调用此接口时将不再校验所跳转的 AppID 是否在 navigateToMiniProgramAppIdList 中。
  23775. * 2. 从2020年4月24日起,跳转其他小程序将不再受数量限制,使用此功能时请注意遵守运营规范。
  23776. *
  23777. * **运营规范**
  23778. *
  23779. * 平台将坚决打击小程序盒子等互推行为,使用此功能时请严格遵守[《微信小程序平台运营规范》](https://developers.weixin.qq.com/miniprogram/product/#_5-10-%E4%BA%92%E6%8E%A8%E8%A1%8C%E4%B8%BA),若发现小程序违反运营规范将被下架处理。
  23780. *
  23781. * **关于调试**
  23782. *
  23783. * - 在开发者工具上调用此 API 并不会真实的跳转到另外的小程序,但是开发者工具会校验本次调用跳转是否成功。[详情](https://developers.weixin.qq.com/miniprogram/dev/devtools/different.html#跳转小程序调试支持)
  23784. * - 开发者工具上支持被跳转的小程序处理接收参数的调试。[详情](https://developers.weixin.qq.com/miniprogram/dev/devtools/different.html#跳转小程序调试支持)
  23785. *
  23786. * **示例代码**
  23787. *
  23788. * ```js
  23789. wx.navigateToMiniProgram({
  23790. appId: '',
  23791. path: 'page/index/index?id=123',
  23792. extraData: {
  23793. foo: 'bar'
  23794. },
  23795. envVersion: 'develop',
  23796. success(res) {
  23797. // 打开成功
  23798. }
  23799. })
  23800. ``` */
  23801. navigateToMiniProgram<
  23802. T extends NavigateToMiniProgramOption = NavigateToMiniProgramOption
  23803. >(
  23804. option: T
  23805. ): PromisifySuccessResult<T, NavigateToMiniProgramOption>
  23806. /** [wx.nextTick(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/custom-component/wx.nextTick.html)
  23807. *
  23808. * 需要基础库: `2.2.3`
  23809. *
  23810. * 在插件中使用:需要基础库 `2.7.1`
  23811. *
  23812. * 延迟一部分操作到下一个时间片再执行。(类似于 setTimeout)
  23813. *
  23814. * **说明**
  23815. *
  23816. * 因为自定义组件中的 setData 和 triggerEvent 等接口本身是同步的操作,当这几个接口被连续调用时,都是在一个同步流程中执行完的,因此若逻辑不当可能会导致出错。
  23817. *
  23818. * 一个极端的案例:当父组件的 setData 引发了子组件的 triggerEvent,进而使得父组件又进行了一次 setData,期间有通过 wx:if 语句对子组件进行卸载,就有可能引发奇怪的错误,所以对于不需要在一个同步流程内完成的逻辑,可以使用此接口延迟到下一个时间片再执行。
  23819. *
  23820. * **示例代码**
  23821. *
  23822. * ```js
  23823. Component({
  23824. doSth() {
  23825. this.setData({ number: 1 }) // 直接在当前同步流程中执行
  23826. wx.nextTick(() => {
  23827. this.setData({ number: 3 }) // 在当前同步流程结束后,下一个时间片执行
  23828. })
  23829. this.setData({ number: 2 }) // 直接在当前同步流程中执行
  23830. }
  23831. })
  23832. ``` */
  23833. nextTick(callback: (...args: any[]) => any): void
  23834. /** [wx.notifyBLECharacteristicValueChange(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.notifyBLECharacteristicValueChange.html)
  23835. *
  23836. * 需要基础库: `1.1.0`
  23837. *
  23838. * 在插件中使用:需要基础库 `1.9.6`
  23839. *
  23840. * 启用蓝牙低功耗设备特征值变化时的 notify 功能,订阅特征。注意:必须设备的特征支持 notify 或者 indicate 才可以成功调用。
  23841. *
  23842. * 另外,必须先启用 [wx.notifyBLECharacteristicValueChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.notifyBLECharacteristicValueChange.html) 才能监听到设备 `characteristicValueChange` 事件
  23843. *
  23844. * **注意**
  23845. *
  23846. * - 订阅操作成功后需要设备主动更新特征的 value,才会触发 [wx.onBLECharacteristicValueChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLECharacteristicValueChange.html) 回调。
  23847. * - 安卓平台上,在本接口调用成功后立即调用 [wx.writeBLECharacteristicValue](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.writeBLECharacteristicValue.html) 接口,在部分机型上会发生 10008 系统错误
  23848. *
  23849. * **示例代码**
  23850. *
  23851. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  23852. * ```js
  23853. wx.notifyBLECharacteristicValueChange({
  23854. state: true, // 启用 notify 功能
  23855. // 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
  23856. deviceId,
  23857. // 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
  23858. serviceId,
  23859. // 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
  23860. characteristicId,
  23861. success (res) {
  23862. console.log('notifyBLECharacteristicValueChange success', res.errMsg)
  23863. }
  23864. })
  23865. ``` */
  23866. notifyBLECharacteristicValueChange<
  23867. T extends NotifyBLECharacteristicValueChangeOption = NotifyBLECharacteristicValueChangeOption
  23868. >(
  23869. option: T
  23870. ): PromisifySuccessResult<T, NotifyBLECharacteristicValueChangeOption>
  23871. /** [wx.offAccelerometerChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.offAccelerometerChange.html)
  23872. *
  23873. * 需要基础库: `2.9.3`
  23874. *
  23875. * 在插件中使用:需要基础库 `2.9.1`
  23876. *
  23877. * 移除加速度数据事件的监听函数
  23878. *
  23879. * **示例代码**
  23880. *
  23881. * ```js
  23882. const listener = function (res) { console.log(res) }
  23883. wx.onAccelerometerChange(listener)
  23884. wx.offAccelerometerChange(listener) // 需传入与监听时同一个的函数对象
  23885. ``` */
  23886. offAccelerometerChange(
  23887. /** onAccelerometerChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  23888. listener?: OffAccelerometerChangeCallback
  23889. ): void
  23890. /** [wx.offApiCategoryChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.offApiCategoryChange.html)
  23891. *
  23892. * 需要基础库: `2.33.0`
  23893. *
  23894. * 在插件中使用:不支持
  23895. *
  23896. * 移除 API 类别变化事件的监听函数
  23897. *
  23898. * **示例代码**
  23899. *
  23900. * ```js
  23901. const listener = function (res) { console.log(res) }
  23902. wx.onApiCategoryChange(listener)
  23903. wx.offApiCategoryChange(listener) // 需传入与监听时同一个的函数对象
  23904. ``` */
  23905. offApiCategoryChange(
  23906. /** onApiCategoryChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  23907. listener?: OffApiCategoryChangeCallback
  23908. ): void
  23909. /** [wx.offAppHide(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppHide.html)
  23910. *
  23911. * 需要基础库: `2.1.2`
  23912. *
  23913. * 在插件中使用:不支持
  23914. *
  23915. * 移除小程序切后台事件的监听函数
  23916. *
  23917. * **示例代码**
  23918. *
  23919. * ```js
  23920. const listener = function (res) { console.log(res) }
  23921. wx.onAppHide(listener)
  23922. wx.offAppHide(listener) // 需传入与监听时同一个的函数对象
  23923. ``` */
  23924. offAppHide(
  23925. /** onAppHide 传入的监听函数。不传此参数则移除所有监听函数。 */
  23926. listener?: OffAppHideCallback
  23927. ): void
  23928. /** [wx.offAppShow(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAppShow.html)
  23929. *
  23930. * 需要基础库: `2.1.2`
  23931. *
  23932. * 在插件中使用:不支持
  23933. *
  23934. * 移除小程序切前台事件的监听函数
  23935. *
  23936. * **示例代码**
  23937. *
  23938. * ```js
  23939. const listener = function (res) { console.log(res) }
  23940. wx.onAppShow(listener)
  23941. wx.offAppShow(listener) // 需传入与监听时同一个的函数对象
  23942. ``` */
  23943. offAppShow(
  23944. /** onAppShow 传入的监听函数。不传此参数则移除所有监听函数。 */
  23945. listener?: OffAppShowCallback
  23946. ): void
  23947. /** [wx.offAudioInterruptionBegin(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAudioInterruptionBegin.html)
  23948. *
  23949. * 需要基础库: `2.6.2`
  23950. *
  23951. * 在插件中使用:需要基础库 `2.15.0`
  23952. *
  23953. * 移除音频因为受到系统占用而被中断开始事件的监听函数
  23954. *
  23955. * **示例代码**
  23956. *
  23957. * ```js
  23958. const listener = function (res) { console.log(res) }
  23959. wx.onAudioInterruptionBegin(listener)
  23960. wx.offAudioInterruptionBegin(listener) // 需传入与监听时同一个的函数对象
  23961. ``` */
  23962. offAudioInterruptionBegin(
  23963. /** onAudioInterruptionBegin 传入的监听函数。不传此参数则移除所有监听函数。 */
  23964. listener?: OffAudioInterruptionBeginCallback
  23965. ): void
  23966. /** [wx.offAudioInterruptionEnd(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offAudioInterruptionEnd.html)
  23967. *
  23968. * 需要基础库: `2.6.2`
  23969. *
  23970. * 在插件中使用:需要基础库 `2.15.0`
  23971. *
  23972. * 移除音频中断结束事件的监听函数
  23973. *
  23974. * **示例代码**
  23975. *
  23976. * ```js
  23977. const listener = function (res) { console.log(res) }
  23978. wx.onAudioInterruptionEnd(listener)
  23979. wx.offAudioInterruptionEnd(listener) // 需传入与监听时同一个的函数对象
  23980. ``` */
  23981. offAudioInterruptionEnd(
  23982. /** onAudioInterruptionEnd 传入的监听函数。不传此参数则移除所有监听函数。 */
  23983. listener?: OffAudioInterruptionEndCallback
  23984. ): void
  23985. /** [wx.offBLECharacteristicValueChange()](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.offBLECharacteristicValueChange.html)
  23986. *
  23987. * 需要基础库: `2.9.0`
  23988. *
  23989. * 在插件中使用:需要基础库 `2.9.1`
  23990. *
  23991. * 移除蓝牙低功耗设备的特征值变化事件的全部监听函数
  23992. *
  23993. * **示例代码**
  23994. *
  23995. * ```js
  23996. wx.offBLECharacteristicValueChange()
  23997. ``` */
  23998. offBLECharacteristicValueChange(): void
  23999. /** [wx.offBLEConnectionStateChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.offBLEConnectionStateChange.html)
  24000. *
  24001. * 需要基础库: `2.9.0`
  24002. *
  24003. * 在插件中使用:需要基础库 `2.9.1`
  24004. *
  24005. * 移除蓝牙低功耗连接状态改变事件的监听函数
  24006. *
  24007. * **示例代码**
  24008. *
  24009. * ```js
  24010. const listener = function (res) { console.log(res) }
  24011. wx.onBLEConnectionStateChange(listener)
  24012. wx.offBLEConnectionStateChange(listener) // 需传入与监听时同一个的函数对象
  24013. ``` */
  24014. offBLEConnectionStateChange(
  24015. /** onBLEConnectionStateChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  24016. listener?: OffBLEConnectionStateChangeCallback
  24017. ): void
  24018. /** [wx.offBLEMTUChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.offBLEMTUChange.html)
  24019. *
  24020. * 需要基础库: `2.20.1`
  24021. *
  24022. * 在插件中使用:需要基础库 `2.20.1`
  24023. *
  24024. * 移除蓝牙低功耗的最大传输单元变化事件的监听函数
  24025. *
  24026. * **示例代码**
  24027. *
  24028. * ```js
  24029. const listener = function (res) { console.log(res) }
  24030. wx.onBLEMTUChange(listener)
  24031. wx.offBLEMTUChange(listener) // 需传入与监听时同一个的函数对象
  24032. ``` */
  24033. offBLEMTUChange(
  24034. /** onBLEMTUChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  24035. listener?: OffBLEMTUChangeCallback
  24036. ): void
  24037. /** [wx.offBLEPeripheralConnectionStateChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.offBLEPeripheralConnectionStateChanged.html)
  24038. *
  24039. * 需要基础库: `2.10.3`
  24040. *
  24041. * 在插件中使用:需要基础库 `2.22.1`
  24042. *
  24043. * 移除当前外围设备被连接或断开连接事件的监听函数
  24044. *
  24045. * **示例代码**
  24046. *
  24047. * ```js
  24048. const listener = function (res) { console.log(res) }
  24049. wx.onBLEPeripheralConnectionStateChanged(listener)
  24050. wx.offBLEPeripheralConnectionStateChanged(listener) // 需传入与监听时同一个的函数对象
  24051. ``` */
  24052. offBLEPeripheralConnectionStateChanged(
  24053. /** onBLEPeripheralConnectionStateChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  24054. listener?: OffBLEPeripheralConnectionStateChangedCallback
  24055. ): void
  24056. /** [wx.offBeaconServiceChange()](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconServiceChange.html)
  24057. *
  24058. * 需要基础库: `2.8.1`
  24059. *
  24060. * 在插件中使用:需要基础库 `2.9.1`
  24061. *
  24062. * 移除 Beacon 服务状态变化事件的全部监听函数
  24063. *
  24064. * **示例代码**
  24065. *
  24066. * ```js
  24067. wx.offBeaconServiceChange()
  24068. ``` */
  24069. offBeaconServiceChange(): void
  24070. /** [wx.offBeaconUpdate()](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.offBeaconUpdate.html)
  24071. *
  24072. * 需要基础库: `2.8.1`
  24073. *
  24074. * 在插件中使用:需要基础库 `2.9.1`
  24075. *
  24076. * 移除 Beacon 设备更新事件的全部监听函数
  24077. *
  24078. * **示例代码**
  24079. *
  24080. * ```js
  24081. wx.offBeaconUpdate()
  24082. ``` */
  24083. offBeaconUpdate(): void
  24084. /** [wx.offBluetoothAdapterStateChange()](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothAdapterStateChange.html)
  24085. *
  24086. * 需要基础库: `2.9.0`
  24087. *
  24088. * 在插件中使用:需要基础库 `2.9.1`
  24089. *
  24090. * 移除蓝牙适配器状态变化事件的全部监听函数
  24091. *
  24092. * **示例代码**
  24093. *
  24094. * ```js
  24095. wx.offBluetoothAdapterStateChange()
  24096. ``` */
  24097. offBluetoothAdapterStateChange(): void
  24098. /** [wx.offBluetoothDeviceFound()](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.offBluetoothDeviceFound.html)
  24099. *
  24100. * 需要基础库: `2.9.0`
  24101. *
  24102. * 在插件中使用:需要基础库 `2.9.1`
  24103. *
  24104. * 移除搜索到新设备的事件的全部监听函数
  24105. *
  24106. * **示例代码**
  24107. *
  24108. * ```js
  24109. wx.offBluetoothDeviceFound()
  24110. ``` */
  24111. offBluetoothDeviceFound(): void
  24112. /** [wx.offCompassChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.offCompassChange.html)
  24113. *
  24114. * 需要基础库: `2.9.3`
  24115. *
  24116. * 在插件中使用:需要基础库 `2.9.1`
  24117. *
  24118. * 移除罗盘数据变化事件的监听函数
  24119. *
  24120. * **示例代码**
  24121. *
  24122. * ```js
  24123. const listener = function (res) { console.log(res) }
  24124. wx.onCompassChange(listener)
  24125. wx.offCompassChange(listener) // 需传入与监听时同一个的函数对象
  24126. ``` */
  24127. offCompassChange(
  24128. /** onCompassChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  24129. listener?: OffCompassChangeCallback
  24130. ): void
  24131. /** [wx.offCopyUrl()](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.offCopyUrl.html)
  24132. *
  24133. * 需要基础库: `2.14.3`
  24134. *
  24135. * 在插件中使用:不支持
  24136. *
  24137. * 移除用户点击右上角菜单的「复制链接」按钮时触发的事件的全部监听函数 */
  24138. offCopyUrl(): void
  24139. /** [wx.offDeviceMotionChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.offDeviceMotionChange.html)
  24140. *
  24141. * 需要基础库: `2.9.3`
  24142. *
  24143. * 在插件中使用:需要基础库 `2.9.1`
  24144. *
  24145. * 移除设备方向变化事件的监听函数
  24146. *
  24147. * **示例代码**
  24148. *
  24149. * ```js
  24150. const listener = function (res) { console.log(res) }
  24151. wx.onDeviceMotionChange(listener)
  24152. wx.offDeviceMotionChange(listener) // 需传入与监听时同一个的函数对象
  24153. ``` */
  24154. offDeviceMotionChange(
  24155. /** onDeviceMotionChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  24156. listener?: OffDeviceMotionChangeCallback
  24157. ): void
  24158. /** [wx.offEmbeddedMiniProgramHeightChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.offEmbeddedMiniProgramHeightChange.html)
  24159. *
  24160. * 需要基础库: `2.33.0`
  24161. *
  24162. * 在插件中使用:不支持
  24163. *
  24164. * 移除半屏小程序可视高度变化事件的监听函数
  24165. *
  24166. * **示例代码**
  24167. *
  24168. * ```js
  24169. const listener = function (res) { console.log(res) }
  24170. wx.onEmbeddedMiniProgramHeightChange(listener)
  24171. wx.offEmbeddedMiniProgramHeightChange(listener) // 需传入与监听时同一个的函数对象
  24172. ``` */
  24173. offEmbeddedMiniProgramHeightChange(
  24174. /** onEmbeddedMiniProgramHeightChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  24175. listener?: OffEmbeddedMiniProgramHeightChangeCallback
  24176. ): void
  24177. /** [wx.offError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offError.html)
  24178. *
  24179. * 需要基础库: `2.1.2`
  24180. *
  24181. * 在插件中使用:不支持
  24182. *
  24183. * 移除小程序错误事件的监听函数
  24184. *
  24185. * **示例代码**
  24186. *
  24187. * ```js
  24188. const listener = function (res) { console.log(res) }
  24189. wx.onError(listener)
  24190. wx.offError(listener) // 需传入与监听时同一个的函数对象
  24191. ``` */
  24192. offError(
  24193. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  24194. listener?: WxOffErrorCallback
  24195. ): void
  24196. /** [wx.offGetWifiList(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offGetWifiList.html)
  24197. *
  24198. * 需要基础库: `2.9.0`
  24199. *
  24200. * 在插件中使用:需要基础库 `2.9.1`
  24201. *
  24202. * 移除获取到 Wi-Fi 列表数据事件的监听函数
  24203. *
  24204. * **示例代码**
  24205. *
  24206. * ```js
  24207. const listener = function (res) { console.log(res) }
  24208. wx.onGetWifiList(listener)
  24209. wx.offGetWifiList(listener) // 需传入与监听时同一个的函数对象
  24210. ``` */
  24211. offGetWifiList(
  24212. /** onGetWifiList 传入的监听函数。不传此参数则移除所有监听函数。 */
  24213. listener?: OffGetWifiListCallback
  24214. ): void
  24215. /** [wx.offGyroscopeChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.offGyroscopeChange.html)
  24216. *
  24217. * 需要基础库: `2.9.3`
  24218. *
  24219. * 在插件中使用:需要基础库 `2.9.1`
  24220. *
  24221. * 移除陀螺仪数据变化事件的监听函数
  24222. *
  24223. * **示例代码**
  24224. *
  24225. * ```js
  24226. const listener = function (res) { console.log(res) }
  24227. wx.onGyroscopeChange(listener)
  24228. wx.offGyroscopeChange(listener) // 需传入与监听时同一个的函数对象
  24229. ``` */
  24230. offGyroscopeChange(
  24231. /** onGyroscopeChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  24232. listener?: OffGyroscopeChangeCallback
  24233. ): void
  24234. /** [wx.offHCEMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc-hce/wx.offHCEMessage.html)
  24235. *
  24236. * 需要基础库: `2.8.1`
  24237. *
  24238. * 在插件中使用:需要基础库 `2.9.1`
  24239. *
  24240. * 移除接收 NFC 设备消息事件的监听函数
  24241. *
  24242. * **示例代码**
  24243. *
  24244. * ```js
  24245. const listener = function (res) { console.log(res) }
  24246. wx.onHCEMessage(listener)
  24247. wx.offHCEMessage(listener) // 需传入与监听时同一个的函数对象
  24248. ``` */
  24249. offHCEMessage(
  24250. /** onHCEMessage 传入的监听函数。不传此参数则移除所有监听函数。 */
  24251. listener?: OffHCEMessageCallback
  24252. ): void
  24253. /** [wx.offKeyboardHeightChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.offKeyboardHeightChange.html)
  24254. *
  24255. * 需要基础库: `2.9.2`
  24256. *
  24257. * 在插件中使用:不支持
  24258. *
  24259. * 移除键盘高度变化事件的监听函数
  24260. *
  24261. * **示例代码**
  24262. *
  24263. * ```js
  24264. const listener = function (res) { console.log(res) }
  24265. wx.onKeyboardHeightChange(listener)
  24266. wx.offKeyboardHeightChange(listener) // 需传入与监听时同一个的函数对象
  24267. ``` */
  24268. offKeyboardHeightChange(
  24269. /** onKeyboardHeightChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  24270. listener?: OffKeyboardHeightChangeCallback
  24271. ): void
  24272. /** [wx.offLazyLoadError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offLazyLoadError.html)
  24273. *
  24274. * 需要基础库: `2.24.3`
  24275. *
  24276. * 在插件中使用:不支持
  24277. *
  24278. * 移除小程序异步组件加载失败事件的监听函数
  24279. *
  24280. * **示例代码**
  24281. *
  24282. * ```js
  24283. const listener = function (res) { console.log(res) }
  24284. wx.onLazyLoadError(listener)
  24285. wx.offLazyLoadError(listener) // 需传入与监听时同一个的函数对象
  24286. ``` */
  24287. offLazyLoadError(
  24288. /** onLazyLoadError 传入的监听函数。不传此参数则移除所有监听函数。 */
  24289. listener?: OffLazyLoadErrorCallback
  24290. ): void
  24291. /** [wx.offLocalServiceDiscoveryStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceDiscoveryStop.html)
  24292. *
  24293. * 需要基础库: `2.4.0`
  24294. *
  24295. * 在插件中使用:需要基础库 `2.15.0`
  24296. *
  24297. * 移除 mDNS 服务停止搜索的事件的监听函数
  24298. *
  24299. * **示例代码**
  24300. *
  24301. * ```js
  24302. const listener = function (res) { console.log(res) }
  24303. wx.onLocalServiceDiscoveryStop(listener)
  24304. wx.offLocalServiceDiscoveryStop(listener) // 需传入与监听时同一个的函数对象
  24305. ``` */
  24306. offLocalServiceDiscoveryStop(
  24307. /** onLocalServiceDiscoveryStop 传入的监听函数。不传此参数则移除所有监听函数。 */
  24308. listener?: OffLocalServiceDiscoveryStopCallback
  24309. ): void
  24310. /** [wx.offLocalServiceFound(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceFound.html)
  24311. *
  24312. * 需要基础库: `2.4.0`
  24313. *
  24314. * 在插件中使用:需要基础库 `2.15.0`
  24315. *
  24316. * 移除 mDNS 服务发现的事件的监听函数
  24317. *
  24318. * **示例代码**
  24319. *
  24320. * ```js
  24321. const listener = function (res) { console.log(res) }
  24322. wx.onLocalServiceFound(listener)
  24323. wx.offLocalServiceFound(listener) // 需传入与监听时同一个的函数对象
  24324. ``` */
  24325. offLocalServiceFound(
  24326. /** onLocalServiceFound 传入的监听函数。不传此参数则移除所有监听函数。 */
  24327. listener?: OffLocalServiceFoundCallback
  24328. ): void
  24329. /** [wx.offLocalServiceLost(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceLost.html)
  24330. *
  24331. * 需要基础库: `2.4.0`
  24332. *
  24333. * 在插件中使用:需要基础库 `2.15.0`
  24334. *
  24335. * 移除 mDNS 服务离开的事件的监听函数
  24336. *
  24337. * **示例代码**
  24338. *
  24339. * ```js
  24340. const listener = function (res) { console.log(res) }
  24341. wx.onLocalServiceLost(listener)
  24342. wx.offLocalServiceLost(listener) // 需传入与监听时同一个的函数对象
  24343. ``` */
  24344. offLocalServiceLost(
  24345. /** onLocalServiceLost 传入的监听函数。不传此参数则移除所有监听函数。 */
  24346. listener?: OffLocalServiceLostCallback
  24347. ): void
  24348. /** [wx.offLocalServiceResolveFail(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.offLocalServiceResolveFail.html)
  24349. *
  24350. * 需要基础库: `2.4.0`
  24351. *
  24352. * 在插件中使用:需要基础库 `2.15.0`
  24353. *
  24354. * 移除 mDNS 服务解析失败的事件的监听函数
  24355. *
  24356. * **示例代码**
  24357. *
  24358. * ```js
  24359. const listener = function (res) { console.log(res) }
  24360. wx.onLocalServiceResolveFail(listener)
  24361. wx.offLocalServiceResolveFail(listener) // 需传入与监听时同一个的函数对象
  24362. ``` */
  24363. offLocalServiceResolveFail(
  24364. /** onLocalServiceResolveFail 传入的监听函数。不传此参数则移除所有监听函数。 */
  24365. listener?: OffLocalServiceResolveFailCallback
  24366. ): void
  24367. /** [wx.offLocationChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.offLocationChange.html)
  24368. *
  24369. * 需要基础库: `2.8.1`
  24370. *
  24371. * 在插件中使用:不支持
  24372. *
  24373. * 移除实时地理位置变化事件的监听函数
  24374. *
  24375. * **示例代码**
  24376. *
  24377. * ```js
  24378. const listener = function (res) { console.log(res) }
  24379. wx.onLocationChange(listener)
  24380. wx.offLocationChange(listener) // 需传入与监听时同一个的函数对象
  24381. ``` */
  24382. offLocationChange(
  24383. /** onLocationChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  24384. listener?: OffLocationChangeCallback
  24385. ): void
  24386. /** [wx.offLocationChangeError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.offLocationChangeError.html)
  24387. *
  24388. * 需要基础库: `2.19.5`
  24389. *
  24390. * 在插件中使用:不支持
  24391. *
  24392. * 移除持续定位接口返回失败时触发。的监听函数
  24393. *
  24394. * **示例代码**
  24395. *
  24396. * ```js
  24397. const listener = function (res) { console.log(res) }
  24398. wx.onLocationChangeError(listener)
  24399. wx.offLocationChangeError(listener) // 需传入与监听时同一个的函数对象
  24400. ``` */
  24401. offLocationChangeError(
  24402. /** onLocationChangeError 传入的监听函数。不传此参数则移除所有监听函数。 */
  24403. listener?: OffLocationChangeErrorCallback
  24404. ): void
  24405. /** [wx.offMemoryWarning(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/memory/wx.offMemoryWarning.html)
  24406. *
  24407. * 需要基础库: `2.9.0`
  24408. *
  24409. * 在插件中使用:不支持
  24410. *
  24411. * 移除内存不足告警事件的监听函数
  24412. *
  24413. * **示例代码**
  24414. *
  24415. * ```js
  24416. const listener = function (res) { console.log(res) }
  24417. wx.onMemoryWarning(listener)
  24418. wx.offMemoryWarning(listener) // 需传入与监听时同一个的函数对象
  24419. ``` */
  24420. offMemoryWarning(
  24421. /** onMemoryWarning 传入的监听函数。不传此参数则移除所有监听函数。 */
  24422. listener?: OffMemoryWarningCallback
  24423. ): void
  24424. /** [wx.offNetworkStatusChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkStatusChange.html)
  24425. *
  24426. * 需要基础库: `2.9.3`
  24427. *
  24428. * 在插件中使用:需要基础库 `2.9.1`
  24429. *
  24430. * 移除网络状态变化事件的监听函数
  24431. *
  24432. * **示例代码**
  24433. *
  24434. * ```js
  24435. const listener = function (res) { console.log(res) }
  24436. wx.onNetworkStatusChange(listener)
  24437. wx.offNetworkStatusChange(listener) // 需传入与监听时同一个的函数对象
  24438. ``` */
  24439. offNetworkStatusChange(
  24440. /** onNetworkStatusChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  24441. listener?: OffNetworkStatusChangeCallback
  24442. ): void
  24443. /** [wx.offNetworkWeakChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.offNetworkWeakChange.html)
  24444. *
  24445. * 需要基础库: `2.21.0`
  24446. *
  24447. * 在插件中使用:不支持
  24448. *
  24449. * 移除弱网状态变化事件的监听函数
  24450. *
  24451. * **示例代码**
  24452. *
  24453. * ```js
  24454. const listener = function (res) { console.log(res) }
  24455. wx.onNetworkWeakChange(listener)
  24456. wx.offNetworkWeakChange(listener) // 需传入与监听时同一个的函数对象
  24457. ``` */
  24458. offNetworkWeakChange(
  24459. /** onNetworkWeakChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  24460. listener?: OffNetworkWeakChangeCallback
  24461. ): void
  24462. /** [wx.offPageNotFound(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offPageNotFound.html)
  24463. *
  24464. * 需要基础库: `2.1.2`
  24465. *
  24466. * 在插件中使用:不支持
  24467. *
  24468. * 移除小程序要打开的页面不存在事件的监听函数
  24469. *
  24470. * **示例代码**
  24471. *
  24472. * ```js
  24473. const listener = function (res) { console.log(res) }
  24474. wx.onPageNotFound(listener)
  24475. wx.offPageNotFound(listener) // 需传入与监听时同一个的函数对象
  24476. ``` */
  24477. offPageNotFound(
  24478. /** onPageNotFound 传入的监听函数。不传此参数则移除所有监听函数。 */
  24479. listener?: OffPageNotFoundCallback
  24480. ): void
  24481. /** [wx.offScreenRecordingStateChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offScreenRecordingStateChanged.html)
  24482. *
  24483. * 需要基础库: `2.24.0`
  24484. *
  24485. * 在插件中使用:不支持
  24486. *
  24487. * 移除用户录屏事件的监听函数
  24488. *
  24489. * **示例代码**
  24490. *
  24491. * ```js
  24492. const listener = function (res) { console.log(res) }
  24493. wx.onScreenRecordingStateChanged(listener)
  24494. wx.offScreenRecordingStateChanged(listener) // 需传入与监听时同一个的函数对象
  24495. ``` */
  24496. offScreenRecordingStateChanged(
  24497. /** onScreenRecordingStateChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  24498. listener?: OffScreenRecordingStateChangedCallback
  24499. ): void
  24500. /** [wx.offThemeChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offThemeChange.html)
  24501. *
  24502. * 需要基础库: `2.11.0`
  24503. *
  24504. * 在插件中使用:不支持
  24505. *
  24506. * 移除系统主题改变事件的监听函数
  24507. *
  24508. * **示例代码**
  24509. *
  24510. * ```js
  24511. const listener = function (res) { console.log(res) }
  24512. wx.onThemeChange(listener)
  24513. wx.offThemeChange(listener) // 需传入与监听时同一个的函数对象
  24514. ``` */
  24515. offThemeChange(
  24516. /** onThemeChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  24517. listener?: OffThemeChangeCallback
  24518. ): void
  24519. /** [wx.offUnhandledRejection(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.offUnhandledRejection.html)
  24520. *
  24521. * 需要基础库: `2.10.0`
  24522. *
  24523. * 在插件中使用:不支持
  24524. *
  24525. * 移除未处理的 Promise 拒绝事件的监听函数
  24526. *
  24527. * **示例代码**
  24528. *
  24529. * ```js
  24530. const listener = function (res) { console.log(res) }
  24531. wx.onUnhandledRejection(listener)
  24532. wx.offUnhandledRejection(listener) // 需传入与监听时同一个的函数对象
  24533. ``` */
  24534. offUnhandledRejection(
  24535. /** onUnhandledRejection 传入的监听函数。不传此参数则移除所有监听函数。 */
  24536. listener?: OffUnhandledRejectionCallback
  24537. ): void
  24538. /** [wx.offUserCaptureScreen(function callback)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offUserCaptureScreen.html)
  24539. *
  24540. * 需要基础库: `2.9.3`
  24541. *
  24542. * 在插件中使用:需要基础库 `2.9.1`
  24543. *
  24544. * 在插件中使用时,只能在当前插件的页面中调用
  24545. *
  24546. * 用户主动截屏事件。取消事件监听。 */
  24547. offUserCaptureScreen(
  24548. /** 用户主动截屏事件的回调函数 */
  24549. callback?: (...args: any[]) => any
  24550. ): void
  24551. /** [wx.offVoIPChatInterrupted(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatInterrupted.html)
  24552. *
  24553. * 需要基础库: `2.9.0`
  24554. *
  24555. * 在插件中使用:需要基础库 `2.9.1`
  24556. *
  24557. * 移除被动断开实时语音通话事件的监听函数
  24558. *
  24559. * **示例代码**
  24560. *
  24561. * ```js
  24562. const listener = function (res) { console.log(res) }
  24563. wx.onVoIPChatInterrupted(listener)
  24564. wx.offVoIPChatInterrupted(listener) // 需传入与监听时同一个的函数对象
  24565. ``` */
  24566. offVoIPChatInterrupted(
  24567. /** onVoIPChatInterrupted 传入的监听函数。不传此参数则移除所有监听函数。 */
  24568. listener?: OffVoIPChatInterruptedCallback
  24569. ): void
  24570. /** [wx.offVoIPChatMembersChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatMembersChanged.html)
  24571. *
  24572. * 需要基础库: `2.9.0`
  24573. *
  24574. * 在插件中使用:需要基础库 `2.9.1`
  24575. *
  24576. * 移除实时语音通话成员在线状态变化事件的监听函数
  24577. *
  24578. * **示例代码**
  24579. *
  24580. * ```js
  24581. const listener = function (res) { console.log(res) }
  24582. wx.onVoIPChatMembersChanged(listener)
  24583. wx.offVoIPChatMembersChanged(listener) // 需传入与监听时同一个的函数对象
  24584. ``` */
  24585. offVoIPChatMembersChanged(
  24586. /** onVoIPChatMembersChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  24587. listener?: OffVoIPChatMembersChangedCallback
  24588. ): void
  24589. /** [wx.offVoIPChatSpeakersChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatSpeakersChanged.html)
  24590. *
  24591. * 需要基础库: `2.9.0`
  24592. *
  24593. * 在插件中使用:需要基础库 `2.9.1`
  24594. *
  24595. * 移除实时语音通话成员通话状态变化事件的监听函数
  24596. *
  24597. * **示例代码**
  24598. *
  24599. * ```js
  24600. const listener = function (res) { console.log(res) }
  24601. wx.onVoIPChatSpeakersChanged(listener)
  24602. wx.offVoIPChatSpeakersChanged(listener) // 需传入与监听时同一个的函数对象
  24603. ``` */
  24604. offVoIPChatSpeakersChanged(
  24605. /** onVoIPChatSpeakersChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  24606. listener?: OffVoIPChatSpeakersChangedCallback
  24607. ): void
  24608. /** [wx.offVoIPChatStateChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPChatStateChanged.html)
  24609. *
  24610. * 需要基础库: `2.16.0`
  24611. *
  24612. * 在插件中使用:不支持
  24613. *
  24614. * 移除房间状态变化事件的监听函数
  24615. *
  24616. * **示例代码**
  24617. *
  24618. * ```js
  24619. const listener = function (res) { console.log(res) }
  24620. wx.onVoIPChatStateChanged(listener)
  24621. wx.offVoIPChatStateChanged(listener) // 需传入与监听时同一个的函数对象
  24622. ``` */
  24623. offVoIPChatStateChanged(
  24624. /** onVoIPChatStateChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  24625. listener?: OffVoIPChatStateChangedCallback
  24626. ): void
  24627. /** [wx.offVoIPVideoMembersChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.offVoIPVideoMembersChanged.html)
  24628. *
  24629. * 需要基础库: `2.11.0`
  24630. *
  24631. * 在插件中使用:不支持
  24632. *
  24633. * 移除实时语音通话成员视频状态变化事件的监听函数
  24634. *
  24635. * **示例代码**
  24636. *
  24637. * ```js
  24638. const listener = function (res) { console.log(res) }
  24639. wx.onVoIPVideoMembersChanged(listener)
  24640. wx.offVoIPVideoMembersChanged(listener) // 需传入与监听时同一个的函数对象
  24641. ``` */
  24642. offVoIPVideoMembersChanged(
  24643. /** onVoIPVideoMembersChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  24644. listener?: OffVoIPVideoMembersChangedCallback
  24645. ): void
  24646. /** [wx.offWifiConnected(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offWifiConnected.html)
  24647. *
  24648. * 需要基础库: `2.9.0`
  24649. *
  24650. * 在插件中使用:需要基础库 `2.9.1`
  24651. *
  24652. * 移除连接上 Wi-Fi 的事件的监听函数
  24653. *
  24654. * **示例代码**
  24655. *
  24656. * ```js
  24657. const listener = function (res) { console.log(res) }
  24658. wx.onWifiConnected(listener)
  24659. wx.offWifiConnected(listener) // 需传入与监听时同一个的函数对象
  24660. ``` */
  24661. offWifiConnected(
  24662. /** onWifiConnected 传入的监听函数。不传此参数则移除所有监听函数。 */
  24663. listener?: OffWifiConnectedCallback
  24664. ): void
  24665. /** [wx.offWifiConnectedWithPartialInfo(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offWifiConnectedWithPartialInfo.html)
  24666. *
  24667. * 需要基础库: `2.22.0`
  24668. *
  24669. * 在插件中使用:需要基础库 `2.22.1`
  24670. *
  24671. * 移除连接上 Wi-Fi 的事件的监听函数
  24672. *
  24673. * **示例代码**
  24674. *
  24675. * ```js
  24676. const listener = function (res) { console.log(res) }
  24677. wx.onWifiConnectedWithPartialInfo(listener)
  24678. wx.offWifiConnectedWithPartialInfo(listener) // 需传入与监听时同一个的函数对象
  24679. ``` */
  24680. offWifiConnectedWithPartialInfo(
  24681. /** onWifiConnectedWithPartialInfo 传入的监听函数。不传此参数则移除所有监听函数。 */
  24682. listener?: OffWifiConnectedWithPartialInfoCallback
  24683. ): void
  24684. /** [wx.offWindowResize(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.offWindowResize.html)
  24685. *
  24686. * 需要基础库: `2.3.0`
  24687. *
  24688. * 在插件中使用:不支持
  24689. *
  24690. * 移除窗口尺寸变化事件的监听函数
  24691. *
  24692. * **示例代码**
  24693. *
  24694. * ```js
  24695. const listener = function (res) { console.log(res) }
  24696. wx.onWindowResize(listener)
  24697. wx.offWindowResize(listener) // 需传入与监听时同一个的函数对象
  24698. ``` */
  24699. offWindowResize(
  24700. /** onWindowResize 传入的监听函数。不传此参数则移除所有监听函数。 */
  24701. listener?: OffWindowResizeCallback
  24702. ): void
  24703. /** [wx.onAccelerometerChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.onAccelerometerChange.html)
  24704. *
  24705. * 在插件中使用:不支持
  24706. *
  24707. * 监听加速度数据事件。频率根据 [wx.startAccelerometer()](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.startAccelerometer.html) 的 interval 参数, 接口调用后会自动开始监听。
  24708. *
  24709. * **示例代码**
  24710. *
  24711. * ```js
  24712. wx.onAccelerometerChange(callback)
  24713. ``` */
  24714. onAccelerometerChange(
  24715. /** 加速度数据事件的监听函数 */
  24716. listener: OnAccelerometerChangeCallback
  24717. ): void
  24718. /** [wx.onApiCategoryChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/life-cycle/wx.onApiCategoryChange.html)
  24719. *
  24720. * 需要基础库: `2.33.0`
  24721. *
  24722. * 在插件中使用:不支持
  24723. *
  24724. * 监听 API 类别变化事件
  24725. *
  24726. * **不同 apiCategory 场景下的 API 限制**
  24727. *
  24728. * `X` 表示 API 被限制无法使用;不在表格中的 API 不限制。
  24729. *
  24730. * | | default | nativeFunctionalized | browseOnly | embedded |
  24731. * |-|-|-|-|-|
  24732. * |navigateToMiniProgram | | `X` | `X` | |
  24733. * |openSetting | | | `X` | |
  24734. * |&lt;button open-type="share"&gt; | | `X` | `X` | `X` |
  24735. * |&lt;button open-type="feedback"&gt; | | | `X` | |
  24736. * |&lt;button open-type="open-setting"&gt;| | | `X` | |
  24737. * |openEmbeddedMiniProgram | | `X` | `X` | `X` |
  24738. *
  24739. * **示例代码**
  24740. *
  24741. * ```js
  24742. const func = function (res) {
  24743. console.log(res.apiCategory)
  24744. }
  24745. wx.onApiCategoryChange(func)
  24746. // 取消监听
  24747. wx.offApiCategoryChange(func)
  24748. ``` */
  24749. onApiCategoryChange(
  24750. /** API 类别变化事件的监听函数 */
  24751. listener: OnApiCategoryChangeCallback
  24752. ): void
  24753. /** [wx.onAppHide(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppHide.html)
  24754. *
  24755. * 需要基础库: `2.1.2`
  24756. *
  24757. * 在插件中使用:不支持
  24758. *
  24759. * 监听小程序切后台事件。该事件与 [`App.onHide`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onhide) 的回调时机一致。 */
  24760. onAppHide(
  24761. /** 小程序切后台事件的监听函数 */
  24762. listener: OnAppHideCallback
  24763. ): void
  24764. /** [wx.onAppShow(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAppShow.html)
  24765. *
  24766. * 需要基础库: `2.1.2`
  24767. *
  24768. * 在插件中使用:不支持
  24769. *
  24770. * 监听小程序切前台事件。该事件与 [`App.onShow`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onshowobject-object) 的回调参数一致。
  24771. *
  24772. * **返回有效 referrerInfo 的场景**
  24773. *
  24774. * | 场景值 | 场景 | appId含义 |
  24775. * | ------ | ------------------------------- | ---------- |
  24776. * | 1020 | 公众号 profile 页相关小程序列表 | 来源公众号 |
  24777. * | 1035 | 公众号自定义菜单 | 来源公众号 |
  24778. * | 1036 | App 分享消息卡片 | 来源App |
  24779. * | 1037 | 小程序打开小程序 | 来源小程序 |
  24780. * | 1038 | 从另一个小程序返回 | 来源小程序 |
  24781. * | 1043 | 公众号模板消息 | 来源公众号 |
  24782. *
  24783. * **不同 apiCategory 场景下的 API 限制**
  24784. *
  24785. * `X` 表示 API 被限制无法使用;不在表格中的 API 不限制。
  24786. *
  24787. * | | default | nativeFunctionalized | browseOnly | embedded |
  24788. * |-|-|-|-|-|
  24789. * |navigateToMiniProgram | | `X` | `X` | |
  24790. * |openSetting | | | `X` | |
  24791. * |&lt;button open-type="share"&gt; | | `X` | `X` | `X` |
  24792. * |&lt;button open-type="feedback"&gt; | | | `X` | |
  24793. * |&lt;button open-type="open-setting"&gt;| | | `X` | |
  24794. * |openEmbeddedMiniProgram | | `X` | `X` | `X` |
  24795. *
  24796. * **注意**
  24797. *
  24798. * 部分版本在无`referrerInfo`的时候会返回 `undefined`,建议使用 `options.referrerInfo && options.referrerInfo.appId` 进行判断。 */
  24799. onAppShow(
  24800. /** 小程序切前台事件的监听函数 */
  24801. listener: OnAppShowCallback
  24802. ): void
  24803. /** [wx.onAudioInterruptionBegin(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAudioInterruptionBegin.html)
  24804. *
  24805. * 需要基础库: `2.6.2`
  24806. *
  24807. * 在插件中使用:需要基础库 `2.15.0`
  24808. *
  24809. * 监听音频因为受到系统占用而被中断开始事件。以下场景会触发此事件:闹钟、电话、FaceTime 通话、微信语音聊天、微信视频聊天、有声广告开始播放、实名认证页面弹出等。此事件触发后,小程序内所有音频会暂停。 */
  24810. onAudioInterruptionBegin(
  24811. /** 音频因为受到系统占用而被中断开始事件的监听函数 */
  24812. listener: OnAudioInterruptionBeginCallback
  24813. ): void
  24814. /** [wx.onAudioInterruptionEnd(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onAudioInterruptionEnd.html)
  24815. *
  24816. * 需要基础库: `2.6.2`
  24817. *
  24818. * 在插件中使用:需要基础库 `2.15.0`
  24819. *
  24820. * 监听音频中断结束事件。在收到 onAudioInterruptionBegin 事件之后,小程序内所有音频会暂停,收到此事件之后才可再次播放成功 */
  24821. onAudioInterruptionEnd(
  24822. /** 音频中断结束事件的监听函数 */
  24823. listener: OnAudioInterruptionEndCallback
  24824. ): void
  24825. /** [wx.onBLECharacteristicValueChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLECharacteristicValueChange.html)
  24826. *
  24827. * 需要基础库: `1.1.0`
  24828. *
  24829. * 在插件中使用:需要基础库 `2.9.1`
  24830. *
  24831. * 监听蓝牙低功耗设备的特征值变化事件。必须先调用 [wx.notifyBLECharacteristicValueChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.notifyBLECharacteristicValueChange.html) 接口才能接收到设备推送的 notification。
  24832. *
  24833. * **示例代码**
  24834. *
  24835. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  24836. *
  24837. * ```js
  24838. // ArrayBuffer转16进制字符串示例
  24839. function ab2hex(buffer) {
  24840. let hexArr = Array.prototype.map.call(
  24841. new Uint8Array(buffer),
  24842. function(bit) {
  24843. return ('00' + bit.toString(16)).slice(-2)
  24844. }
  24845. )
  24846. return hexArr.join('');
  24847. }
  24848. wx.onBLECharacteristicValueChange(function(res) {
  24849. console.log(`characteristic ${res.characteristicId} has changed, now is ${res.value}`)
  24850. console.log(ab2hex(res.value))
  24851. })
  24852. ``` */
  24853. onBLECharacteristicValueChange(
  24854. /** 蓝牙低功耗设备的特征值变化事件的监听函数 */
  24855. listener: OnBLECharacteristicValueChangeCallback
  24856. ): void
  24857. /** [wx.onBLEConnectionStateChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLEConnectionStateChange.html)
  24858. *
  24859. * 需要基础库: `1.1.0`
  24860. *
  24861. * 在插件中使用:需要基础库 `2.9.1`
  24862. *
  24863. * 监听蓝牙低功耗连接状态改变事件。包括开发者主动连接或断开连接,设备丢失,连接异常断开等等
  24864. *
  24865. * **示例代码**
  24866. *
  24867. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  24868. * ```js
  24869. wx.onBLEConnectionStateChange(function(res) {
  24870. // 该方法回调中可以用于处理连接意外断开等异常情况
  24871. console.log(`device ${res.deviceId} state has changed, connected: ${res.connected}`)
  24872. })
  24873. ``` */
  24874. onBLEConnectionStateChange(
  24875. /** 蓝牙低功耗连接状态改变事件的监听函数 */
  24876. listener: OnBLEConnectionStateChangeCallback
  24877. ): void
  24878. /** [wx.onBLEMTUChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLEMTUChange.html)
  24879. *
  24880. * 需要基础库: `2.20.1`
  24881. *
  24882. * 在插件中使用:需要基础库 `2.20.1`
  24883. *
  24884. * 监听蓝牙低功耗的最大传输单元变化事件(仅安卓触发)。
  24885. *
  24886. * **示例代码**
  24887. *
  24888. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  24889. * ```js
  24890. wx.onBLEMTUChange(function (res) {
  24891. console.log('bluetooth mtu is', res.mtu)
  24892. })
  24893. ``` */
  24894. onBLEMTUChange(
  24895. /** 蓝牙低功耗的最大传输单元变化事件的监听函数 */
  24896. listener: OnBLEMTUChangeCallback
  24897. ): void
  24898. /** [wx.onBLEPeripheralConnectionStateChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-peripheral/wx.onBLEPeripheralConnectionStateChanged.html)
  24899. *
  24900. * 需要基础库: `2.10.3`
  24901. *
  24902. * 在插件中使用:需要基础库 `2.22.1`
  24903. *
  24904. * 监听当前外围设备被连接或断开连接事件 */
  24905. onBLEPeripheralConnectionStateChanged(
  24906. /** 当前外围设备被连接或断开连接事件的监听函数 */
  24907. listener: OnBLEPeripheralConnectionStateChangedCallback
  24908. ): void
  24909. /** [wx.onBackgroundAudioPause(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioPause.html)
  24910. *
  24911. * 在插件中使用:不支持
  24912. * @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) 替换
  24913. *
  24914. * 监听音乐暂停事件。 */
  24915. onBackgroundAudioPause(
  24916. /** 音乐暂停事件的监听函数 */
  24917. listener: OnBackgroundAudioPauseCallback
  24918. ): void
  24919. /** [wx.onBackgroundAudioPlay(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioPlay.html)
  24920. *
  24921. * 在插件中使用:不支持
  24922. * @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) 替换
  24923. *
  24924. * 监听音乐播放事件。 */
  24925. onBackgroundAudioPlay(
  24926. /** 音乐播放事件的监听函数 */
  24927. listener: OnBackgroundAudioPlayCallback
  24928. ): void
  24929. /** [wx.onBackgroundAudioStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.onBackgroundAudioStop.html)
  24930. *
  24931. * 在插件中使用:不支持
  24932. * @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) 替换
  24933. *
  24934. * 监听音乐停止事件。 */
  24935. onBackgroundAudioStop(
  24936. /** 音乐停止事件的监听函数 */
  24937. listener: OnBackgroundAudioStopCallback
  24938. ): void
  24939. /** [wx.onBackgroundFetchData(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.onBackgroundFetchData.html)
  24940. *
  24941. * 需要基础库: `2.8.0`
  24942. *
  24943. * 在插件中使用:不支持
  24944. *
  24945. * 监听收到 backgroundFetch 数据事件。如果监听时请求已经完成,则事件不会触发。建议和 [wx.getBackgroundFetchData](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.getBackgroundFetchData.html) 配合使用 */
  24946. onBackgroundFetchData(
  24947. /** 收到 backgroundFetch 数据事件的监听函数 */
  24948. listener: OnBackgroundFetchDataCallback
  24949. ): void
  24950. /** [wx.onBeaconServiceChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconServiceChange.html)
  24951. *
  24952. * 需要基础库: `1.2.0`
  24953. *
  24954. * 在插件中使用:需要基础库 `1.9.6`
  24955. *
  24956. * 监听 Beacon 服务状态变化事件,仅能注册一个监听
  24957. *
  24958. * **示例代码**
  24959. *
  24960. * ```js
  24961. wx.onBeaconServiceChange(res => {
  24962. console.log(res.available, res.discovering)
  24963. })
  24964. ``` */
  24965. onBeaconServiceChange(
  24966. /** Beacon 服务状态变化事件的监听函数 */
  24967. listener: OnBeaconServiceChangeCallback
  24968. ): void
  24969. /** [wx.onBeaconUpdate(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.onBeaconUpdate.html)
  24970. *
  24971. * 需要基础库: `1.2.0`
  24972. *
  24973. * 在插件中使用:需要基础库 `1.9.6`
  24974. *
  24975. * 监听 Beacon 设备更新事件,仅能注册一个监听
  24976. *
  24977. * **示例代码**
  24978. *
  24979. * ```js
  24980. wx.onBeaconUpdate(res => {
  24981. console.log(res.beacons)
  24982. })
  24983. ``` */
  24984. onBeaconUpdate(
  24985. /** Beacon 设备更新事件的监听函数 */
  24986. listener: OnBeaconUpdateCallback
  24987. ): void
  24988. /** [wx.onBluetoothAdapterStateChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothAdapterStateChange.html)
  24989. *
  24990. * 需要基础库: `1.1.0`
  24991. *
  24992. * 在插件中使用:需要基础库 `2.9.1`
  24993. *
  24994. * 监听蓝牙适配器状态变化事件
  24995. *
  24996. * **示例代码**
  24997. *
  24998. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  24999. * ```js
  25000. wx.onBluetoothAdapterStateChange(function (res) {
  25001. console.log('adapterState changed, now is', res)
  25002. })
  25003. ``` */
  25004. onBluetoothAdapterStateChange(
  25005. /** 蓝牙适配器状态变化事件的监听函数 */
  25006. listener: OnBluetoothAdapterStateChangeCallback
  25007. ): void
  25008. /** [wx.onBluetoothDeviceFound(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.onBluetoothDeviceFound.html)
  25009. *
  25010. * 需要基础库: `1.1.0`
  25011. *
  25012. * 在插件中使用:需要基础库 `2.9.1`
  25013. *
  25014. * 监听搜索到新设备的事件
  25015. *
  25016. * **注意**
  25017. *
  25018. * - 若在 [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) 接口获取到的数组中。
  25019. *
  25020. * **示例代码**
  25021. *
  25022. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  25023. *
  25024. * ```js
  25025. // ArrayBuffer转16进度字符串示例
  25026. function ab2hex(buffer) {
  25027. var hexArr = Array.prototype.map.call(
  25028. new Uint8Array(buffer),
  25029. function(bit) {
  25030. return ('00' + bit.toString(16)).slice(-2)
  25031. }
  25032. )
  25033. return hexArr.join('');
  25034. }
  25035. wx.onBluetoothDeviceFound(function(res) {
  25036. var devices = res.devices;
  25037. console.log('new device list has founded')
  25038. console.dir(devices)
  25039. console.log(ab2hex(devices[0].advertisData))
  25040. })
  25041. ```
  25042. *
  25043. * **注意**
  25044. *
  25045. * - 蓝牙设备在被搜索到时,系统返回的 `name` 字段一般为广播包中的 `LocalName` 字段中的设备名称,而如果与蓝牙设备建立连接,系统返回的 `name` 字段会改为从蓝牙设备上获取到的 `GattName`。若需要动态改变设备名称并展示,建议使用 `localName` 字段。
  25046. * - 安卓下部分机型需要有位置权限才能搜索到设备,需留意是否开启了位置权限 */
  25047. onBluetoothDeviceFound(
  25048. /** 搜索到新设备的事件的监听函数 */
  25049. listener: OnBluetoothDeviceFoundCallback
  25050. ): void
  25051. /** [wx.onCompassChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.onCompassChange.html)
  25052. *
  25053. * 在插件中使用:不支持
  25054. *
  25055. * 监听罗盘数据变化事件。频率:5 次/秒,接口调用后会自动开始监听,可使用 wx.stopCompass 停止监听。
  25056. *
  25057. * **accuracy 在 iOS/Android 的差异**
  25058. *
  25059. * 由于平台差异,accuracy 在 iOS/Android 的值不同。
  25060. *
  25061. * - iOS:accuracy 是一个 number 类型的值,表示相对于磁北极的偏差。0 表示设备指向磁北,90 表示指向东,180 表示指向南,依此类推。
  25062. * - Android:accuracy 是一个 string 类型的枚举值。
  25063. *
  25064. * | 值 | 说明 |
  25065. * | --------------- | -------------------------------------------------------------------------------------- |
  25066. * | high | 高精度 |
  25067. * | medium | 中等精度 |
  25068. * | low | 低精度 |
  25069. * | no-contact | 不可信,传感器失去连接 |
  25070. * | unreliable | 不可信,原因未知 |
  25071. * | unknow ${value} | 未知的精度枚举值,即该 Android 系统此时返回的表示精度的 value 不是一个标准的精度枚举值 | */
  25072. onCompassChange(
  25073. /** 罗盘数据变化事件的监听函数 */
  25074. listener: OnCompassChangeCallback
  25075. ): void
  25076. /** [wx.onCopyUrl(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.onCopyUrl.html)
  25077. *
  25078. * 需要基础库: `2.14.3`
  25079. *
  25080. * 在插件中使用:不支持
  25081. *
  25082. * 监听用户点击右上角菜单的「复制链接」按钮时触发的事件。本接口为 Beta 版本,暂只在 Android 平台支持。 */
  25083. onCopyUrl(
  25084. /** 用户点击右上角菜单的「复制链接」按钮时触发的事件的监听函数 */
  25085. listener: OnCopyUrlCallback
  25086. ): void
  25087. /** [wx.onDeviceMotionChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.onDeviceMotionChange.html)
  25088. *
  25089. * 需要基础库: `2.3.0`
  25090. *
  25091. * 在插件中使用:不支持
  25092. *
  25093. * 监听设备方向变化事件。频率根据 [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) 停止监听。 */
  25094. onDeviceMotionChange(
  25095. /** 设备方向变化事件的监听函数 */
  25096. listener: OnDeviceMotionChangeCallback
  25097. ): void
  25098. /** [wx.onEmbeddedMiniProgramHeightChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.onEmbeddedMiniProgramHeightChange.html)
  25099. *
  25100. * 需要基础库: `2.33.0`
  25101. *
  25102. * 在插件中使用:不支持
  25103. *
  25104. * 监听半屏小程序可视高度变化事件
  25105. *
  25106. * **示例代码**
  25107. *
  25108. * ```js
  25109. const func = function (res) {
  25110. console.log(res.height)
  25111. console.log(res.initialHeight)
  25112. }
  25113. wx.onEmbeddedMiniProgramHeightChange(func)
  25114. // 取消监听
  25115. wx.offEmbeddedMiniProgramHeightChange(func)
  25116. ``` */
  25117. onEmbeddedMiniProgramHeightChange(
  25118. /** 半屏小程序可视高度变化事件的监听函数 */
  25119. listener: OnEmbeddedMiniProgramHeightChangeCallback
  25120. ): void
  25121. /** [wx.onError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onError.html)
  25122. *
  25123. * 需要基础库: `2.1.2`
  25124. *
  25125. * 在插件中使用:不支持
  25126. *
  25127. * 监听小程序错误事件。如脚本错误或 API 调用报错等。该事件与 [`App.onError`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onerrorstring-error) 的回调时机与参数一致。 */
  25128. onError(
  25129. /** 小程序错误事件的监听函数 */
  25130. listener: WxOnErrorCallback
  25131. ): void
  25132. /** [wx.onGetWifiList(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onGetWifiList.html)
  25133. *
  25134. * 需要基础库: `1.6.0`
  25135. *
  25136. * 在插件中使用:需要基础库 `2.9.1`
  25137. *
  25138. * 监听获取到 Wi-Fi 列表数据事件 */
  25139. onGetWifiList(
  25140. /** 获取到 Wi-Fi 列表数据事件的监听函数 */
  25141. listener: OnGetWifiListCallback
  25142. ): void
  25143. /** [wx.onGyroscopeChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.onGyroscopeChange.html)
  25144. *
  25145. * 需要基础库: `2.3.0`
  25146. *
  25147. * 在插件中使用:需要基础库 `2.9.1`
  25148. *
  25149. * 监听陀螺仪数据变化事件。频率根据 [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) 停止监听。 */
  25150. onGyroscopeChange(
  25151. /** 陀螺仪数据变化事件的监听函数 */
  25152. listener: OnGyroscopeChangeCallback
  25153. ): void
  25154. /** [wx.onHCEMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc-hce/wx.onHCEMessage.html)
  25155. *
  25156. * 需要基础库: `1.7.0`
  25157. *
  25158. * 在插件中使用:需要基础库 `2.9.1`
  25159. *
  25160. * 监听接收 NFC 设备消息事件。仅能注册一个监听 */
  25161. onHCEMessage(
  25162. /** 接收 NFC 设备消息事件的监听函数 */
  25163. listener: OnHCEMessageCallback
  25164. ): void
  25165. /** [wx.onKeyboardHeightChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/keyboard/wx.onKeyboardHeightChange.html)
  25166. *
  25167. * 需要基础库: `2.7.0`
  25168. *
  25169. * 在插件中使用:不支持
  25170. *
  25171. * 监听键盘高度变化事件
  25172. *
  25173. * **示例代码**
  25174. *
  25175. * ```js
  25176. wx.onKeyboardHeightChange(res => {
  25177. console.log(res.height)
  25178. })
  25179. ``` */
  25180. onKeyboardHeightChange(
  25181. /** 键盘高度变化事件的监听函数 */
  25182. listener: OnKeyboardHeightChangeCallback
  25183. ): void
  25184. /** [wx.onLazyLoadError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onLazyLoadError.html)
  25185. *
  25186. * 需要基础库: `2.24.3`
  25187. *
  25188. * 在插件中使用:不支持
  25189. *
  25190. * 监听小程序异步组件加载失败事件。
  25191. *
  25192. * **注意**
  25193. *
  25194. * - 加载异步组件通常需要下载分包,若分包下载超时,则会触发 errMsg 为 "loadSubpackage: timeout" 的回调,默认超时等待时间为 5 秒。
  25195. * - 可以通过第二个参数指定超时时间(单位:ms),该设置全局有效,多次指定超时时间则覆盖前面。
  25196. * - 分包确认下载失败时,会再次触发 errMsg 为 "loadSubpackage: fail" 的回调。
  25197. * - 若在页面中使用该接口进行监听,请确保在必要时手动调用 offLazyLoadError 取消监听,以避免非预期的内存泄漏。 */
  25198. onLazyLoadError(
  25199. /** 小程序异步组件加载失败事件的监听函数 */
  25200. listener: OnLazyLoadErrorCallback
  25201. ): void
  25202. /** [wx.onLocalServiceDiscoveryStop(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceDiscoveryStop.html)
  25203. *
  25204. * 需要基础库: `2.4.0`
  25205. *
  25206. * 在插件中使用:需要基础库 `2.15.0`
  25207. *
  25208. * 监听 mDNS 服务停止搜索的事件 */
  25209. onLocalServiceDiscoveryStop(
  25210. /** mDNS 服务停止搜索的事件的监听函数 */
  25211. listener: OnLocalServiceDiscoveryStopCallback
  25212. ): void
  25213. /** [wx.onLocalServiceFound(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceFound.html)
  25214. *
  25215. * 需要基础库: `2.4.0`
  25216. *
  25217. * 在插件中使用:需要基础库 `2.15.0`
  25218. *
  25219. * 监听 mDNS 服务发现的事件 */
  25220. onLocalServiceFound(
  25221. /** mDNS 服务发现的事件的监听函数 */
  25222. listener: OnLocalServiceFoundCallback
  25223. ): void
  25224. /** [wx.onLocalServiceLost(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceLost.html)
  25225. *
  25226. * 需要基础库: `2.4.0`
  25227. *
  25228. * 在插件中使用:需要基础库 `2.15.0`
  25229. *
  25230. * 监听 mDNS 服务离开的事件 */
  25231. onLocalServiceLost(
  25232. /** mDNS 服务离开的事件的监听函数 */
  25233. listener: OnLocalServiceLostCallback
  25234. ): void
  25235. /** [wx.onLocalServiceResolveFail(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.onLocalServiceResolveFail.html)
  25236. *
  25237. * 需要基础库: `2.4.0`
  25238. *
  25239. * 在插件中使用:需要基础库 `2.15.0`
  25240. *
  25241. * 监听 mDNS 服务解析失败的事件 */
  25242. onLocalServiceResolveFail(
  25243. /** mDNS 服务解析失败的事件的监听函数 */
  25244. listener: OnLocalServiceResolveFailCallback
  25245. ): void
  25246. /** [wx.onLocationChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.onLocationChange.html)
  25247. *
  25248. * 需要基础库: `2.8.1`
  25249. *
  25250. * 在插件中使用:不支持
  25251. *
  25252. * 监听实时地理位置变化事件,需结合 [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)使用。
  25253. *
  25254. * ## 使用方法
  25255. * 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
  25256. *
  25257. * ## 申请开通
  25258. * 暂只针对如下类目的小程序开放,需要先通过类目审核,再在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。
  25259. * 接口权限申请入口将于2022年3月11日开始内测,于3月31日全量上线。并从4月18日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
  25260. *
  25261. * ### 国内主体开放类目
  25262. *
  25263. * | 一级类目/主体类型 | 二级类目 | 应用场景 |
  25264. * | -------------- | -------| -------- |
  25265. * | 电商平台 | / | 售卖商品线下发货、收货、送货服务 |
  25266. * | 商家自营 | / | 提供售卖商品线下发货、收货、送货服务、线下商超导览、导航服务 |
  25267. * | 医疗服务 | 公立医疗机构、三级私立医疗机构、其他私立医疗机构、就医服务、其他医学健康服务、药品(非处方药)销售、非处方药销售平台、医疗器械生产企业、医疗器械自营、医疗器械经营销售平台、互联网医院血液、干细胞服务、临床试验 | 1、实际物品/药品接收服务 2、基于地理位置取号并现场报到、附近医院导航等服务 |
  25268. * | 交通服务 | / | 代驾服务、租车网点导航等相关服务 |
  25269. * | 生活服务 | / | 上门服务作业等线下场景 |
  25270. * | 物流服务 | 收件/派件、查件、邮政、装卸搬运、快递柜、货物运输 | 快递/货物收发服务 |
  25271. * | 餐饮服务 | 点餐平台、外卖平台 | 线下送餐服务 |
  25272. * | 工具 | 天气、信息查询 | 与地理位置相关的服务,比如潮汐查询、海拔查询、天气查询等 |
  25273. * | 金融 | 保险 | 提供线下网点预约、基于地理位置取号并现场报到、附近网点导航等服务 |
  25274. * | 旅游 | 景区服务 | 提供景区导航、导览服务 |
  25275. * | 政务民生 | / | 提供政务单位相关业务 |
  25276. * | 政府主体账号 | / | 提供政务单位相关业务 |
  25277. *
  25278. * ### 海外主体开放类目
  25279. * | 一级类目/主体类型 | 二级类目 | 应用场景 |
  25280. * | -------------- | -------| -------- |
  25281. * | 出行与交通 | / | 代驾服务、租车网点导航等相关服务 |
  25282. * | 快递业与邮政 | / | 快递/货物收发服务 |
  25283. * | 餐饮 | / | 线下送餐服务 |
  25284. * | 电商平台 | / | 售卖商品线下发货、线下收货服务 |
  25285. * | 出行与交通 | / | 代驾服务、租车网点导航等相关服务 |
  25286. * | 跨境电商 | / | 提供售卖商品线下发货、收货服务、线下商超导览、导航服务 |
  25287. * | 本地服务 | 服装/鞋/箱包、玩具、家电/数码/手机、美妆/洗护、珠宝/饰品/眼镜/钟表、运动/户外/乐器、鲜花/园艺/工艺品、家居/家饰/家纺、办公/文具、机械/电子器件、酒、食品、百货/超市/便利店、宠物食品/用品 | 提供售卖商品线下发货、线下收货服务、线下商超导览、导航服务 |
  25288. * | 生活服务 | 家政、外送 | 上门服务作业等线下场景 |
  25289. *
  25290. * **示例代码**
  25291. *
  25292. * ```js
  25293. const _locationChangeFn = function(res) {
  25294. console.log('location change', res)
  25295. }
  25296. wx.onLocationChange(_locationChangeFn)
  25297. wx.offLocationChange(_locationChangeFn)
  25298. ``` */
  25299. onLocationChange(
  25300. /** 实时地理位置变化事件的监听函数 */
  25301. listener: OnLocationChangeCallback
  25302. ): void
  25303. /** [wx.onLocationChangeError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.onLocationChangeError.html)
  25304. *
  25305. * 需要基础库: `2.19.5`
  25306. *
  25307. * 在插件中使用:不支持
  25308. *
  25309. * 监听持续定位接口返回失败时触发。 */
  25310. onLocationChangeError(
  25311. /** 的监听函数 */
  25312. listener: OnLocationChangeErrorCallback
  25313. ): void
  25314. /** [wx.onMemoryWarning(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/memory/wx.onMemoryWarning.html)
  25315. *
  25316. * 需要基础库: `2.0.2`
  25317. *
  25318. * 在插件中使用:不支持
  25319. *
  25320. * 监听内存不足告警事件。
  25321. *
  25322. * 当 iOS/Android 向小程序进程发出内存警告时,触发该事件。触发该事件不意味小程序被杀,大部分情况下仅仅是告警,开发者可在收到通知后回收一些不必要资源避免进一步加剧内存紧张。
  25323. *
  25324. * **示例代码**
  25325. *
  25326. * ```js
  25327. * wx.onMemoryWarning(function () {
  25328. * console.log('onMemoryWarningReceive')
  25329. * })
  25330. * `` */
  25331. onMemoryWarning(
  25332. /** 内存不足告警事件的监听函数 */
  25333. listener: OnMemoryWarningCallback
  25334. ): void
  25335. /** [wx.onNeedPrivacyAuthorization(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.onNeedPrivacyAuthorization.html)
  25336. *
  25337. * 需要基础库: `2.32.3`
  25338. *
  25339. * 在插件中使用:不支持
  25340. *
  25341. * 监听隐私接口需要用户授权事件。当需要用户进行隐私授权时会触发。触发该事件时,开发者需要弹出隐私协议说明,并在用户同意或拒绝授权后调用回调接口 resolve 触发原隐私接口或组件继续执行。隐私合规开发指南详情可见[《小程序隐私协议开发指南》](https://developers.weixin.qq.com/miniprogram/dev/framework/user-privacy/PrivacyAuthorize.html)
  25342. *
  25343. * ****
  25344. *
  25345. * ## 回调参数
  25346. *
  25347. * ### function resolve
  25348. *
  25349. * resolve 是 onNeedPrivacyAuthorization 的首个回调参数,是一个接口函数。
  25350. *
  25351. * 当触发 onNeedPrivacyAuthorization 事件时,触发该事件的隐私接口或组件会处于 pending 状态。
  25352. *
  25353. * 如果调用 resolve({ buttonId: 'agree-btn', event:'agree' }),则触发当前 onNeedPrivacyAuthorization 事件的原隐私接口或组件会继续执行。其中 buttonId 为隐私同意授权按钮的id,为确保用户有同意的操作,基础库会检查对应的同意按钮是否被点击过。(Tips: 需要在`<button open-type="agreePrivacyAuthorization">` 组件的 bindagreeprivacyauthorization 事件触发后再调用 `resolve({ buttonId: 'agree-btn', event:'agree' })`)
  25354. *
  25355. * 如果调用 resolve({ event: 'disagree' }),则触发当前 onNeedPrivacyAuthorization 事件的原隐私接口或组件会失败并返回 `API:fail privacy permission is not authorized` 的错误信息。
  25356. *
  25357. * 在调用 resolve({ event: 'agree'/'disagree' }) 之前,开发者可以调用 resolve({ event: 'exposureAuthorization' }) 把隐私弹窗曝光告知平台。
  25358. *
  25359. * ### Object eventInfo
  25360. *
  25361. * eventInfo 是 onNeedPrivacyAuthorization 的第二个回调参数,表示触发本次 onNeedPrivacyAuthorization 事件的关联信息
  25362. *
  25363. * | 属性 | 类型 | 说明 |
  25364. * | ---- | ---- | ---- |
  25365. * | referrer | string | 触发本次 onNeedPrivacyAuthorization 事件的接口或组件名(例如:"getUserProfile", "button.getPhoneNumber") |
  25366. *
  25367. * ****
  25368. *
  25369. * ## resolve 接口参数
  25370. *
  25371. * | 属性 | 类型 | 是否必填 | 说明 |
  25372. * | ---- | ---- | ---- | ---- |
  25373. * | event | string | 是 | 用户操作类型 |
  25374. * | buttonId | string | 是 | 同意授权按钮的id (仅event=agree时必填) |
  25375. *
  25376. * ### event 合法值
  25377. *
  25378. * | event | 说明 |
  25379. * | ---- | ---- |
  25380. * | exposureAuthorization | 自定义隐私弹窗曝光 |
  25381. * | agree | 用户同意隐私授权 |
  25382. * | disagree | 用户拒绝隐私授权 |
  25383. *
  25384. * ****
  25385. *
  25386. * ## 具体说明:
  25387. *
  25388. * - 1. 什么时候会触发 onNeedPrivacyAuthorization 事件?
  25389. * - 1. 调用隐私相关接口(比如 wx.getUserProfile、wx.getClipboardData)和组件(比如 `<button open-type="getPhoneNumber"></button>`),并且用户还未同意过隐私协议时
  25390. * - 2. 调用 wx.requirePrivacyAuthorize 接口来模拟隐私接口调用,并且用户还未同意过隐私协议时
  25391. * - 3. 如果用户已经同意过隐私协议,则不会再触发 onNeedPrivacyAuthorization 事件
  25392. * - 2. 当触发 onNeedPrivacyAuthorization 事件时,触发该事件的隐私接口或组件会处于 pending 状态,等待用户授权后才会继续执行,此时开发者需要弹出自定义隐私弹窗,并在用户点击同意/拒绝后调用回调接口 resolve ,触发该事件的隐私接口或组件才会继续执行。
  25393. * - 3. wx.onNeedPrivacyAuthorization 是覆盖式注册监听,若重复注册监听,则只有最后一次注册会生效。
  25394. * - 4. 一定要注册 wx.onNeedPrivacyAuthorization 监听以及调用 resolve 吗?
  25395. * - 1. 不是的,如果能保证在调用隐私接口之前,用户已经轻触过了 `<button open-type="agreePrivacyAuthorization">` 按钮,那就不需要 wx.onNeedPrivacyAuthorization。
  25396. * - 2. 但如果注册了 wx.onNeedPrivacyAuthorization 监听,则一定要调用 resolve 接口。
  25397. *
  25398. * **示例代码**
  25399. *
  25400. * ```html
  25401. * // page.wxml
  25402. * <view wx:if="{{showPrivacy}}">
  25403. * <view>隐私弹窗内容....</view>
  25404. * <button id="agree-btn" open-type="agreePrivacyAuthorization" bindagreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
  25405. * </view>
  25406. * ```
  25407. * ```js
  25408. // page.js
  25409. Page({
  25410. data: {
  25411. showPrivacy: false
  25412. },
  25413. onLoad() {
  25414. wx.onNeedPrivacyAuthorization((resolve, eventInfo) => {
  25415. console.log('触发本次事件的接口是:' + eventInfo.referrer)
  25416. // 需要用户同意隐私授权时
  25417. // 弹出开发者自定义的隐私授权弹窗
  25418. this.setData({
  25419. showPrivacy: true
  25420. })
  25421. this.resolvePrivacyAuthorization = resolve
  25422. })
  25423. wx.getUserProfile({
  25424. success: console.log,
  25425. fail: console.error
  25426. })
  25427. },
  25428. handleAgreePrivacyAuthorization() {
  25429. // 用户点击同意按钮后
  25430. this.resolvePrivacyAuthorization({ buttonId: 'agree-btn', event: 'agree' })
  25431. // 用户点击同意后,开发者调用 resolve({ buttonId: 'agree-btn', event: 'agree' }) 告知平台用户已经同意,参数传同意按钮的id。为确保用户有同意的操作,基础库在 resolve 被调用后,会去检查对应的同意按钮有没有被点击过。检查通过后,相关隐私接口会继续调用
  25432. // 用户点击拒绝后,开发者调用 resolve({ event:'disagree' }) 告知平台用户已经拒绝
  25433. }
  25434. })
  25435. ```
  25436. *
  25437. * **完整示例demo**
  25438. *
  25439. * demo1: 演示使用 `wx.getPrivacySetting` 和 `<button open-type="agreePrivacyAuthorization">` 在首页处理隐私弹窗逻辑
  25440. * [https://developers.weixin.qq.com/s/gi71sGm67hK0](https://developers.weixin.qq.com/s/gi71sGm67hK0)
  25441. *
  25442. * demo2: 演示使用 `wx.onNeedPrivacyAuthorization` 和 `<button open-type="agreePrivacyAuthorization">` 在多个页面处理隐私弹窗逻辑,同时演示了如何处理多个隐私接口同时调用。
  25443. * [https://developers.weixin.qq.com/s/hndZUOmA7gKn](https://developers.weixin.qq.com/s/hndZUOmA7gKn)
  25444. *
  25445. * demo3: 演示 `wx.onNeedPrivacyAuthorization`、`wx.requirePrivacyAuthorize`、`<button open-type="agreePrivacyAuthorization">` 和 `<input type="nickname">` 组件如何结合使用
  25446. * [https://developers.weixin.qq.com/s/jX7xWGmA7UKa](https://developers.weixin.qq.com/s/jX7xWGmA7UKa)
  25447. *
  25448. * demo4: 演示使用 `wx.onNeedPrivacyAuthorization` 和 `<button open-type="agreePrivacyAuthorization">` 在多个 tabBar 页面处理隐私弹窗逻辑。
  25449. * [https://developers.weixin.qq.com/s/g6BWZGmt7XK9](https://developers.weixin.qq.com/s/g6BWZGmt7XK9) */
  25450. onNeedPrivacyAuthorization(
  25451. /** 隐私接口需要用户授权事件的监听函数 */
  25452. listener: OnNeedPrivacyAuthorizationCallback
  25453. ): void
  25454. /** [wx.onNetworkStatusChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.onNetworkStatusChange.html)
  25455. *
  25456. * 需要基础库: `1.1.0`
  25457. *
  25458. * 在插件中使用:支持
  25459. *
  25460. * 监听网络状态变化事件
  25461. *
  25462. * **示例代码**
  25463. *
  25464. * ```js
  25465. wx.onNetworkStatusChange(function (res) {
  25466. console.log(res.isConnected)
  25467. console.log(res.networkType)
  25468. })
  25469. ``` */
  25470. onNetworkStatusChange(
  25471. /** 网络状态变化事件的监听函数 */
  25472. listener: OnNetworkStatusChangeCallback
  25473. ): void
  25474. /** [wx.onNetworkWeakChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/network/wx.onNetworkWeakChange.html)
  25475. *
  25476. * 需要基础库: `2.21.0`
  25477. *
  25478. * 在插件中使用:不支持
  25479. *
  25480. * 监听弱网状态变化事件
  25481. *
  25482. * **示例代码**
  25483. *
  25484. * ```js
  25485. wx.onNetworkWeakChange(function (res) {
  25486. console.log(res.weakNet)
  25487. console.log(res.networkType)
  25488. })
  25489. // 取消监听
  25490. wx.offNetworkWeakChange()
  25491. ``` */
  25492. onNetworkWeakChange(
  25493. /** 弱网状态变化事件的监听函数 */
  25494. listener: OnNetworkWeakChangeCallback
  25495. ): void
  25496. /** [wx.onPageNotFound(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onPageNotFound.html)
  25497. *
  25498. * 需要基础库: `2.1.2`
  25499. *
  25500. * 在插件中使用:不支持
  25501. *
  25502. * 监听小程序要打开的页面不存在事件。该事件与 [`App.onPageNotFound`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onpagenotfoundobject-object) 的回调时机一致。
  25503. *
  25504. * **注意**
  25505. *
  25506. * - 开发者可以在回调中进行页面重定向,但必须在回调中**同步**处理,异步处理(例如 `setTimeout` 异步执行)无效。
  25507. * - 若开发者没有调用 [wx.onPageNotFound](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onPageNotFound.html) 绑定监听,也没有声明 `App.onPageNotFound`,当跳转页面不存在时,将推入微信客户端原生的页面不存在提示页面。
  25508. * - 如果回调中又重定向到另一个不存在的页面,将推入微信客户端原生的页面不存在提示页面,并且不再第二次回调。 */
  25509. onPageNotFound(
  25510. /** 小程序要打开的页面不存在事件的监听函数 */
  25511. listener: OnPageNotFoundCallback
  25512. ): void
  25513. /** [wx.onScreenRecordingStateChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.onScreenRecordingStateChanged.html)
  25514. *
  25515. * 需要基础库: `2.24.0`
  25516. *
  25517. * 在插件中使用:不支持
  25518. *
  25519. * 监听用户录屏事件。 */
  25520. onScreenRecordingStateChanged(
  25521. /** 用户录屏事件的监听函数 */
  25522. listener: OnScreenRecordingStateChangedCallback
  25523. ): void
  25524. /** [wx.onSocketClose(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketClose.html)
  25525. *
  25526. * 在插件中使用:不支持
  25527. *
  25528. * @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
  25529. *
  25530. * 监听 WebSocket 连接关闭事件。 */
  25531. onSocketClose(
  25532. /** WebSocket 连接关闭事件的监听函数 */
  25533. listener: OnSocketCloseCallback
  25534. ): void
  25535. /** [wx.onSocketError(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketError.html)
  25536. *
  25537. * 在插件中使用:不支持
  25538. *
  25539. * @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
  25540. *
  25541. * 监听 WebSocket 错误事件。 */
  25542. onSocketError(
  25543. /** WebSocket 错误事件的监听函数 */
  25544. listener: OnSocketErrorCallback
  25545. ): void
  25546. /** [wx.onSocketMessage(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketMessage.html)
  25547. *
  25548. * 在插件中使用:不支持
  25549. *
  25550. * @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
  25551. *
  25552. * 监听 WebSocket 接收到服务器的消息事件。 */
  25553. onSocketMessage(
  25554. /** WebSocket 接收到服务器的消息事件的监听函数 */
  25555. listener: OnSocketMessageCallback
  25556. ): void
  25557. /** [wx.onSocketOpen(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.onSocketOpen.html)
  25558. *
  25559. * 在插件中使用:不支持
  25560. *
  25561. * @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
  25562. *
  25563. * 监听 WebSocket 连接打开事件。 */
  25564. onSocketOpen(
  25565. /** WebSocket 连接打开事件的监听函数 */
  25566. listener: OnSocketOpenCallback
  25567. ): void
  25568. /** [wx.onThemeChange(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onThemeChange.html)
  25569. *
  25570. * 需要基础库: `2.11.0`
  25571. *
  25572. * 在插件中使用:不支持
  25573. *
  25574. * 监听系统主题改变事件。该事件与 [`App.onThemeChange`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onThemeChange-Object-object) 的回调时机一致。
  25575. *
  25576. * **注意**
  25577. *
  25578. * - 只有在全局配置"darkmode": true时才会触发此事件。 */
  25579. onThemeChange(
  25580. /** 系统主题改变事件的监听函数 */
  25581. listener: OnThemeChangeCallback
  25582. ): void
  25583. /** [wx.onUnhandledRejection(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/base/app/app-event/wx.onUnhandledRejection.html)
  25584. *
  25585. * 需要基础库: `2.10.0`
  25586. *
  25587. * 在插件中使用:不支持
  25588. *
  25589. * 监听未处理的 Promise 拒绝事件。该事件与 [`App.onUnhandledRejection`](https://developers.weixin.qq.com/miniprogram/dev/reference/api/App.html#onUnhandledRejection-Object-object) 的回调时机与参数一致。
  25590. *
  25591. * **注意**
  25592. *
  25593. * - 所有的 unhandledRejection 都可以被这一监听捕获,但只有 Error 类型的才会在小程序后台触发报警。 */
  25594. onUnhandledRejection(
  25595. /** 未处理的 Promise 拒绝事件的监听函数 */
  25596. listener: OnUnhandledRejectionCallback
  25597. ): void
  25598. /** [wx.onUserCaptureScreen(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.onUserCaptureScreen.html)
  25599. *
  25600. * 需要基础库: `1.4.0`
  25601. *
  25602. * 在插件中使用:不支持
  25603. *
  25604. * 监听用户主动截屏事件。用户使用系统截屏按键截屏时触发,只能注册一个监听
  25605. *
  25606. * **示例代码**
  25607. *
  25608. * ```js
  25609. wx.onUserCaptureScreen(function (res) {
  25610. console.log('用户截屏了')
  25611. })
  25612. ``` */
  25613. onUserCaptureScreen(
  25614. /** 用户主动截屏事件的监听函数 */
  25615. listener: OnUserCaptureScreenCallback
  25616. ): void
  25617. /** [wx.onVoIPChatInterrupted(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatInterrupted.html)
  25618. *
  25619. * 需要基础库: `2.7.0`
  25620. *
  25621. * 在插件中使用:需要基础库 `2.9.1`
  25622. *
  25623. * 监听被动断开实时语音通话事件。包括小游戏切入后端时断开 */
  25624. onVoIPChatInterrupted(
  25625. /** 被动断开实时语音通话事件的监听函数 */
  25626. listener: OnVoIPChatInterruptedCallback
  25627. ): void
  25628. /** [wx.onVoIPChatMembersChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatMembersChanged.html)
  25629. *
  25630. * 需要基础库: `2.7.0`
  25631. *
  25632. * 在插件中使用:需要基础库 `2.9.1`
  25633. *
  25634. * 监听实时语音通话成员在线状态变化事件。有成员加入/退出通话时触发回调 */
  25635. onVoIPChatMembersChanged(
  25636. /** 实时语音通话成员在线状态变化事件的监听函数 */
  25637. listener: OnVoIPChatMembersChangedCallback
  25638. ): void
  25639. /** [wx.onVoIPChatSpeakersChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatSpeakersChanged.html)
  25640. *
  25641. * 需要基础库: `2.7.0`
  25642. *
  25643. * 在插件中使用:需要基础库 `2.9.1`
  25644. *
  25645. * 监听实时语音通话成员通话状态变化事件。有成员开始/停止说话时触发回调 */
  25646. onVoIPChatSpeakersChanged(
  25647. /** 实时语音通话成员通话状态变化事件的监听函数 */
  25648. listener: OnVoIPChatSpeakersChangedCallback
  25649. ): void
  25650. /** [wx.onVoIPChatStateChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPChatStateChanged.html)
  25651. *
  25652. * 需要基础库: `2.16.0`
  25653. *
  25654. * 在插件中使用:不支持
  25655. *
  25656. * 监听房间状态变化事件。 */
  25657. onVoIPChatStateChanged(
  25658. /** 房间状态变化事件的监听函数 */
  25659. listener: OnVoIPChatStateChangedCallback
  25660. ): void
  25661. /** [wx.onVoIPVideoMembersChanged(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.onVoIPVideoMembersChanged.html)
  25662. *
  25663. * 需要基础库: `2.11.0`
  25664. *
  25665. * 在插件中使用:不支持
  25666. *
  25667. * 监听实时语音通话成员视频状态变化事件。 */
  25668. onVoIPVideoMembersChanged(
  25669. /** 实时语音通话成员视频状态变化事件的监听函数 */
  25670. listener: OnVoIPVideoMembersChangedCallback
  25671. ): void
  25672. /** [wx.onWifiConnected(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onWifiConnected.html)
  25673. *
  25674. * 需要基础库: `1.6.0`
  25675. *
  25676. * 在插件中使用:需要基础库 `2.9.1`
  25677. *
  25678. * 监听连接上 Wi-Fi 的事件 */
  25679. onWifiConnected(
  25680. /** 连接上 Wi-Fi 的事件的监听函数 */
  25681. listener: OnWifiConnectedCallback
  25682. ): void
  25683. /** [wx.onWifiConnectedWithPartialInfo(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onWifiConnectedWithPartialInfo.html)
  25684. *
  25685. * 需要基础库: `2.22.0`
  25686. *
  25687. * 在插件中使用:需要基础库 `2.22.1`
  25688. *
  25689. * 监听连接上 Wi-Fi 的事件 */
  25690. onWifiConnectedWithPartialInfo(
  25691. /** 连接上 Wi-Fi 的事件的监听函数 */
  25692. listener: OnWifiConnectedWithPartialInfoCallback
  25693. ): void
  25694. /** [wx.onWindowResize(function listener)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.onWindowResize.html)
  25695. *
  25696. * 需要基础库: `2.3.0`
  25697. *
  25698. * 在插件中使用:不支持
  25699. *
  25700. * 监听窗口尺寸变化事件 */
  25701. onWindowResize(
  25702. /** 窗口尺寸变化事件的监听函数 */
  25703. listener: OnWindowResizeCallback
  25704. ): void
  25705. /** [wx.openAppAuthorizeSetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.openAppAuthorizeSetting.html)
  25706. *
  25707. * 需要基础库: `2.20.1`
  25708. *
  25709. * 在插件中使用:需要基础库 `2.21.3`
  25710. *
  25711. * 跳转系统微信授权管理页
  25712. *
  25713. * **示例代码**
  25714. *
  25715. * ```js
  25716. wx.openAppAuthorizeSetting({
  25717. success (res) {
  25718. console.log(res)
  25719. }
  25720. })
  25721. ``` */
  25722. openAppAuthorizeSetting<
  25723. T extends OpenAppAuthorizeSettingOption = OpenAppAuthorizeSettingOption
  25724. >(
  25725. option?: T
  25726. ): PromisifySuccessResult<T, OpenAppAuthorizeSettingOption>
  25727. /** [wx.openBluetoothAdapter(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html)
  25728. *
  25729. * 需要基础库: `1.1.0`
  25730. *
  25731. * 在插件中使用:需要基础库 `1.9.6`
  25732. *
  25733. * 初始化蓝牙模块。iOS 上开启主机/从机(外围设备)模式时需分别调用一次,并指定对应的 `mode`。
  25734. *
  25735. * **object.fail 回调函数返回的 state 参数(仅 iOS)**
  25736. *
  25737. * | 状态码 | 说明 |
  25738. * | ------ | ------ |
  25739. * | 0 | 未知 |
  25740. * | 1 | 重置中 |
  25741. * | 2 | 不支持 |
  25742. * | 3 | 未授权 |
  25743. * | 4 | 未开启 |
  25744. *
  25745. * **注意**
  25746. *
  25747. * - 其他蓝牙相关 API 必须在 [wx.openBluetoothAdapter](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.openBluetoothAdapter.html) 调用之后使用。否则 API 会返回错误(errCode=10000)。
  25748. * - 在用户蓝牙开关未开启或者手机不支持蓝牙功能的情况下,调用 [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。
  25749. *
  25750. * **示例代码**
  25751. *
  25752. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  25753. * ```js
  25754. wx.openBluetoothAdapter({
  25755. success (res) {
  25756. console.log(res)
  25757. }
  25758. })
  25759. ``` */
  25760. openBluetoothAdapter<
  25761. T extends OpenBluetoothAdapterOption = OpenBluetoothAdapterOption
  25762. >(
  25763. option?: T
  25764. ): PromisifySuccessResult<T, OpenBluetoothAdapterOption>
  25765. /** [wx.openCard(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/card/wx.openCard.html)
  25766. *
  25767. * 需要基础库: `1.1.0`
  25768. *
  25769. * 在插件中使用:不支持
  25770. *
  25771. * 查看微信卡包中的卡券。只有通过 [认证](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)。
  25772. *
  25773. * **示例代码**
  25774. *
  25775. * ```js
  25776. wx.openCard({
  25777. cardList: [{
  25778. cardId: '',
  25779. code: ''
  25780. }, {
  25781. cardId: '',
  25782. code: ''
  25783. }],
  25784. success (res) { }
  25785. })
  25786. ``` */
  25787. openCard<T extends OpenCardOption = OpenCardOption>(
  25788. option: T
  25789. ): PromisifySuccessResult<T, OpenCardOption>
  25790. /** [wx.openChannelsActivity(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.openChannelsActivity.html)
  25791. *
  25792. * 需要基础库: `2.19.2`
  25793. *
  25794. * 在插件中使用:不支持
  25795. *
  25796. * 打开视频号视频 */
  25797. openChannelsActivity(option: OpenChannelsActivityOption): void
  25798. /** [wx.openChannelsEvent(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.openChannelsEvent.html)
  25799. *
  25800. * 需要基础库: `2.21.0`
  25801. *
  25802. * 在插件中使用:不支持
  25803. *
  25804. * 打开视频号活动页 */
  25805. openChannelsEvent(option: OpenChannelsEventOption): void
  25806. /** [wx.openChannelsLive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.openChannelsLive.html)
  25807. *
  25808. * 需要基础库: `2.15.0`
  25809. *
  25810. * 在插件中使用:不支持
  25811. *
  25812. * 打开视频号直播 */
  25813. openChannelsLive(option: OpenChannelsLiveOption): void
  25814. /** [wx.openChannelsUserProfile(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.openChannelsUserProfile.html)
  25815. *
  25816. * 需要基础库: `2.21.2`
  25817. *
  25818. * 在插件中使用:不支持
  25819. *
  25820. * 打开视频号主页 */
  25821. openChannelsUserProfile(option: OpenChannelsUserProfileOption): void
  25822. /** [wx.openCustomerServiceChat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/service-chat/wx.openCustomerServiceChat.html)
  25823. *
  25824. * 需要基础库: `2.19.0`
  25825. *
  25826. * 在插件中使用:不支持
  25827. *
  25828. * 打开微信客服,页面产生点击事件(例如 button 上 bindtap 的回调中)后才可调用。了解更多信息,可以参考[微信客服介绍](https://work.weixin.qq.com/kf/)。
  25829. *
  25830. * **示例代码**
  25831. *
  25832. * ```js
  25833. wx.openCustomerServiceChat({
  25834. extInfo: {url: ''},
  25835. corpId: '',
  25836. success(res) {}
  25837. })
  25838. ``` */
  25839. openCustomerServiceChat(option: OpenCustomerServiceChatOption): void
  25840. /** [wx.openDocument(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.openDocument.html)
  25841. *
  25842. * 在插件中使用:需要基础库 `2.15.0`
  25843. *
  25844. * 新开页面打开文档。微信客户端 `7.0.12` 版本前默认显示右上角菜单按钮,之后的版本默认不显示,需主动传入 `showMenu`。 */
  25845. openDocument<T extends OpenDocumentOption = OpenDocumentOption>(
  25846. option: T
  25847. ): PromisifySuccessResult<T, OpenDocumentOption>
  25848. /** [wx.openEmbeddedMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.openEmbeddedMiniProgram.html)
  25849. *
  25850. * 需要基础库: `2.20.1`
  25851. *
  25852. * 在插件中使用:需要基础库 `2.26.2`
  25853. *
  25854. * 打开半屏小程序。接入指引请参考 [半屏小程序能力](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/openEmbeddedMiniProgram.html)。 */
  25855. openEmbeddedMiniProgram<
  25856. T extends OpenEmbeddedMiniProgramOption = OpenEmbeddedMiniProgramOption
  25857. >(
  25858. option: T
  25859. ): PromisifySuccessResult<T, OpenEmbeddedMiniProgramOption>
  25860. /** [wx.openLocation(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.openLocation.html)
  25861. *
  25862. * 在插件中使用:需要基础库 `1.9.6`
  25863. *
  25864. * 使用微信内置地图查看位置
  25865. *
  25866. * **示例代码**
  25867. *
  25868. * ```js
  25869. wx.getLocation({
  25870. type: 'gcj02', //返回可以用于wx.openLocation的经纬度
  25871. success (res) {
  25872. const latitude = res.latitude
  25873. const longitude = res.longitude
  25874. wx.openLocation({
  25875. latitude,
  25876. longitude,
  25877. scale: 18
  25878. })
  25879. }
  25880. })
  25881. ``` */
  25882. openLocation<T extends OpenLocationOption = OpenLocationOption>(
  25883. option: T
  25884. ): PromisifySuccessResult<T, OpenLocationOption>
  25885. /** [wx.openPrivacyContract(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.openPrivacyContract.html)
  25886. *
  25887. * 需要基础库: `2.32.3`
  25888. *
  25889. * 在插件中使用:不支持
  25890. *
  25891. * 跳转至隐私协议页面。隐私合规开发指南详情可见[《小程序隐私协议开发指南》](https://developers.weixin.qq.com/miniprogram/dev/framework/user-privacy/PrivacyAuthorize.html)
  25892. *
  25893. * ****
  25894. *
  25895. * ## 具体说明:
  25896. *
  25897. * - 1. 一定要调用 wx.openPrivacyContract 接口吗?
  25898. *
  25899. * - 不是。开发者也可以选择在小程序页面内自行展示完整的隐私协议。但推荐使用该接口。
  25900. *
  25901. * **示例代码**
  25902. *
  25903. * ```js
  25904. wx.openPrivacyContract({
  25905. success: () => {}, // 打开成功
  25906. fail: () => {}, // 打开失败
  25907. complete: () => {}
  25908. })
  25909. ```
  25910. *
  25911. * **完整示例demo**
  25912. *
  25913. * demo1: 演示使用 `wx.getPrivacySetting` 和 `<button open-type="agreePrivacyAuthorization">` 在首页处理隐私弹窗逻辑
  25914. * [https://developers.weixin.qq.com/s/gi71sGm67hK0](https://developers.weixin.qq.com/s/gi71sGm67hK0)
  25915. *
  25916. * demo2: 演示使用 `wx.onNeedPrivacyAuthorization` 和 `<button open-type="agreePrivacyAuthorization">` 在多个页面处理隐私弹窗逻辑,同时演示了如何处理多个隐私接口同时调用。
  25917. * [https://developers.weixin.qq.com/s/hndZUOmA7gKn](https://developers.weixin.qq.com/s/hndZUOmA7gKn)
  25918. *
  25919. * demo3: 演示 `wx.onNeedPrivacyAuthorization`、`wx.requirePrivacyAuthorize`、`<button open-type="agreePrivacyAuthorization">` 和 `<input type="nickname">` 组件如何结合使用
  25920. * [https://developers.weixin.qq.com/s/jX7xWGmA7UKa](https://developers.weixin.qq.com/s/jX7xWGmA7UKa)
  25921. *
  25922. * demo4: 演示使用 `wx.onNeedPrivacyAuthorization` 和 `<button open-type="agreePrivacyAuthorization">` 在多个 tabBar 页面处理隐私弹窗逻辑。
  25923. * [https://developers.weixin.qq.com/s/g6BWZGmt7XK9](https://developers.weixin.qq.com/s/g6BWZGmt7XK9) */
  25924. openPrivacyContract(option: OpenPrivacyContractOption): void
  25925. /** [wx.openSetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.openSetting.html)
  25926. *
  25927. * 需要基础库: `1.1.0`
  25928. *
  25929. * 在插件中使用:需要基础库 `2.10.3`
  25930. *
  25931. * 调起客户端小程序设置界面,返回用户设置的操作结果。**设置界面只会出现小程序已经向用户请求过的[权限](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html)**。
  25932. *
  25933. * ****
  25934. *
  25935. * - 注意:[2.3.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为后,才可以跳转打开设置页,管理授权信息。[详情](https://developers.weixin.qq.com/community/develop/doc/000cea2305cc5047af5733de751008)
  25936. *
  25937. * **示例代码**
  25938. *
  25939. * ```js
  25940. wx.openSetting({
  25941. success (res) {
  25942. console.log(res.authSetting)
  25943. // res.authSetting = {
  25944. // "scope.userInfo": true,
  25945. // "scope.userLocation": true
  25946. // }
  25947. }
  25948. })
  25949. ``` */
  25950. openSetting<T extends OpenSettingOption = OpenSettingOption>(
  25951. option?: T
  25952. ): PromisifySuccessResult<T, OpenSettingOption>
  25953. /** [wx.openSingleStickerView(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/sticker/wx.openSingleStickerView.html)
  25954. *
  25955. * 需要基础库: `3.0.1`
  25956. *
  25957. * 在插件中使用:不支持
  25958. *
  25959. * 打开单个表情
  25960. *
  25961. * **示例代码**
  25962. *
  25963. * ```js
  25964. wx.openSingleStickerView({
  25965. url: '',
  25966. success(res) {}
  25967. })
  25968. ``` */
  25969. openSingleStickerView(option: OpenSingleStickerViewOption): void
  25970. /** [wx.openStickerIPView(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/sticker/wx.openStickerIPView.html)
  25971. *
  25972. * 需要基础库: `3.0.1`
  25973. *
  25974. * 在插件中使用:不支持
  25975. *
  25976. * 打开表情IP合辑
  25977. *
  25978. * **示例代码**
  25979. *
  25980. * ```js
  25981. wx.openStickerIPView({
  25982. url: '',
  25983. success(res) {}
  25984. })
  25985. ``` */
  25986. openStickerIPView(option: OpenStickerIPViewOption): void
  25987. /** [wx.openStickerSetView(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/sticker/wx.openStickerSetView.html)
  25988. *
  25989. * 需要基础库: `3.0.1`
  25990. *
  25991. * 在插件中使用:不支持
  25992. *
  25993. * 打开表情专辑
  25994. *
  25995. * **示例代码**
  25996. *
  25997. * ```js
  25998. wx.openStickerSetView({
  25999. url: '',
  26000. success(res) {}
  26001. })
  26002. ``` */
  26003. openStickerSetView(option: OpenStickerSetViewOption): void
  26004. /** [wx.openSystemBluetoothSetting(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.openSystemBluetoothSetting.html)
  26005. *
  26006. * 需要基础库: `2.20.1`
  26007. *
  26008. * 在插件中使用:需要基础库 `2.21.3`
  26009. *
  26010. * 跳转系统蓝牙设置页。仅支持安卓。
  26011. *
  26012. * **示例代码**
  26013. *
  26014. * ```js
  26015. wx.openSystemBluetoothSetting({
  26016. success (res) {
  26017. console.log(res)
  26018. }
  26019. })
  26020. ``` */
  26021. openSystemBluetoothSetting<
  26022. T extends OpenSystemBluetoothSettingOption = OpenSystemBluetoothSettingOption
  26023. >(
  26024. option?: T
  26025. ): PromisifySuccessResult<T, OpenSystemBluetoothSettingOption>
  26026. /** [wx.openVideoEditor(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.openVideoEditor.html)
  26027. *
  26028. * 需要基础库: `2.12.0`
  26029. *
  26030. * 在插件中使用:需要基础库 `2.15.0`
  26031. *
  26032. * 打开视频编辑器 */
  26033. openVideoEditor(option: OpenVideoEditorOption): void
  26034. /** [wx.pageScrollTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/wx.pageScrollTo.html)
  26035. *
  26036. * 需要基础库: `1.4.0`
  26037. *
  26038. * 在插件中使用:需要基础库 `2.1.0`
  26039. *
  26040. * 在插件中使用时,只能在当前插件的页面中调用
  26041. *
  26042. * 将页面滚动到目标位置,支持选择器和滚动距离两种方式定位
  26043. *
  26044. * **selector 语法**
  26045. *
  26046. * selector类似于 CSS 的选择器,但仅支持下列语法。
  26047. *
  26048. * + ID选择器:#the-id
  26049. * + class选择器(可以连续指定多个):.a-class.another-class
  26050. * + 子元素选择器:.the-parent > .the-child
  26051. * + 后代选择器:.the-ancestor .the-descendant
  26052. * + 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
  26053. * + 多选择器的并集:#a-node, .some-other-nodes
  26054. *
  26055. * **示例代码**
  26056. *
  26057. * ```js
  26058. wx.pageScrollTo({
  26059. scrollTop: 0,
  26060. duration: 300
  26061. })
  26062. ``` */
  26063. pageScrollTo<T extends PageScrollToOption = PageScrollToOption>(
  26064. option: T
  26065. ): PromisifySuccessResult<T, PageScrollToOption>
  26066. /** [wx.pauseBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.pauseBackgroundAudio.html)
  26067. *
  26068. * 在插件中使用:需要基础库 `1.9.6`
  26069. * @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) 替换
  26070. *
  26071. * 暂停播放音乐。
  26072. *
  26073. * **示例代码**
  26074. *
  26075. * ```js
  26076. wx.pauseBackgroundAudio()
  26077. ``` */
  26078. pauseBackgroundAudio<
  26079. T extends PauseBackgroundAudioOption = PauseBackgroundAudioOption
  26080. >(
  26081. option?: T
  26082. ): PromisifySuccessResult<T, PauseBackgroundAudioOption>
  26083. /** [wx.pauseVoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.pauseVoice.html)
  26084. *
  26085. * 在插件中使用:需要基础库 `1.9.6`
  26086. * @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) 替换
  26087. *
  26088. * 暂停正在播放的语音。再次调用 [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)。
  26089. *
  26090. * **示例代码**
  26091. *
  26092. * ```js
  26093. wx.startRecord({
  26094. success (res) {
  26095. const tempFilePath = res.tempFilePath
  26096. wx.playVoice({
  26097. filePath: tempFilePath
  26098. })
  26099. setTimeout(() => { wx.pauseVoice() }, 5000)
  26100. }
  26101. })
  26102. ``` */
  26103. pauseVoice<T extends PauseVoiceOption = PauseVoiceOption>(
  26104. option?: T
  26105. ): PromisifySuccessResult<T, PauseVoiceOption>
  26106. /** [wx.playBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.playBackgroundAudio.html)
  26107. *
  26108. * 在插件中使用:需要基础库 `1.9.6`
  26109. * @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) 替换
  26110. *
  26111. * 使用后台播放器播放音乐。对于微信客户端来说,只能同时有一个后台音乐在播放。当用户离开小程序后,音乐将暂停播放;当用户在其他小程序占用了音乐播放器,原有小程序内的音乐将停止播放。
  26112. *
  26113. * **示例代码**
  26114. *
  26115. * ```js
  26116. wx.playBackgroundAudio({
  26117. dataUrl: '',
  26118. title: '',
  26119. coverImgUrl: ''
  26120. })
  26121. ``` */
  26122. playBackgroundAudio<
  26123. T extends PlayBackgroundAudioOption = PlayBackgroundAudioOption
  26124. >(
  26125. option: T
  26126. ): PromisifySuccessResult<T, PlayBackgroundAudioOption>
  26127. /** [wx.playVoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.playVoice.html)
  26128. *
  26129. * 在插件中使用:需要基础库 `1.9.6`
  26130. * @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) 替换
  26131. *
  26132. * 开始播放语音。同时只允许一个语音文件正在播放,如果前一个语音文件还没播放完,将中断前一个语音播放。
  26133. *
  26134. * **示例代码**
  26135. *
  26136. * ```js
  26137. wx.startRecord({
  26138. success (res) {
  26139. const tempFilePath = res.tempFilePath
  26140. wx.playVoice({
  26141. filePath: tempFilePath,
  26142. complete () { }
  26143. })
  26144. }
  26145. })
  26146. ``` */
  26147. playVoice<T extends PlayVoiceOption = PlayVoiceOption>(
  26148. option: T
  26149. ): PromisifySuccessResult<T, PlayVoiceOption>
  26150. /** [wx.pluginLogin(Object args)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/login/wx.pluginLogin.html)
  26151. *
  26152. * 需要基础库: `2.20.1`
  26153. *
  26154. * 在插件中使用:需要基础库 `2.20.1`
  26155. *
  26156. * __该接口仅在小程序插件中可调用__,调用接口获得插件用户标志凭证(code)。插件可以此凭证换取用于识别用户的标识 openpid。用户不同、宿主小程序不同或插件不同的情况下,该标识均不相同,即当且仅当同一个用户在同一个宿主小程序中使用同一个插件时,openpid 才会相同。 */
  26157. pluginLogin(args?: PluginLoginOption): void
  26158. /** [wx.preloadAssets(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadAssets.html)
  26159. *
  26160. * 需要基础库: `2.22.1`
  26161. *
  26162. * 在插件中使用:不支持
  26163. *
  26164. * 为视图层预加载媒体资源文件, 目前支持:font,image
  26165. *
  26166. * **示例代码**
  26167. *
  26168. * ```js
  26169. wx.preloadAssets({
  26170. data: [
  26171. {
  26172. type: 'image',
  26173. src: imgUrl,
  26174. },
  26175. ],
  26176. success(resp) {
  26177. console.log('preloadAssets success', resp)
  26178. },
  26179. fail(err) {
  26180. console.log('preloadAssets fail', err)
  26181. },
  26182. })
  26183. ```
  26184. *
  26185. * ****
  26186. *
  26187. * - 开发过程中,可在开发者工具network面板查看预加载情况。 */
  26188. preloadAssets(option: PreloadAssetsOption): void
  26189. /** [wx.preloadSkylineView(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadSkylineView.html)
  26190. *
  26191. * 需要基础库: `2.24.7`
  26192. *
  26193. * 在插件中使用:需要基础库 `2.24.7`
  26194. *
  26195. * 预加载下个页面所需要的 [Skyline](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 运行环境。 */
  26196. preloadSkylineView(option?: PreloadSkylineViewOption): void
  26197. /** [wx.preloadWebview(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadWebview.html)
  26198. *
  26199. * 需要基础库: `2.15.0`
  26200. *
  26201. * 在插件中使用:需要基础库 `2.15.0`
  26202. *
  26203. * 预加载下个页面的 WebView。参见[预加载下个页面的时机](https://developers.weixin.qq.com/miniprogram/dev/framework/performance/tips/runtime_nav.html#_2-4-控制预加载下个页面的时机) */
  26204. preloadWebview(option?: PreloadWebviewOption): void
  26205. /** [wx.previewImage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewImage.html)
  26206. *
  26207. * 在插件中使用:需要基础库 `1.9.6`
  26208. *
  26209. * 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
  26210. *
  26211. * **支持长按识别的码**
  26212. *
  26213. * | 类型 | 说明 | 最低版本 |
  26214. * |------|------| -------|
  26215. * | 小程序码 | |
  26216. * | 微信个人码 | 不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) |
  26217. * | 企业微信个人码 | 不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) |
  26218. * | 普通群码 | 指仅包含微信用户的群,不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) |
  26219. * | 互通群码 | 指既有微信用户也有企业微信用户的群,不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) |
  26220. * | 公众号二维码 | 不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) |
  26221. *
  26222. * **示例代码**
  26223. *
  26224. * ```js
  26225. wx.previewImage({
  26226. current: '', // 当前显示图片的http链接
  26227. urls: [] // 需要预览的图片http链接列表
  26228. })
  26229. ``` */
  26230. previewImage<T extends PreviewImageOption = PreviewImageOption>(
  26231. option: T
  26232. ): PromisifySuccessResult<T, PreviewImageOption>
  26233. /** [wx.previewMedia(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewMedia.html)
  26234. *
  26235. * 需要基础库: `2.12.0`
  26236. *
  26237. * 在插件中使用:需要基础库 `2.15.0`
  26238. *
  26239. * 预览图片和视频。
  26240. *
  26241. * **支持长按识别的码**
  26242. *
  26243. * | 类型 | 说明 | 最低版本 |
  26244. * |------|------| -------|
  26245. * | 小程序码 | |
  26246. * | 微信个人码 | 不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) |
  26247. * | 企业微信个人码 | 不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) |
  26248. * | 普通群码 | 指仅包含微信用户的群,不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) |
  26249. * | 互通群码 | 指既有微信用户也有企业微信用户的群,不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) |
  26250. * | 公众号二维码 | 不支持小游戏 | [2.18.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) | */
  26251. previewMedia<T extends PreviewMediaOption = PreviewMediaOption>(
  26252. option: T
  26253. ): PromisifySuccessResult<T, PreviewMediaOption>
  26254. /** [wx.reLaunch(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.reLaunch.html)
  26255. *
  26256. * 需要基础库: `1.1.0`
  26257. *
  26258. * 在插件中使用:需要基础库 `2.3.1`
  26259. *
  26260. * 在插件中使用时,只能在当前插件的页面中调用
  26261. *
  26262. * 关闭所有页面,打开到应用内的某个页面
  26263. *
  26264. * **示例代码**
  26265. *
  26266. * ```js
  26267. wx.reLaunch({
  26268. url: 'test?id=1'
  26269. })
  26270. ```
  26271. *
  26272. * ```html
  26273. * // test
  26274. * Page({
  26275. * onLoad (option) {
  26276. * console.log(option.query)
  26277. * }
  26278. * })
  26279. * ``` */
  26280. reLaunch<T extends ReLaunchOption = ReLaunchOption>(
  26281. option: T
  26282. ): PromisifySuccessResult<T, ReLaunchOption>
  26283. /** [wx.readBLECharacteristicValue(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.readBLECharacteristicValue.html)
  26284. *
  26285. * 需要基础库: `1.1.0`
  26286. *
  26287. * 在插件中使用:需要基础库 `1.9.6`
  26288. *
  26289. * 读取蓝牙低功耗设备特征值的二进制数据。注意:必须设备的特征支持 read 才可以成功调用。
  26290. *
  26291. * **注意**
  26292. *
  26293. * - 并行调用多次会存在读失败的可能性。
  26294. * - 接口读取到的信息需要在 [wx.onBLECharacteristicValueChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.onBLECharacteristicValueChange.html) 方法注册的回调中获取。
  26295. *
  26296. * **示例代码**
  26297. *
  26298. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  26299. * ```js
  26300. // 必须在这里的回调才能获取
  26301. wx.onBLECharacteristicValueChange(function(characteristic) {
  26302. console.log('characteristic value comed:', characteristic)
  26303. })
  26304. wx.readBLECharacteristicValue({
  26305. // 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
  26306. deviceId,
  26307. // 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
  26308. serviceId,
  26309. // 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
  26310. characteristicId,
  26311. success (res) {
  26312. console.log('readBLECharacteristicValue:', res.errCode)
  26313. }
  26314. })
  26315. ``` */
  26316. readBLECharacteristicValue<
  26317. T extends ReadBLECharacteristicValueOption = ReadBLECharacteristicValueOption
  26318. >(
  26319. option: T
  26320. ): PromisifySuccessResult<T, ReadBLECharacteristicValueOption>
  26321. /** [wx.redirectTo(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.redirectTo.html)
  26322. *
  26323. * 在插件中使用:需要基础库 `2.2.2`
  26324. *
  26325. * 在插件中使用时,只能在当前插件的页面中调用
  26326. *
  26327. * 关闭当前页面,跳转到应用内的某个页面。但是不允许跳转到 tabbar 页面。
  26328. *
  26329. * **示例代码**
  26330. *
  26331. * ```js
  26332. wx.redirectTo({
  26333. url: 'test?id=1'
  26334. })
  26335. ``` */
  26336. redirectTo<T extends RedirectToOption = RedirectToOption>(
  26337. option: T
  26338. ): PromisifySuccessResult<T, RedirectToOption>
  26339. /** [wx.removeStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorage.html)
  26340. *
  26341. * 在插件中使用:需要基础库 `1.9.6`
  26342. *
  26343. * 从本地缓存中移除指定 key。
  26344. *
  26345. * **示例代码**
  26346. *
  26347. * ```js
  26348. wx.removeStorage({
  26349. key: 'key',
  26350. success (res) {
  26351. console.log(res)
  26352. }
  26353. })
  26354. ```
  26355. *
  26356. * ```js
  26357. try {
  26358. wx.removeStorageSync('key')
  26359. } catch (e) {
  26360. // Do something when catch error
  26361. }
  26362. ``` */
  26363. removeStorage<T extends RemoveStorageOption = RemoveStorageOption>(
  26364. option: T
  26365. ): PromisifySuccessResult<T, RemoveStorageOption>
  26366. /** [wx.removeStorageSync(string key)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorageSync.html)
  26367. *
  26368. * 在插件中使用:需要基础库 `1.9.6`
  26369. *
  26370. * [wx.removeStorage](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.removeStorage.html) 的同步版本
  26371. *
  26372. * **示例代码**
  26373. *
  26374. * ```js
  26375. wx.removeStorage({
  26376. key: 'key',
  26377. success (res) {
  26378. console.log(res)
  26379. }
  26380. })
  26381. ```
  26382. *
  26383. * ```js
  26384. try {
  26385. wx.removeStorageSync('key')
  26386. } catch (e) {
  26387. // Do something when catch error
  26388. }
  26389. ``` */
  26390. removeStorageSync(
  26391. /** 本地缓存中指定的 key */
  26392. key: string
  26393. ): void
  26394. /** [wx.removeTabBarBadge(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.removeTabBarBadge.html)
  26395. *
  26396. * 需要基础库: `1.9.0`
  26397. *
  26398. * 在插件中使用:不支持
  26399. *
  26400. * 移除 tabBar 某一项右上角的文本 */
  26401. removeTabBarBadge<
  26402. T extends RemoveTabBarBadgeOption = RemoveTabBarBadgeOption
  26403. >(
  26404. option: T
  26405. ): PromisifySuccessResult<T, RemoveTabBarBadgeOption>
  26406. /** [wx.reportAnalytics(string eventName, Object data)](https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.reportAnalytics.html)
  26407. *
  26408. * 在插件中使用:需要基础库 `1.9.6`
  26409. *
  26410. * 在插件中使用时,可以被正常调用,但目前不会进行统计展示
  26411. * @deprecated 基础库版本 [2.31.1](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃
  26412. *
  26413. * 自定义分析数据上报接口。使用前,需要在小程序管理后台自定义分析中新建事件,配置好事件名与字段。
  26414. *
  26415. * **示例代码**
  26416. *
  26417. * ```js
  26418. wx.reportAnalytics('purchase', {
  26419. price: 120,
  26420. color: 'red'
  26421. })
  26422. ``` */
  26423. reportAnalytics(
  26424. /** 事件名 */
  26425. eventName: string,
  26426. /** 上报的自定义数据,key 为配置中的字段名,value 为上报的数据。 */
  26427. data: IAnyObject
  26428. ): void
  26429. /** [wx.reportEvent(string eventId, object data)](https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.reportEvent.html)
  26430. *
  26431. * 需要基础库: `2.14.4`
  26432. *
  26433. * 在插件中使用:不支持
  26434. *
  26435. * 事件上报 */
  26436. reportEvent(
  26437. /** 在 mp 实验系统中设置的事件英文名 */
  26438. eventId: string,
  26439. /** 可被 JSON.stringify 的对象,将一起上报至系统 */
  26440. data?: IAnyObject
  26441. ): void
  26442. /** [wx.reportMonitor(string name, number value)](https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.reportMonitor.html)
  26443. *
  26444. * 需要基础库: `2.0.1`
  26445. *
  26446. * 在插件中使用:不支持
  26447. *
  26448. * 自定义业务数据监控上报接口。
  26449. *
  26450. * **使用说明**
  26451. *
  26452. * 使用前,需要在「小程序管理后台-运维中心-性能监控-业务数据监控」中新建监控事件,配置监控描述与告警类型。每一个监控事件对应唯一的监控ID,开发者最多可以创建128个监控事件。
  26453. *
  26454. * **示例代码**
  26455. *
  26456. * ```js
  26457. wx.reportMonitor('1', 1)
  26458. ``` */
  26459. reportMonitor(
  26460. /** 监控ID,在「小程序管理后台」新建数据指标后获得 */
  26461. name: string,
  26462. /** 上报数值,经处理后会在「小程序管理后台」上展示每分钟的上报总量 */
  26463. value: number
  26464. ): void
  26465. /** [wx.reportPerformance(Number id, Number value, String|Array dimensions)](https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.reportPerformance.html)
  26466. *
  26467. * 需要基础库: `2.9.2`
  26468. *
  26469. * 在插件中使用:需要基础库 `2.9.3`
  26470. *
  26471. * 小程序测速上报。使用前,需要在小程序管理后台配置。
  26472. *
  26473. * **示例代码**
  26474. *
  26475. * ```js
  26476. wx.reportPerformance(1101, 680)
  26477. wx.reportPerformance(1101, 680, 'custom')
  26478. ``` */
  26479. reportPerformance(
  26480. /** 指标 id */
  26481. id: number,
  26482. /** 需要上报的数值 */
  26483. value: number,
  26484. /** 自定义维度 (选填) */
  26485. dimensions?: string | any[]
  26486. ): void
  26487. /** [wx.requestCommonPayment(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/payment/wx.requestCommonPayment.html)
  26488. *
  26489. * 需要基础库: `2.19.2`
  26490. *
  26491. * 在插件中使用:不支持
  26492. *
  26493. * 发起b2b支付
  26494. *
  26495. * ****
  26496. *
  26497. * ## 注意事项:
  26498. *
  26499. * **示例代码**
  26500. *
  26501. * ```js
  26502. wx.requestCommonPayment({
  26503. signData: JSON.stringify({
  26504. offerId: '123',
  26505. buyQuantity: 1,
  26506. env: 0,
  26507. currencyType: 'CNY',
  26508. platform: 'android',
  26509. productId: 'testproductId',
  26510. goodsPrice: 10,
  26511. outTradeNo: 'xxxxxx',
  26512. attach: 'testdata',
  26513. }),
  26514. paySig: 'd0b8bbccbe109b11549bcfd6602b08711f46600965253a949cd6a2b895152f9d',
  26515. signature: 'd0b8bbccbe109b11549bcfd6602b08711f46600965253a949cd6a2b895152f9d',
  26516. mode: 'retail_pay_goods',
  26517. success(res) {
  26518. console.log('requestCommonPayment success', res)
  26519. },
  26520. fail({ errMsg, errCode }) {
  26521. console.error(errMsg, errCode)
  26522. },
  26523. })
  26524. ``` */
  26525. requestCommonPayment(option: RequestCommonPaymentOption): void
  26526. /** [wx.requestDeviceVoIP(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/device-voip/wx.requestDeviceVoIP.html)
  26527. *
  26528. * 需要基础库: `2.27.3`
  26529. *
  26530. * 在插件中使用:不支持
  26531. *
  26532. * 请求用户授权与设备(组)间进行音视频通话。
  26533. *
  26534. * **示例代码**
  26535. *
  26536. * ```js
  26537. // 授权单台设备
  26538. wx.requestDeviceVoIP({
  26539. sn: 'xxxx',
  26540. snTicket: 'xxxxx',
  26541. modelId: 'xxx',
  26542. deviceName: 'xxx',
  26543. success(res) {
  26544. console.log(res)
  26545. },
  26546. fail(res) {
  26547. console.log(res)
  26548. }
  26549. })
  26550. // 批量授权(授权设备组)
  26551. wx.requestDeviceVoIP({
  26552. isGroup: true,
  26553. groupId: '设备组 ID',
  26554. success(res) {
  26555. console.log(res)
  26556. },
  26557. fail(res) {
  26558. console.log(res)
  26559. }
  26560. })
  26561. ``` */
  26562. requestDeviceVoIP(option: RequestDeviceVoIPOption): void
  26563. /** [wx.requestOrderPayment(Object args)](https://developers.weixin.qq.com/miniprogram/dev/api/payment/wx.requestOrderPayment.html)
  26564. *
  26565. * 需要基础库: `2.16.0`
  26566. *
  26567. * 在插件中使用:不支持
  26568. *
  26569. * 仅接入了[自定义版交易组件](https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent2/Introduction2)的小程序需要使用,普通小程序可直接使用 [`wx.requestPayment`](https://developers.weixin.qq.com/miniprogram/dev/api/payment/wx.requestPayment.html)。
  26570. *
  26571. * **前置检查**
  26572. *
  26573. * 接入自定义版交易组件之后,若要发起微信支付,请先查询[需要校验的场景](https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent2/API/order/check_scene)。
  26574. * 在需要校验的场景中,发起微信支付时,必须使用该接口,需要按照要求传入相关的[订单信息](https://developers.weixin.qq.com/miniprogram/dev/framework/ministore/minishopopencomponent2/API/order/add_order)进行校验,校验通过后用户才可以完成当前订单的支付,非需要校验的场景则可以按照商家要求自行选择传入订单信息或不传入。 */
  26575. requestOrderPayment<
  26576. T extends RequestOrderPaymentOption = RequestOrderPaymentOption
  26577. >(
  26578. args: T
  26579. ): PromisifySuccessResult<T, RequestOrderPaymentOption>
  26580. /** [wx.requestPayment(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/payment/wx.requestPayment.html)
  26581. *
  26582. * 需要基础库: `3.1.0`
  26583. *
  26584. * 在插件中使用:不支持
  26585. *
  26586. * 发起微信支付。调用前需在[小程序微信公众平台](https://mp.weixin.qq.com/) -功能-微信支付入口申请接入微信支付。了解更多信息,可以参考 [微信支付开发文档](https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/api.shtml):
  26587. * - [开发指引](https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transactions/chapter2_3.shtml)
  26588. * - [下单接口](https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transactions/chapter3_2.shtml)
  26589. * - [支付接口](https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/transactions/chapter3_12.shtml)
  26590. * - 旧版本 (v2)
  26591. * - [开发指引](https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_3&index=1)
  26592. * - [支付接口](https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=7_7&index=3)
  26593. *
  26594. * 如果使用[云开发](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/basis/getting-started.html),则 `wx.requestPayment` 所需参数可以通过云开发微信支付统一下单接口免鉴权获取、并可免证书、免签名的安全调用微信支付服务端接口、及接收异步支付结果回调,详见[云开发微信支付](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/wechatpay/wechatpay.html)。
  26595. *
  26596. * **示例代码**
  26597. *
  26598. * ```js
  26599. wx.requestPayment({
  26600. timeStamp: '',
  26601. nonceStr: '',
  26602. package: '',
  26603. signType: 'MD5',
  26604. paySign: '',
  26605. success (res) { },
  26606. fail (res) { }
  26607. })
  26608. ```
  26609. *
  26610. * 注:如果服务端有使用云开发,可以通过云开发微信支付[统一下单](https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/open/pay/CloudPay.unifiedOrder.html)接口免鉴权获取以上所需所有参数,示例:
  26611. *
  26612. * ```js
  26613. // 云函数代码
  26614. const cloud = require('wx-server-sdk')
  26615. cloud.init({
  26616. env: cloud.DYNAMIC_CURRENT_ENV
  26617. })
  26618. exports.main = async (event, context) => {
  26619. const res = await cloud.cloudPay.unifiedOrder({
  26620. "body" : "小秋TIT店-超市",
  26621. "outTradeNo" : "1217752501201407033233368018",
  26622. "spbillCreateIp" : "127.0.0.1",
  26623. "subMchId" : "1900009231",
  26624. "totalFee" : 1,
  26625. "envId": "test-f0b102",
  26626. "functionName": "pay_cb"
  26627. })
  26628. return res
  26629. }
  26630. // 小程序代码
  26631. wx.cloud.callFunction({
  26632. name: '函数名',
  26633. data: {
  26634. // ...
  26635. },
  26636. success: res => {
  26637. const payment = res.result.payment
  26638. wx.requestPayment({
  26639. ...payment,
  26640. success (res) {
  26641. console.log('pay success', res)
  26642. },
  26643. fail (err) {
  26644. console.error('pay fail', err)
  26645. }
  26646. })
  26647. },
  26648. fail: console.error,
  26649. })
  26650. ``` */
  26651. requestPayment<T extends RequestPaymentOption = RequestPaymentOption>(
  26652. option: T
  26653. ): PromisifySuccessResult<T, RequestPaymentOption>
  26654. /** [wx.requestPluginPayment(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/payment/wx.requestPluginPayment.html)
  26655. *
  26656. * 需要基础库: `2.22.1`
  26657. *
  26658. * 在插件中使用:需要基础库 `2.22.1`
  26659. *
  26660. * 插件中发起支付。
  26661. *
  26662. * **Tip**
  26663. *
  26664. * 1. `tip`: 小程序与插件绑定在同一个open平台账号上且小程序与插件均为open账号的同主体/关联主体时,调用此接口将直接拉起支付收银台。
  26665. * 1. `tip`: 这个接口本身可以在开发者工具中使用,但功能页的跳转目前不支持在开发者工具中调试,请在真机上测试。
  26666. * 1. `tip`: 跳转支付功能页需要在 `app.json` 中配置 `"functionalPages": true`
  26667. *
  26668. * **示例代码**
  26669. *
  26670. * 具体用法及参数说明可参考 [插件支付文档](https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/functional-pages/request-payment.html)
  26671. * ```js
  26672. wx.requestPluginPayment({
  26673. version: 'release',
  26674. fee: 1,
  26675. paymentArgs: {},
  26676. currencyType: 'CNY',
  26677. success (res) { },
  26678. fail (res) { }
  26679. })
  26680. ``` */
  26681. requestPluginPayment(option: RequestPluginPaymentOption): void
  26682. /** [wx.requestSubscribeDeviceMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeDeviceMessage.html)
  26683. *
  26684. * 需要基础库: `2.20.0`
  26685. *
  26686. * 在插件中使用:不支持
  26687. *
  26688. * 订阅设备消息接口,调用后弹出授权框,用户同意后会允许开发者给用户发送订阅模版消息。当用户点击“允许”按钮时,模板消息会被添加到用户的小程序设置页,通过 wx.getSetting 接口可获取用户对相关模板消息的订阅状态。
  26689. *
  26690. * **错误码**
  26691. *
  26692. * | errCode | errMsg | 说明 |
  26693. * | ------- | ------------------------------------------------------ | -------------------------------------------------------------- |
  26694. * | 10001 | TmplIds can't be empty | tmplIds 为空 |
  26695. * | 10004 | Invalid template id | tmplId 参数类型错误 |
  26696. * | 20001 | No template data return, verify the template id exist | tmplId 为空 |
  26697. * | 20003 | Templates count out of max bounds | tmplId 数量超过上限 |
  26698. * | 19720726 | check sn_ticket fail | snTicket 不合法 |
  26699. * | 19720727 | sn_ticket expire | snTicket 过期 |
  26700. * | 19720728 | err_not_found_tid | tmplId 不存在 |
  26701. * | 19720736 | template_id do not match model_id | modelId 类型与 tmplId 类型不符 |
  26702. *
  26703. * **示例代码**
  26704. *
  26705. * ```js
  26706. wx.requestSubscribeDeviceMessage({
  26707. tmplIds: ['xxxxx'],
  26708. sn: 'xxxx',
  26709. snTicket: 'xxxxx',
  26710. modelId: 'xxx',
  26711. success(res) {
  26712. console.log(res)
  26713. },
  26714. fail(res) {
  26715. console.log(res)
  26716. }
  26717. })
  26718. ``` */
  26719. requestSubscribeDeviceMessage<
  26720. T extends RequestSubscribeDeviceMessageOption = RequestSubscribeDeviceMessageOption
  26721. >(
  26722. option: T
  26723. ): PromisifySuccessResult<T, RequestSubscribeDeviceMessageOption>
  26724. /** [wx.requestSubscribeMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html)
  26725. *
  26726. * 需要基础库: `2.4.4`
  26727. *
  26728. * 在插件中使用:不支持
  26729. *
  26730. * 调起客户端小程序订阅消息界面,返回用户订阅消息的操作结果。当用户勾选了订阅面板中的“总是保持以上选择,不再询问”时,模板消息会被添加到用户的小程序设置页,通过 [wx.getSetting](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/setting/wx.getSetting.html) 接口可获取用户对相关模板消息的订阅状态。
  26731. *
  26732. * ## 注意事项
  26733. * - 一次性模板 id 和永久模板 id 不可同时使用。
  26734. * - 低版本基础库2.4.4~2.8.3 已支持订阅消息接口调用,仅支持传入一个一次性 tmplId / 永久 tmplId。
  26735. * - [2.8.2](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,用户发生点击行为或者发起支付回调后,才可以调起订阅消息界面。
  26736. * - [2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,开发版和体验版小程序将禁止使用模板消息 formId。
  26737. * - 一次授权调用里,每个tmplId对应的模板标题不能存在相同的,若出现相同的,只保留一个。
  26738. * - [2.10.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 版本开始,支持订阅语音消息提醒,[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/subscribe-message.html)
  26739. *
  26740. * **错误码**
  26741. *
  26742. * | errCode | errMsg | 说明 |
  26743. * | ------- | ------------------------------------------------------ | -------------------------------------------------------------- |
  26744. * | 10001 | TmplIds can't be empty | 参数传空了 |
  26745. * | 10002 | Request list fail | 网络问题,请求消息列表失败 |
  26746. * | 10003 | Request subscribe fail | 网络问题,订阅请求发送失败 |
  26747. * | 10004 | Invalid template id | 参数类型错误 |
  26748. * | 10005 | Cannot show subscribe message UI | 无法展示 UI,一般是小程序这个时候退后台了导致的 |
  26749. * | 20001 | No template data return, verify the template id exist | 没有模板数据,一般是模板 ID 不存在 或者和模板类型不对应 导致的 |
  26750. * | 20002 | Templates type must be same | 模板消息类型 既有一次性的又有永久的 |
  26751. * | 20003 | Templates count out of max bounds | 模板消息数量超过上限 |
  26752. * | 20004 | The main switch is switched off | 用户关闭了主开关,无法进行订阅 |
  26753. * | 20005 | This mini program was banned from subscribing messages | 小程序被禁封 |
  26754. * | 20013 | Reject DeviceMsg Template | 不允许通过该接口订阅设备消息 |
  26755. *
  26756. * **示例代码**
  26757. *
  26758. * ```js
  26759. wx.requestSubscribeMessage({
  26760. tmplIds: [''],
  26761. success (res) { }
  26762. })
  26763. ``` */
  26764. requestSubscribeMessage<
  26765. T extends RequestSubscribeMessageOption = RequestSubscribeMessageOption
  26766. >(
  26767. option: T
  26768. ): PromisifySuccessResult<T, RequestSubscribeMessageOption>
  26769. /** [wx.requestVirtualPayment(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/payment/wx.requestVirtualPayment.html)
  26770. *
  26771. * 需要基础库: `2.19.2`
  26772. *
  26773. * 在插件中使用:不支持
  26774. *
  26775. * 发起米大师虚拟支付
  26776. *
  26777. * ****
  26778. *
  26779. * ## 注意事项:
  26780. *
  26781. * - 1. 目前只有 >= v2.19.2 的基础库支持该接口,后续将对更多低版本基础库支持该接口。因此建议开发者这样判断:当前用户的基础库版本 >= v2.19.2 时可以直接用 wx.requestVirtualPayment,小于 v2.19.2 时,用 wx.canIUse('requestVirtualPayment') 来判断接口是否可用。具体判断方法可参考示例代码。
  26782. *
  26783. * **示例代码**
  26784. *
  26785. * ```js
  26786. function compareVersion(_v1, _v2) {
  26787. if (typeof _v1 !== 'string' || typeof _v2 !== 'string') return 0
  26788. const v1 = _v1.split('.')
  26789. const v2 = _v2.split('.')
  26790. const len = Math.max(v1.length, v2.length)
  26791. while (v1.length < len) {
  26792. v1.push('0')
  26793. }
  26794. while (v2.length < len) {
  26795. v2.push('0')
  26796. }
  26797. for (let i = 0; i < len; i++) {
  26798. const num1 = parseInt(v1[i], 10)
  26799. const num2 = parseInt(v2[i], 10)
  26800. if (num1 > num2) {
  26801. return 1
  26802. } else if (num1 < num2) {
  26803. return -1
  26804. }
  26805. }
  26806. return 0
  26807. }
  26808. const SDKVersion = wx.getSystemInfoSync().SDKVersion
  26809. if (compareVersion(SDKVersion, '2.19.2') >= 0 || wx.canIUse('requestVirtualPayment')) {
  26810. wx.requestVirtualPayment({
  26811. signData: JSON.stringify({
  26812. offerId: '123',
  26813. buyQuantity: 1,
  26814. env: 0,
  26815. currencyType: 'CNY',
  26816. platform: 'android',
  26817. productId: 'testproductId',
  26818. goodsPrice: 10,
  26819. outTradeNo: 'xxxxxx',
  26820. attach: 'testdata',
  26821. }),
  26822. paySig: 'd0b8bbccbe109b11549bcfd6602b08711f46600965253a949cd6a2b895152f9d',
  26823. signature: 'd0b8bbccbe109b11549bcfd6602b08711f46600965253a949cd6a2b895152f9d',
  26824. mode: 'short_series_goods',
  26825. success(res) {
  26826. console.log('requestVirtualPayment success', res)
  26827. },
  26828. fail({ errMsg, errCode }) {
  26829. console.error(errMsg, errCode)
  26830. },
  26831. })
  26832. } else {
  26833. console.log('当前用户的客户端版本不支持 wx.requestVirtualPayment')
  26834. }
  26835. ``` */
  26836. requestVirtualPayment(option: RequestVirtualPaymentOption): void
  26837. /** [wx.requirePrivacyAuthorize(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.requirePrivacyAuthorize.html)
  26838. *
  26839. * 需要基础库: `2.32.3`
  26840. *
  26841. * 在插件中使用:不支持
  26842. *
  26843. * 模拟隐私接口调用,并触发隐私弹窗逻辑。隐私合规开发指南详情可见[《小程序隐私协议开发指南》](https://developers.weixin.qq.com/miniprogram/dev/framework/user-privacy/PrivacyAuthorize.html)
  26844. *
  26845. * ****
  26846. *
  26847. * ## 具体说明:
  26848. *
  26849. * 1. 调用 wx.requirePrivacyAuthorize() 时:
  26850. *
  26851. * - 1. 如果用户之前已经同意过隐私授权,会立即返回success回调,不会触发 wx.onNeedPrivacyAuthorization 事件。
  26852. * - 2. 如果用户之前没有授权过,并且开发者注册了 [wx.onNeedPrivacyAuthorization()](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/privacy/wx.onNeedPrivacyAuthorization.html) 事件监听,就会立即触发 wx.onNeedPrivacyAuthorization 事件,然后开发者在 onNeedPrivacyAuthorization 回调中弹出自定义隐私授权弹窗,用户点了同意后开发者调用 wx.onNeedPrivacyAuthorization 的回调接口 resolve({ event: 'agree', buttonId: 'agree-btn' }),会触发 requirePrivacyAuthorize 的 success 回调。开发者调用 wx.onNeedPrivacyAuthorization 的回调接口 resolve({ event: 'disagree' }) 的话,会触发 requirePrivacyAuthorize 的 fail 回调。
  26853. * - 3. 基于上述特性,开发者可以在调用任何真实隐私接口之前调用 wx.requirePrivacyAuthorize 接口来模拟隐私接口调用,并触发隐私弹窗逻辑。
  26854. *
  26855. * 2. 一定要调用 wx.requirePrivacyAuthorize 接口吗?
  26856. *
  26857. * - 不是,wx.requirePrivacyAuthorize 只是一个辅助接口,可以根据实际情况选择使用。
  26858. *
  26859. * **示例代码**
  26860. *
  26861. * ```html
  26862. * // page.wxml
  26863. * <view wx:if="{{showPrivacy}}">
  26864. * <view>隐私弹窗内容....</view>
  26865. * <button id="agree-btn" open-type="agreePrivacyAuthorization" bindagreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
  26866. * </view>
  26867. * ```
  26868. * ```js
  26869. // page.js
  26870. Page({
  26871. data: {
  26872. showPrivacy: false
  26873. },
  26874. onLoad() {
  26875. wx.onNeedPrivacyAuthorization(resolve => {
  26876. // 需要用户同意隐私授权时
  26877. // 弹出开发者自定义的隐私授权弹窗
  26878. this.setData({
  26879. showPrivacy: true
  26880. })
  26881. this.resolvePrivacyAuthorization = resolve
  26882. })
  26883. wx.requirePrivacyAuthorize({
  26884. success: () => {
  26885. // 用户同意授权
  26886. // 继续小程序逻辑
  26887. },
  26888. fail: () => {}, // 用户拒绝授权
  26889. complete: () => {}
  26890. })
  26891. },
  26892. handleAgreePrivacyAuthorization() {
  26893. // 用户点击同意按钮后
  26894. this.resolvePrivacyAuthorization({ buttonId: 'agree-btn', event: 'agree' })
  26895. }
  26896. })
  26897. ```
  26898. *
  26899. * **完整示例demo**
  26900. *
  26901. * demo1: 演示使用 `wx.getPrivacySetting` 和 `<button open-type="agreePrivacyAuthorization">` 在首页处理隐私弹窗逻辑
  26902. * [https://developers.weixin.qq.com/s/gi71sGm67hK0](https://developers.weixin.qq.com/s/gi71sGm67hK0)
  26903. *
  26904. * demo2: 演示使用 `wx.onNeedPrivacyAuthorization` 和 `<button open-type="agreePrivacyAuthorization">` 在多个页面处理隐私弹窗逻辑,同时演示了如何处理多个隐私接口同时调用。
  26905. * [https://developers.weixin.qq.com/s/hndZUOmA7gKn](https://developers.weixin.qq.com/s/hndZUOmA7gKn)
  26906. *
  26907. * demo3: 演示 `wx.onNeedPrivacyAuthorization`、`wx.requirePrivacyAuthorize`、`<button open-type="agreePrivacyAuthorization">` 和 `<input type="nickname">` 组件如何结合使用
  26908. * [https://developers.weixin.qq.com/s/jX7xWGmA7UKa](https://developers.weixin.qq.com/s/jX7xWGmA7UKa)
  26909. *
  26910. * demo4: 演示使用 `wx.onNeedPrivacyAuthorization` 和 `<button open-type="agreePrivacyAuthorization">` 在多个 tabBar 页面处理隐私弹窗逻辑。
  26911. * [https://developers.weixin.qq.com/s/g6BWZGmt7XK9](https://developers.weixin.qq.com/s/g6BWZGmt7XK9) */
  26912. requirePrivacyAuthorize(option: RequirePrivacyAuthorizeOption): void
  26913. /** [wx.reserveChannelsLive(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/channels/wx.reserveChannelsLive.html)
  26914. *
  26915. * 需要基础库: `2.19.0`
  26916. *
  26917. * 在插件中使用:不支持
  26918. *
  26919. * 预约视频号直播 */
  26920. reserveChannelsLive(option: ReserveChannelsLiveOption): void
  26921. /** [wx.restartMiniProgram(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/navigate/wx.restartMiniProgram.html)
  26922. *
  26923. * 需要基础库: `3.0.1`
  26924. *
  26925. * 在插件中使用:不支持
  26926. *
  26927. * 重启当前小程序 */
  26928. restartMiniProgram(option: RestartMiniProgramOption): void
  26929. /** [wx.revokeBufferURL(string url)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.revokeBufferURL.html)
  26930. *
  26931. * 需要基础库: `2.14.0`
  26932. *
  26933. * 在插件中使用:不支持
  26934. *
  26935. * 根据 URL 销毁存在内存中的数据 */
  26936. revokeBufferURL(
  26937. /** 需要销毁的二进制数据 URL */
  26938. url: string
  26939. ): void
  26940. /** [wx.saveFileToDisk(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/file/wx.saveFileToDisk.html)
  26941. *
  26942. * 需要基础库: `2.11.0`
  26943. *
  26944. * 在插件中使用:需要基础库 `2.15.0`
  26945. *
  26946. * 保存文件系统的文件到用户磁盘,仅在 PC 端支持
  26947. *
  26948. * **示例代码**
  26949. *
  26950. * ```js
  26951. wx.saveFileToDisk({
  26952. filePath: `${wx.env.USER_DATA_PATH}/hello.txt`,
  26953. success(res) {
  26954. console.log(res)
  26955. },
  26956. fail(res) {
  26957. console.error(res)
  26958. }
  26959. })
  26960. ``` */
  26961. saveFileToDisk(option: SaveFileToDiskOption): void
  26962. /** [wx.saveImageToPhotosAlbum(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.saveImageToPhotosAlbum.html)
  26963. *
  26964. * 需要基础库: `1.2.0`
  26965. *
  26966. * 在插件中使用:需要基础库 `1.9.6`
  26967. *
  26968. * 保存图片到系统相册。
  26969. *
  26970. * **示例代码**
  26971. *
  26972. * ```js
  26973. wx.saveImageToPhotosAlbum({
  26974. success(res) { }
  26975. })
  26976. ``` */
  26977. saveImageToPhotosAlbum<
  26978. T extends SaveImageToPhotosAlbumOption = SaveImageToPhotosAlbumOption
  26979. >(
  26980. option: T
  26981. ): PromisifySuccessResult<T, SaveImageToPhotosAlbumOption>
  26982. /** [wx.saveVideoToPhotosAlbum(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.saveVideoToPhotosAlbum.html)
  26983. *
  26984. * 需要基础库: `1.2.0`
  26985. *
  26986. * 在插件中使用:需要基础库 `1.9.6`
  26987. *
  26988. * 保存视频到系统相册。支持mp4视频格式。
  26989. *
  26990. * **示例代码**
  26991. *
  26992. * ```js
  26993. wx.saveVideoToPhotosAlbum({
  26994. filePath: 'wxfile://xxx',
  26995. success (res) {
  26996. console.log(res.errMsg)
  26997. }
  26998. })
  26999. ``` */
  27000. saveVideoToPhotosAlbum<
  27001. T extends SaveVideoToPhotosAlbumOption = SaveVideoToPhotosAlbumOption
  27002. >(
  27003. option: T
  27004. ): PromisifySuccessResult<T, SaveVideoToPhotosAlbumOption>
  27005. /** [wx.scanCode(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/scan/wx.scanCode.html)
  27006. *
  27007. * 需要基础库: `1.0.0`
  27008. *
  27009. * 在插件中使用:需要基础库 `1.9.6`
  27010. *
  27011. * 调起客户端扫码界面进行扫码
  27012. *
  27013. * **示例代码**
  27014. *
  27015. * ```js
  27016. // 允许从相机和相册扫码
  27017. wx.scanCode({
  27018. success (res) {
  27019. console.log(res)
  27020. }
  27021. })
  27022. // 只允许从相机扫码
  27023. wx.scanCode({
  27024. onlyFromCamera: true,
  27025. success (res) {
  27026. console.log(res)
  27027. }
  27028. })
  27029. ``` */
  27030. scanCode<T extends ScanCodeOption = ScanCodeOption>(
  27031. option: T
  27032. ): PromisifySuccessResult<T, ScanCodeOption>
  27033. /** [wx.seekBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.seekBackgroundAudio.html)
  27034. *
  27035. * 在插件中使用:需要基础库 `1.9.6`
  27036. * @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) 替换
  27037. *
  27038. * 控制音乐播放进度。
  27039. *
  27040. * **示例代码**
  27041. *
  27042. * ```js
  27043. wx.seekBackgroundAudio({
  27044. position: 30
  27045. })
  27046. ``` */
  27047. seekBackgroundAudio<
  27048. T extends SeekBackgroundAudioOption = SeekBackgroundAudioOption
  27049. >(
  27050. option: T
  27051. ): PromisifySuccessResult<T, SeekBackgroundAudioOption>
  27052. /** [wx.sendHCEMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc-hce/wx.sendHCEMessage.html)
  27053. *
  27054. * 需要基础库: `1.7.0`
  27055. *
  27056. * 在插件中使用:需要基础库 `2.1.0`
  27057. *
  27058. * 发送 NFC 消息。仅在安卓系统下有效。
  27059. *
  27060. * **示例代码**
  27061. *
  27062. * ```js
  27063. const buffer = new ArrayBuffer(1)
  27064. const dataView = new DataView(buffer)
  27065. dataView.setUint8(0, 0)
  27066. wx.startHCE({
  27067. success (res) {
  27068. wx.onHCEMessage(function(res) {
  27069. if (res.messageType === 1) {
  27070. wx.sendHCEMessage({data: buffer})
  27071. }
  27072. })
  27073. }
  27074. })
  27075. ``` */
  27076. sendHCEMessage<T extends SendHCEMessageOption = SendHCEMessageOption>(
  27077. option: T
  27078. ): PromisifySuccessResult<T, SendHCEMessageOption>
  27079. /** [wx.sendSms(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/sms/wx.sendSms.html)
  27080. *
  27081. * 需要基础库: `2.25.0`
  27082. *
  27083. * 在插件中使用:不支持
  27084. *
  27085. * 拉起手机发送短信界面。 */
  27086. sendSms(option: SendSmsOption): void
  27087. /** [wx.sendSocketMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/wx.sendSocketMessage.html)
  27088. *
  27089. * 在插件中使用:不支持
  27090. *
  27091. * @warning **推荐使用 [SocketTask](https://developers.weixin.qq.com/miniprogram/dev/api/network/websocket/SocketTask.html) 的方式去管理 webSocket 链接,每一条链路的生命周期都更加可控,同时存在多个 webSocket 的链接的情况下使用 wx 前缀的方法可能会带来一些和预期不一致的情况。**
  27092. *
  27093. * 通过 WebSocket 连接发送数据。需要先 wx.connectSocket,并在 wx.onSocketOpen 回调之后才能发送。
  27094. *
  27095. * **示例代码**
  27096. *
  27097. * ```js
  27098. let socketOpen = false
  27099. let socketMsgQueue = []
  27100. wx.connectSocket({
  27101. url: 'test.php'
  27102. })
  27103. wx.onSocketOpen(function(res) {
  27104. socketOpen = true
  27105. for (let i = 0; i < socketMsgQueue.length; i++){
  27106. sendSocketMessage(socketMsgQueue[i])
  27107. }
  27108. socketMsgQueue = []
  27109. })
  27110. function sendSocketMessage(msg) {
  27111. if (socketOpen) {
  27112. wx.sendSocketMessage({
  27113. data:msg
  27114. })
  27115. } else {
  27116. socketMsgQueue.push(msg)
  27117. }
  27118. }
  27119. ``` */
  27120. sendSocketMessage<
  27121. T extends SendSocketMessageOption = SendSocketMessageOption
  27122. >(
  27123. option: T
  27124. ): PromisifySuccessResult<T, SendSocketMessageOption>
  27125. /** [wx.setBLEMTU(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.setBLEMTU.html)
  27126. *
  27127. * 需要基础库: `2.11.0`
  27128. *
  27129. * 在插件中使用:需要基础库 `2.11.0`
  27130. *
  27131. * 协商设置蓝牙低功耗的最大传输单元 (Maximum Transmission Unit, MTU)。需在 [wx.createBLEConnection](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.createBLEConnection.html) 调用成功后调用。仅安卓系统 5.1 以上版本有效,iOS 因系统限制不支持。 */
  27132. setBLEMTU<T extends SetBLEMTUOption = SetBLEMTUOption>(
  27133. option: T
  27134. ): PromisifySuccessResult<T, SetBLEMTUOption>
  27135. /** [wx.setBackgroundColor(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/background/wx.setBackgroundColor.html)
  27136. *
  27137. * 需要基础库: `2.1.0`
  27138. *
  27139. * 在插件中使用:需要基础库 `2.4.0`
  27140. *
  27141. * 在插件中使用时,只能在当前插件的页面中调用
  27142. *
  27143. * 动态设置窗口的背景色
  27144. *
  27145. * **示例代码**
  27146. *
  27147. * ```js
  27148. wx.setBackgroundColor({
  27149. backgroundColor: '#ffffff', // 窗口的背景色为白色
  27150. })
  27151. wx.setBackgroundColor({
  27152. backgroundColorTop: '#ffffff', // 顶部窗口的背景色为白色
  27153. backgroundColorBottom: '#ffffff', // 底部窗口的背景色为白色
  27154. })
  27155. ``` */
  27156. setBackgroundColor<
  27157. T extends SetBackgroundColorOption = SetBackgroundColorOption
  27158. >(
  27159. option: T
  27160. ): PromisifySuccessResult<T, SetBackgroundColorOption>
  27161. /** [wx.setBackgroundFetchToken(object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/background-fetch/wx.setBackgroundFetchToken.html)
  27162. *
  27163. * 需要基础库: `2.8.0`
  27164. *
  27165. * 在插件中使用:不支持
  27166. *
  27167. * 设置自定义登录态,在周期性拉取数据时带上,便于第三方服务器验证请求合法性 */
  27168. setBackgroundFetchToken<
  27169. T extends SetBackgroundFetchTokenOption = SetBackgroundFetchTokenOption
  27170. >(
  27171. option: T
  27172. ): PromisifySuccessResult<T, SetBackgroundFetchTokenOption>
  27173. /** [wx.setBackgroundTextStyle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/background/wx.setBackgroundTextStyle.html)
  27174. *
  27175. * 需要基础库: `2.1.0`
  27176. *
  27177. * 在插件中使用:需要基础库 `2.4.0`
  27178. *
  27179. * 在插件中使用时,只能在当前插件的页面中调用
  27180. *
  27181. * 动态设置下拉背景字体、loading 图的样式
  27182. *
  27183. * **示例代码**
  27184. *
  27185. * ```js
  27186. wx.setBackgroundTextStyle({
  27187. textStyle: 'dark' // 下拉背景字体、loading 图的样式为dark
  27188. })
  27189. ``` */
  27190. setBackgroundTextStyle<
  27191. T extends SetBackgroundTextStyleOption = SetBackgroundTextStyleOption
  27192. >(
  27193. option: T
  27194. ): PromisifySuccessResult<T, SetBackgroundTextStyleOption>
  27195. /** [wx.setClipboardData(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/clipboard/wx.setClipboardData.html)
  27196. *
  27197. * 需要基础库: `1.1.0`
  27198. *
  27199. * 在插件中使用:需要基础库 `1.9.6`
  27200. *
  27201. * 设置系统剪贴板的内容。调用成功后,会弹出 toast 提示"内容已复制",持续 1.5s
  27202. *
  27203. * **示例代码**
  27204. *
  27205. * ```js
  27206. wx.setClipboardData({
  27207. data: 'data',
  27208. success (res) {
  27209. wx.getClipboardData({
  27210. success (res) {
  27211. console.log(res.data) // data
  27212. }
  27213. })
  27214. }
  27215. })
  27216. ``` */
  27217. setClipboardData<
  27218. T extends SetClipboardDataOption = SetClipboardDataOption
  27219. >(
  27220. option: T
  27221. ): PromisifySuccessResult<T, SetClipboardDataOption>
  27222. /** [wx.setEnable1v1Chat(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.setEnable1v1Chat.html)
  27223. *
  27224. * 需要基础库: `2.20.1`
  27225. *
  27226. * 在插件中使用:不支持
  27227. *
  27228. * 开启双人通话。设置 `enable` 为 `false` 时,无法接听呼叫。 */
  27229. setEnable1v1Chat(option: SetEnable1v1ChatOption): void
  27230. /** [wx.setEnableDebug(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html)
  27231. *
  27232. * 需要基础库: `1.4.0`
  27233. *
  27234. * 在插件中使用:不支持
  27235. *
  27236. * 设置是否打开调试开关。此开关对正式版也能生效。
  27237. *
  27238. * **示例代码**
  27239. *
  27240. * ```javascript
  27241. // 打开调试
  27242. wx.setEnableDebug({
  27243. enableDebug: true
  27244. })
  27245. // 关闭调试
  27246. wx.setEnableDebug({
  27247. enableDebug: false
  27248. })
  27249. ```
  27250. *
  27251. * **Tips**
  27252. *
  27253. * - 在正式版打开调试还有一种方法,就是先在开发版或体验版打开调试,再切到正式版就能看到vConsole。 */
  27254. setEnableDebug<T extends SetEnableDebugOption = SetEnableDebugOption>(
  27255. option: T
  27256. ): PromisifySuccessResult<T, SetEnableDebugOption>
  27257. /** [wx.setInnerAudioOption(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.setInnerAudioOption.html)
  27258. *
  27259. * 需要基础库: `2.3.0`
  27260. *
  27261. * 在插件中使用:需要基础库 `2.10.0`
  27262. *
  27263. * 设置 [InnerAudioContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/InnerAudioContext.html) 的播放选项。设置之后对当前小程序全局生效。
  27264. *
  27265. * ****
  27266. *
  27267. * ## 注意事项
  27268. * - 为保证微信整体体验,speakerOn 为 true 时,客户端会忽略 mixWithOthers 参数的内容,强制与其它音频互斥
  27269. * - 不支持在播放音频的过程中切换为扬声器播放,开发者如需切换可以先暂停当前播放的音频并记录下当前暂停的时间点,然后切换后重新从原来暂停的时间点开始播放音频
  27270. * - 目前 wx.setInnerAudioOption 接口不兼容 wx.createWebAudioContext 接口,也不兼容 wx.createInnerAudioContext 开启 useWebAudioImplement 的情况,将在后续版本中支持 */
  27271. setInnerAudioOption<
  27272. T extends SetInnerAudioOption = SetInnerAudioOption
  27273. >(
  27274. option: T
  27275. ): PromisifySuccessResult<T, SetInnerAudioOption>
  27276. /** [wx.setKeepScreenOn(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.setKeepScreenOn.html)
  27277. *
  27278. * 需要基础库: `1.4.0`
  27279. *
  27280. * 在插件中使用:需要基础库 `1.9.6`
  27281. *
  27282. * 设置是否保持常亮状态。仅在当前小程序生效,离开小程序后设置失效。
  27283. *
  27284. * **示例代码**
  27285. *
  27286. * ```js
  27287. wx.setKeepScreenOn({
  27288. keepScreenOn: true
  27289. })
  27290. ``` */
  27291. setKeepScreenOn<
  27292. T extends SetKeepScreenOnOption = SetKeepScreenOnOption
  27293. >(
  27294. option: T
  27295. ): PromisifySuccessResult<T, SetKeepScreenOnOption>
  27296. /** [wx.setNavigationBarColor(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.setNavigationBarColor.html)
  27297. *
  27298. * 需要基础库: `1.4.0`
  27299. *
  27300. * 在插件中使用:需要基础库 `2.1.0`
  27301. *
  27302. * 在插件中使用时,只能在当前插件的页面中调用
  27303. *
  27304. * 设置页面导航条颜色 */
  27305. setNavigationBarColor<
  27306. T extends SetNavigationBarColorOption = SetNavigationBarColorOption
  27307. >(
  27308. option: T
  27309. ): PromisifySuccessResult<T, SetNavigationBarColorOption>
  27310. /** [wx.setNavigationBarTitle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.setNavigationBarTitle.html)
  27311. *
  27312. * 在插件中使用:需要基础库 `2.1.0`
  27313. *
  27314. * 在插件中使用时,只能在当前插件的页面中调用
  27315. *
  27316. * 动态设置当前页面的标题
  27317. *
  27318. * **示例代码**
  27319. *
  27320. * ```js
  27321. wx.setNavigationBarTitle({
  27322. title: '当前页面'
  27323. })
  27324. ``` */
  27325. setNavigationBarTitle<
  27326. T extends SetNavigationBarTitleOption = SetNavigationBarTitleOption
  27327. >(
  27328. option: T
  27329. ): PromisifySuccessResult<T, SetNavigationBarTitleOption>
  27330. /** [wx.setScreenBrightness(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.setScreenBrightness.html)
  27331. *
  27332. * 需要基础库: `1.2.0`
  27333. *
  27334. * 在插件中使用:需要基础库 `1.9.6`
  27335. *
  27336. * 设置屏幕亮度 */
  27337. setScreenBrightness<
  27338. T extends SetScreenBrightnessOption = SetScreenBrightnessOption
  27339. >(
  27340. option: T
  27341. ): PromisifySuccessResult<T, SetScreenBrightnessOption>
  27342. /** [wx.setStorage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorage.html)
  27343. *
  27344. * 在插件中使用:需要基础库 `1.9.6`
  27345. *
  27346. * 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
  27347. *
  27348. * **示例代码**
  27349. *
  27350. * ```js
  27351. wx.setStorage({
  27352. key:"key",
  27353. data:"value"
  27354. })
  27355. ```
  27356. *
  27357. * ```js
  27358. // 开启加密存储
  27359. wx.setStorage({
  27360. key: "key",
  27361. data: "value",
  27362. encrypt: true, // 若开启加密存储,setStorage 和 getStorage 需要同时声明 encrypt 的值为 true
  27363. success() {
  27364. wx.getStorage({
  27365. key: "key",
  27366. encrypt: true, // 若开启加密存储,setStorage 和 getStorage 需要同时声明 encrypt 的值为 true
  27367. success(res) {
  27368. console.log(res.data)
  27369. }
  27370. })
  27371. }
  27372. })
  27373. ``` */
  27374. setStorage<
  27375. T = any,
  27376. U extends SetStorageOption<T> = SetStorageOption<T>
  27377. >(
  27378. option: U
  27379. ): PromisifySuccessResult<U, SetStorageOption<T>>
  27380. /** [wx.setStorageSync(string key, any data)](https://developers.weixin.qq.com/miniprogram/dev/api/storage/wx.setStorageSync.html)
  27381. *
  27382. * 在插件中使用:需要基础库 `1.9.6`
  27383. *
  27384. * 将数据存储在本地缓存中指定的 key 中。会覆盖掉原来该 key 对应的内容。除非用户主动删除或因存储空间原因被系统清理,否则数据都一直可用。单个 key 允许存储的最大数据长度为 1MB,所有数据存储上限为 10MB。
  27385. *
  27386. * **注意**
  27387. *
  27388. * storage 应只用来进行数据的持久化存储,不应用于运行时的数据传递或全局状态管理。启动过程中过多的同步读写存储,会显著影响启动耗时。
  27389. *
  27390. * **示例代码**
  27391. *
  27392. * ```js
  27393. try {
  27394. wx.setStorageSync('key', 'value')
  27395. } catch (e) { }
  27396. ``` */
  27397. setStorageSync<T = any>(
  27398. /** 本地缓存中指定的 key */
  27399. key: string,
  27400. /** 需要存储的内容。只支持原生类型、Date、及能够通过`JSON.stringify`序列化的对象。 */
  27401. data: T
  27402. ): void
  27403. /** [wx.setTabBarBadge(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.setTabBarBadge.html)
  27404. *
  27405. * 需要基础库: `1.9.0`
  27406. *
  27407. * 在插件中使用:不支持
  27408. *
  27409. * 为 tabBar 某一项的右上角添加文本
  27410. *
  27411. * **示例代码**
  27412. *
  27413. * ```js
  27414. wx.setTabBarBadge({
  27415. index: 0,
  27416. text: '1'
  27417. })
  27418. ``` */
  27419. setTabBarBadge<T extends SetTabBarBadgeOption = SetTabBarBadgeOption>(
  27420. option: T
  27421. ): PromisifySuccessResult<T, SetTabBarBadgeOption>
  27422. /** [wx.setTabBarItem(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.setTabBarItem.html)
  27423. *
  27424. * 需要基础库: `1.9.0`
  27425. *
  27426. * 在插件中使用:不支持
  27427. *
  27428. * 动态设置 tabBar 某一项的内容,`2.7.0` 起图片支持临时文件和网络文件。
  27429. *
  27430. * **示例代码**
  27431. *
  27432. * ```js
  27433. wx.setTabBarItem({
  27434. index: 0,
  27435. text: 'text',
  27436. iconPath: '/path/to/iconPath',
  27437. selectedIconPath: '/path/to/selectedIconPath'
  27438. })
  27439. ``` */
  27440. setTabBarItem<T extends SetTabBarItemOption = SetTabBarItemOption>(
  27441. option: T
  27442. ): PromisifySuccessResult<T, SetTabBarItemOption>
  27443. /** [wx.setTabBarStyle(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.setTabBarStyle.html)
  27444. *
  27445. * 需要基础库: `1.9.0`
  27446. *
  27447. * 在插件中使用:不支持
  27448. *
  27449. * 动态设置 tabBar 的整体样式
  27450. *
  27451. * **示例代码**
  27452. *
  27453. * ```js
  27454. wx.setTabBarStyle({
  27455. color: '#FF0000',
  27456. selectedColor: '#00FF00',
  27457. backgroundColor: '#0000FF',
  27458. borderStyle: 'white'
  27459. })
  27460. ``` */
  27461. setTabBarStyle<T extends SetTabBarStyleOption = SetTabBarStyleOption>(
  27462. option?: T
  27463. ): PromisifySuccessResult<T, SetTabBarStyleOption>
  27464. /** [wx.setTopBarText(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/sticky/wx.setTopBarText.html)
  27465. *
  27466. * 需要基础库: `1.4.3`
  27467. *
  27468. * 在插件中使用:不支持
  27469. * @deprecated 基础库版本 [1.9.9](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃
  27470. *
  27471. * 动态设置置顶栏文字内容。只有当前小程序被置顶时能生效,如果当前小程序没有被置顶,也能调用成功,但是不会立即生效,只有在用户将这个小程序置顶后才换上设置的文字内容.
  27472. *
  27473. * **示例代码**
  27474. *
  27475. * ```js
  27476. wx.setTopBarText({
  27477. text: 'hello, world!'
  27478. })
  27479. ```
  27480. *
  27481. * **注意**
  27482. *
  27483. * - 调用成功后,需间隔 5s 才能再次调用此接口,如果在 5s 内再次调用此接口,会回调 fail,errMsg:"setTopBarText: fail invoke too frequently" */
  27484. setTopBarText<T extends SetTopBarTextOption = SetTopBarTextOption>(
  27485. option: T
  27486. ): PromisifySuccessResult<T, SetTopBarTextOption>
  27487. /** [wx.setVisualEffectOnCapture(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.setVisualEffectOnCapture.html)
  27488. *
  27489. * 需要基础库: `2.20.1`
  27490. *
  27491. * 在插件中使用:需要基础库 `2.21.3`
  27492. *
  27493. * 设置截屏/录屏时屏幕表现,仅支持在 Android 端调用 */
  27494. setVisualEffectOnCapture(option: SetVisualEffectOnCaptureOption): void
  27495. /** [wx.setWifiList(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.setWifiList.html)
  27496. *
  27497. * 需要基础库: `1.6.0`
  27498. *
  27499. * 在插件中使用:需要基础库 `2.9.1`
  27500. *
  27501. * 设置 `wifiList` 中 AP 的相关信息。在 `onGetWifiList` 回调后调用,**iOS特有接口**。
  27502. *
  27503. * **注意**
  27504. *
  27505. * - 该接口只能在 `onGetWifiList` 回调之后才能调用。
  27506. * - 此时客户端会挂起,等待小程序设置 Wi-Fi 信息,请务必尽快调用该接口,若无数据请传入一个空数组。
  27507. * - 有可能随着周边 Wi-Fi 列表的刷新,单个流程内收到多次带有存在重复的 Wi-Fi 列表的回调。
  27508. *
  27509. * **示例代码**
  27510. *
  27511. * ```js
  27512. wx.onGetWifiList(function(res) {
  27513. if (res.wifiList.length) {
  27514. wx.setWifiList({
  27515. wifiList: [{
  27516. SSID: res.wifiList[0].SSID,
  27517. BSSID: res.wifiList[0].BSSID,
  27518. password: '123456'
  27519. }]
  27520. })
  27521. } else {
  27522. wx.setWifiList({
  27523. wifiList: []
  27524. })
  27525. }
  27526. })
  27527. wx.getWifiList()
  27528. ``` */
  27529. setWifiList<T extends SetWifiListOption = SetWifiListOption>(
  27530. option: T
  27531. ): PromisifySuccessResult<T, SetWifiListOption>
  27532. /** [wx.setWindowSize(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.setWindowSize.html)
  27533. *
  27534. * 需要基础库: `2.10.1`
  27535. *
  27536. * 在插件中使用:不支持
  27537. * @deprecated 基础库版本 [2.11.0](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html) 起已废弃
  27538. *
  27539. * 设置窗口大小,该接口仅适用于 PC 平台,使用细则请参见指南 */
  27540. setWindowSize(option: SetWindowSizeOption): void
  27541. /** [wx.shareFileMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.shareFileMessage.html)
  27542. *
  27543. * 需要基础库: `2.16.1`
  27544. *
  27545. * 在插件中使用:不支持
  27546. *
  27547. * 转发文件到聊天 */
  27548. shareFileMessage<
  27549. T extends ShareFileMessageOption = ShareFileMessageOption
  27550. >(
  27551. option: T
  27552. ): PromisifySuccessResult<T, ShareFileMessageOption>
  27553. /** [wx.shareToWeRun(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.shareToWeRun.html)
  27554. *
  27555. * 在插件中使用:不支持
  27556. *
  27557. * 分享数据到微信运动。 */
  27558. shareToWeRun<T extends ShareToWeRunOption = ShareToWeRunOption>(
  27559. option: T
  27560. ): PromisifySuccessResult<T, ShareToWeRunOption>
  27561. /** [wx.shareVideoMessage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.shareVideoMessage.html)
  27562. *
  27563. * 需要基础库: `2.16.1`
  27564. *
  27565. * 在插件中使用:不支持
  27566. *
  27567. * 转发视频到聊天 */
  27568. shareVideoMessage<
  27569. T extends ShareVideoMessageOption = ShareVideoMessageOption
  27570. >(
  27571. option: T
  27572. ): PromisifySuccessResult<T, ShareVideoMessageOption>
  27573. /** [wx.showActionSheet(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showActionSheet.html)
  27574. *
  27575. * 在插件中使用:需要基础库 `1.9.6`
  27576. *
  27577. * 显示操作菜单
  27578. *
  27579. * **示例代码**
  27580. *
  27581. * ```js
  27582. wx.showActionSheet({
  27583. itemList: ['A', 'B', 'C'],
  27584. success (res) {
  27585. console.log(res.tapIndex)
  27586. },
  27587. fail (res) {
  27588. console.log(res.errMsg)
  27589. }
  27590. })
  27591. ```
  27592. *
  27593. * **注意**
  27594. *
  27595. * - Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel";
  27596. * - Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑 */
  27597. showActionSheet<
  27598. T extends ShowActionSheetOption = ShowActionSheetOption
  27599. >(
  27600. option: T
  27601. ): PromisifySuccessResult<T, ShowActionSheetOption>
  27602. /** [wx.showLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showLoading.html)
  27603. *
  27604. * 需要基础库: `1.1.0`
  27605. *
  27606. * 在插件中使用:需要基础库 `1.9.6`
  27607. *
  27608. * 显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框
  27609. *
  27610. * **示例代码**
  27611. *
  27612. * ```js
  27613. wx.showLoading({
  27614. title: '加载中',
  27615. })
  27616. setTimeout(function () {
  27617. wx.hideLoading()
  27618. }, 2000)
  27619. ```
  27620. *
  27621. * **注意**
  27622. *
  27623. * - [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) 同时只能显示一个
  27624. * - [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) 配对使用 */
  27625. showLoading<T extends ShowLoadingOption = ShowLoadingOption>(
  27626. option: T
  27627. ): PromisifySuccessResult<T, ShowLoadingOption>
  27628. /** [wx.showModal(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showModal.html)
  27629. *
  27630. * 在插件中使用:需要基础库 `1.9.6`
  27631. *
  27632. * 显示模态对话框
  27633. *
  27634. * **示例代码**
  27635. *
  27636. * ```js
  27637. wx.showModal({
  27638. title: '提示',
  27639. content: '这是一个模态弹窗',
  27640. success (res) {
  27641. if (res.confirm) {
  27642. console.log('用户点击确定')
  27643. } else if (res.cancel) {
  27644. console.log('用户点击取消')
  27645. }
  27646. }
  27647. })
  27648. ```
  27649. *
  27650. * **注意**
  27651. *
  27652. * - Android 6.7.2 以下版本,点击取消或蒙层时,回调 fail, errMsg 为 "fail cancel";
  27653. * - Android 6.7.2 及以上版本 和 iOS 点击蒙层不会关闭模态弹窗,所以尽量避免使用「取消」分支中实现业务逻辑
  27654. * - 自基础库 2.17.1 版本起,支持传入 editable 参数,显示带输入框的弹窗 */
  27655. showModal<T extends ShowModalOption = ShowModalOption>(
  27656. option: T
  27657. ): PromisifySuccessResult<T, ShowModalOption>
  27658. /** [wx.showNavigationBarLoading(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/navigation-bar/wx.showNavigationBarLoading.html)
  27659. *
  27660. * 在插件中使用:需要基础库 `2.1.0`
  27661. *
  27662. * 在插件中使用时,只能在当前插件的页面中调用
  27663. *
  27664. * 在当前页面显示导航条加载动画 */
  27665. showNavigationBarLoading<
  27666. T extends ShowNavigationBarLoadingOption = ShowNavigationBarLoadingOption
  27667. >(
  27668. option?: T
  27669. ): PromisifySuccessResult<T, ShowNavigationBarLoadingOption>
  27670. /** [wx.showRedPackage(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/redpackage/wx.showRedPackage.html)
  27671. *
  27672. * 需要基础库: `2.10.0`
  27673. *
  27674. * 在插件中使用:不支持
  27675. *
  27676. * 拉取h5领取红包封面页。获取参考红包封面地址参考 [微信红包封面开发平台](https://cover.weixin.qq.com/cgi-bin/mmcover-bin/readtemplate?t=page/index#/doc?page=introduce)。 */
  27677. showRedPackage<T extends ShowRedPackageOption = ShowRedPackageOption>(
  27678. option: T
  27679. ): PromisifySuccessResult<T, ShowRedPackageOption>
  27680. /** [wx.showShareImageMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.showShareImageMenu.html)
  27681. *
  27682. * 需要基础库: `2.14.3`
  27683. *
  27684. * 在插件中使用:需要基础库 `2.16.0`
  27685. *
  27686. * 打开分享图片弹窗,可以将图片发送给朋友、收藏或下载 */
  27687. showShareImageMenu<
  27688. T extends ShowShareImageMenuOption = ShowShareImageMenuOption
  27689. >(
  27690. option: T
  27691. ): PromisifySuccessResult<T, ShowShareImageMenuOption>
  27692. /** [wx.showShareMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.showShareMenu.html)
  27693. *
  27694. * 需要基础库: `1.1.0`
  27695. *
  27696. * 在插件中使用:需要基础库 `2.1.0`
  27697. *
  27698. * 在插件中使用时,只能在当前插件的页面中调用
  27699. *
  27700. * 显示当前页面的转发按钮
  27701. *
  27702. * ****
  27703. *
  27704. * ## 注意事项
  27705. * - "shareAppMessage"表示“发送给朋友”按钮,"shareTimeline"表示“分享到朋友圈”按钮
  27706. * - 显示“分享到朋友圈”按钮时必须同时显示“发送给朋友”按钮,显示“发送给朋友”按钮时则允许不显示“分享到朋友圈”按钮
  27707. *
  27708. * **示例代码**
  27709. *
  27710. * ```js
  27711. wx.showShareMenu({
  27712. withShareTicket: true,
  27713. menus: ['shareAppMessage', 'shareTimeline']
  27714. })
  27715. ``` */
  27716. showShareMenu<T extends ShowShareMenuOption = ShowShareMenuOption>(
  27717. option: T
  27718. ): PromisifySuccessResult<T, ShowShareMenuOption>
  27719. /** [wx.showTabBar(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBar.html)
  27720. *
  27721. * 需要基础库: `1.9.0`
  27722. *
  27723. * 在插件中使用:不支持
  27724. *
  27725. * 显示 tabBar */
  27726. showTabBar<T extends ShowTabBarOption = ShowTabBarOption>(
  27727. option: T
  27728. ): PromisifySuccessResult<T, ShowTabBarOption>
  27729. /** [wx.showTabBarRedDot(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/tab-bar/wx.showTabBarRedDot.html)
  27730. *
  27731. * 需要基础库: `1.9.0`
  27732. *
  27733. * 在插件中使用:不支持
  27734. *
  27735. * 显示 tabBar 某一项的右上角的红点 */
  27736. showTabBarRedDot<
  27737. T extends ShowTabBarRedDotOption = ShowTabBarRedDotOption
  27738. >(
  27739. option: T
  27740. ): PromisifySuccessResult<T, ShowTabBarRedDotOption>
  27741. /** [wx.showToast(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/interaction/wx.showToast.html)
  27742. *
  27743. * 在插件中使用:需要基础库 `1.9.6`
  27744. *
  27745. * 显示消息提示框
  27746. *
  27747. * **示例代码**
  27748. *
  27749. * ```js
  27750. wx.showToast({
  27751. title: '成功',
  27752. icon: 'success',
  27753. duration: 2000
  27754. })
  27755. ```
  27756. *
  27757. * **注意**
  27758. *
  27759. * - [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) 同时只能显示一个
  27760. * - [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) 配对使用 */
  27761. showToast<T extends ShowToastOption = ShowToastOption>(
  27762. option: T
  27763. ): PromisifySuccessResult<T, ShowToastOption>
  27764. /** [wx.startAccelerometer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.startAccelerometer.html)
  27765. *
  27766. * 需要基础库: `1.1.0`
  27767. *
  27768. * 在插件中使用:需要基础库 `1.9.6`
  27769. *
  27770. * 开始监听加速度数据。
  27771. *
  27772. * **示例代码**
  27773. *
  27774. * ```js
  27775. wx.startAccelerometer({
  27776. interval: 'game'
  27777. })
  27778. ```
  27779. *
  27780. * **注意**
  27781. *
  27782. * - 根据机型性能、当前 CPU 与内存的占用情况,`interval` 的设置与实际 `wx.onAccelerometerChange()` 回调函数的执行频率会有一些出入。 */
  27783. startAccelerometer<
  27784. T extends StartAccelerometerOption = StartAccelerometerOption
  27785. >(
  27786. option?: T
  27787. ): PromisifySuccessResult<T, StartAccelerometerOption>
  27788. /** [wx.startBeaconDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.startBeaconDiscovery.html)
  27789. *
  27790. * 需要基础库: `1.2.0`
  27791. *
  27792. * 在插件中使用:需要基础库 `1.9.6`
  27793. *
  27794. * 开始搜索附近的 Beacon 设备
  27795. *
  27796. * **示例代码**
  27797. *
  27798. * ```js
  27799. wx.startBeaconDiscovery({
  27800. success(res) { }
  27801. })
  27802. ``` */
  27803. startBeaconDiscovery<
  27804. T extends StartBeaconDiscoveryOption = StartBeaconDiscoveryOption
  27805. >(
  27806. option: T
  27807. ): PromisifySuccessResult<T, StartBeaconDiscoveryOption>
  27808. /** [wx.startBluetoothDevicesDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.startBluetoothDevicesDiscovery.html)
  27809. *
  27810. * 需要基础库: `1.1.0`
  27811. *
  27812. * 在插件中使用:需要基础库 `1.9.6`
  27813. *
  27814. * 开始搜寻附近的蓝牙外围设备。
  27815. *
  27816. * **此操作比较耗费系统资源,请在搜索到需要的设备后及时调用 [wx.stopBluetoothDevicesDiscovery](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.stopBluetoothDevicesDiscovery.html) 停止搜索。**
  27817. *
  27818. * **注意**
  27819. *
  27820. * - 考虑到蓝牙功能可以间接进行定位,安卓 6.0 及以上版本,无定位权限或定位开关未打开时,无法进行设备搜索。这种情况下,安卓 8.0.16 前,接口调用成功但无法扫描设备;8.0.16 及以上版本,会返回错误。
  27821. *
  27822. * **示例代码**
  27823. *
  27824. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/m7klFDmZ72i1)
  27825. *
  27826. * ```js
  27827. // 以微信硬件平台的蓝牙智能灯为例,主服务的 UUID 是 FEE7。传入这个参数,只搜索主服务 UUID 为 FEE7 的设备
  27828. wx.startBluetoothDevicesDiscovery({
  27829. services: ['FEE7'],
  27830. success (res) {
  27831. console.log(res)
  27832. }
  27833. })
  27834. ``` */
  27835. startBluetoothDevicesDiscovery<
  27836. T extends StartBluetoothDevicesDiscoveryOption = StartBluetoothDevicesDiscoveryOption
  27837. >(
  27838. option: T
  27839. ): PromisifySuccessResult<T, StartBluetoothDevicesDiscoveryOption>
  27840. /** [wx.startCompass(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.startCompass.html)
  27841. *
  27842. * 需要基础库: `1.1.0`
  27843. *
  27844. * 在插件中使用:需要基础库 `1.9.6`
  27845. *
  27846. * 开始监听罗盘数据
  27847. *
  27848. * **示例代码**
  27849. *
  27850. * ```js
  27851. wx.startCompass()
  27852. ``` */
  27853. startCompass<T extends StartCompassOption = StartCompassOption>(
  27854. option?: T
  27855. ): PromisifySuccessResult<T, StartCompassOption>
  27856. /** [wx.startDeviceMotionListening(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.startDeviceMotionListening.html)
  27857. *
  27858. * 需要基础库: `2.3.0`
  27859. *
  27860. * 在插件中使用:需要基础库 `2.9.1`
  27861. *
  27862. * 开始监听设备方向的变化。 */
  27863. startDeviceMotionListening<
  27864. T extends StartDeviceMotionListeningOption = StartDeviceMotionListeningOption
  27865. >(
  27866. option?: T
  27867. ): PromisifySuccessResult<T, StartDeviceMotionListeningOption>
  27868. /** [wx.startGyroscope(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.startGyroscope.html)
  27869. *
  27870. * 需要基础库: `2.3.0`
  27871. *
  27872. * 在插件中使用:需要基础库 `2.9.1`
  27873. *
  27874. * 开始监听陀螺仪数据。 */
  27875. startGyroscope<T extends StartGyroscopeOption = StartGyroscopeOption>(
  27876. option?: T
  27877. ): PromisifySuccessResult<T, StartGyroscopeOption>
  27878. /** [wx.startHCE(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc-hce/wx.startHCE.html)
  27879. *
  27880. * 需要基础库: `1.7.0`
  27881. *
  27882. * 在插件中使用:需要基础库 `2.1.0`
  27883. *
  27884. * 初始化 NFC 模块。(HCE 模式仅安卓支持)
  27885. *
  27886. * **示例代码**
  27887. *
  27888. * ```js
  27889. wx.startHCE({
  27890. aid_list: ['F222222222'],
  27891. success (res) {
  27892. console.log(res.errMsg)
  27893. }
  27894. })
  27895. ``` */
  27896. startHCE<T extends StartHCEOption = StartHCEOption>(
  27897. option: T
  27898. ): PromisifySuccessResult<T, StartHCEOption>
  27899. /** [wx.startLocalServiceDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.startLocalServiceDiscovery.html)
  27900. *
  27901. * 需要基础库: `2.4.0`
  27902. *
  27903. * 在插件中使用:需要基础库 `2.15.0`
  27904. *
  27905. * 开始搜索局域网下的 mDNS 服务。搜索的结果会通过 wx.onLocalService* 事件返回。
  27906. *
  27907. * **注意**
  27908. *
  27909. * 1. 由于操作系统相关能力变更,iOS 微信客户端 7.0.18 及以上版本无法使用 mDNS 相关接口,安卓版本不受影响
  27910. * 2. wx.startLocalServiceDiscovery 是一个消耗性能的行为,开始 30 秒后会自动 stop 并执行 wx.onLocalServiceDiscoveryStop 注册的回调函数。
  27911. * 3. 在调用 wx.startLocalServiceDiscovery 后,在这次搜索行为停止后才能发起下次 wx.startLocalServiceDiscovery。停止本次搜索行为的操作包括调用 wx.stopLocalServiceDiscovery 和 30 秒后系统自动 stop 本次搜索。 */
  27912. startLocalServiceDiscovery<
  27913. T extends StartLocalServiceDiscoveryOption = StartLocalServiceDiscoveryOption
  27914. >(
  27915. option: T
  27916. ): PromisifySuccessResult<T, StartLocalServiceDiscoveryOption>
  27917. /** [wx.startLocationUpdate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdate.html)
  27918. *
  27919. * 需要基础库: `2.8.0`
  27920. *
  27921. * 在插件中使用:需要基础库 `2.8.0`
  27922. *
  27923. * 开启小程序进入前台时接收位置消息。
  27924. * ## 使用方法
  27925. * 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
  27926. *
  27927. * ## 申请开通
  27928. * 暂只针对如下类目的小程序开放,需要先通过类目审核,再在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。从2022年7月14日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
  27929. *
  27930. * ### 国内主体开放类目
  27931. *
  27932. * | 一级类目/主体类型 | 二级类目 | 应用场景 |
  27933. * | -------------- | -------| -------- |
  27934. * | 电商平台 | / | 售卖商品线下发货、收货、送货服务 |
  27935. * | 商家自营 | / | 提供售卖商品线下发货、收货、送货服务、线下商超导览、导航服务 |
  27936. * | 医疗服务 | 公立医疗机构、三级私立医疗机构、其他私立医疗机构、就医服务、其他医学健康服务、药品(非处方药)销售、非处方药销售平台、医疗器械生产企业、医疗器械自营、医疗器械经营销售平台、互联网医院血液、干细胞服务、临床试验 | 1、实际物品/药品接收服务 2、基于地理位置取号并现场报到、附近医院导航等服务 |
  27937. * | 交通服务 | / | 代驾服务、租车网点导航等相关服务 |
  27938. * | 生活服务 | / | 上门服务作业等线下场景 |
  27939. * | 物流服务 | 收件/派件、查件、邮政、装卸搬运、快递柜、货物运输 | 快递/货物收发服务 |
  27940. * | 餐饮服务 | 点餐平台、外卖平台 | 线下送餐服务 |
  27941. * | 工具 | 天气、信息查询 | 与地理位置相关的服务,比如潮汐查询、海拔查询、天气查询等 |
  27942. * | 金融 | 保险 | 提供线下网点预约、基于地理位置取号并现场报到、附近网点导航等服务 |
  27943. * | 旅游 | 景区服务 | 提供景区导航、导览服务 |
  27944. * | 政务民生 | / | 提供政务单位相关业务 |
  27945. * | 政府主体账号 | / | 提供政务单位相关业务 |
  27946. *
  27947. * ### 海外主体开放类目
  27948. * | 一级类目/主体类型 | 二级类目 | 应用场景 |
  27949. * | -------------- | -------| -------- |
  27950. * | 出行与交通 | / | 代驾服务、租车网点导航等相关服务 |
  27951. * | 快递业与邮政 | / | 快递/货物收发服务 |
  27952. * | 餐饮 | / | 线下送餐服务 |
  27953. * | 电商平台 | / | 售卖商品线下发货、线下收货服务 |
  27954. * | 出行与交通 | / | 代驾服务、租车网点导航等相关服务 |
  27955. * | 跨境电商 | / | 提供售卖商品线下发货、收货服务、线下商超导览、导航服务 |
  27956. * | 本地服务 | 服装/鞋/箱包、玩具、家电/数码/手机、美妆/洗护、珠宝/饰品/眼镜/钟表、运动/户外/乐器、鲜花/园艺/工艺品、家居/家饰/家纺、办公/文具、机械/电子器件、酒、食品、百货/超市/便利店、宠物食品/用品 | 提供售卖商品线下发货、线下收货服务、线下商超导览、导航服务 |
  27957. * | 生活服务 | 家政、外送 | 上门服务作业等线下场景 |
  27958. *
  27959. * **注意**
  27960. *
  27961. * - 获取位置信息需配置[地理位置用途说明](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#permission)。 */
  27962. startLocationUpdate<
  27963. T extends StartLocationUpdateOption = StartLocationUpdateOption
  27964. >(
  27965. option: T
  27966. ): PromisifySuccessResult<T, StartLocationUpdateOption>
  27967. /** [wx.startLocationUpdateBackground(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdateBackground.html)
  27968. *
  27969. * 需要基础库: `2.8.0`
  27970. *
  27971. * 在插件中使用:不支持
  27972. *
  27973. * 开启小程序在前后台时均可接收位置消息,后台包括离开小程序后继续使用微信(微信仍在前台)、离开微信(微信在后台)两个场景,需引导用户开启[授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html#后台定位)。授权以后,小程序在运行中或进入后台均可接受位置消息变化。
  27974. * ## 使用方法
  27975. * 自 2022 年 7 月 14 日后发布的小程序,若使用该接口,需要在 app.json 中进行声明,否则将无法正常使用该接口,2022年7月14日前发布的小程序不受影响。[具体规则见公告](https://developers.weixin.qq.com/community/develop/doc/000a02f2c5026891650e7f40351c01)
  27976. *
  27977. * ## 申请开通
  27978. * 暂只针对如下类目的小程序开放,需要先通过类目审核,再在小程序管理后台,「开发」-「开发管理」-「接口设置」中自助开通该接口权限。从2022年7月14日开始,在代码审核环节将检测该接口是否已完成开通,如未开通,将在代码提审环节进行拦截。
  27979. *
  27980. * ### 国内主体开放类目
  27981. *
  27982. * | 一级类目/主体类型 | 二级类目 | 应用场景 |
  27983. * | -------------- | -------| -------- |
  27984. * | 电商平台 | / | 在小程序内提供线下商超导览、导航服务 |
  27985. * | 商家自营 | / | 在小程序内提供线下商超导览、导航服务 |
  27986. * | 交通服务 | / | 代驾服务、打车出行、城市共享交通、实时导航服务等 |
  27987. * | 生活服务 | 跑腿、共享服务 | 含有B端小程序配送服务,基于地理位置共享工具类服务 |
  27988. * | 物流服务 | 收件/派件、查件、邮政、装卸搬运、快递柜、货物运输 | 提供B端小程序快递/货物收发服务 |
  27989. * | 餐饮服务 | 点餐平台、外卖平台 | 提供B端小程序餐饮配送服务、线下门店实时导航 |
  27990. * | 工具 | 健康管理 | 基于实时地理位置提供身体管理记录等服务 |
  27991. * | 旅游 | 景区服务、住宿服务 | 在小程序内提供景区导航、导览服务、酒店导航服务 |
  27992. * | 政务民生 | / | 提供政务单位相关业务 |
  27993. * | 政府主体账号 | / | 提供政务单位相关业务 |
  27994. *
  27995. * ### 海外主体开放类目
  27996. * | 一级类目/主体类型 | 二级类目 | 应用场景 |
  27997. * | -------------- | -------| -------- |
  27998. * | 交通服务 | / | 代驾服务、打车出行、城市共享交通、实时导航服务等 |
  27999. * | 生活服务 | 家政、外送 | 含有B端小程序配送服务,基于地理位置导航上门服务 |
  28000. * | 快递业与邮政 | / | 提供B端小程序快递/货物收发服务 |
  28001. * | 餐饮服务 | 外卖点餐 | 提供B端小程序餐饮配送服务、线下门店实时导航 |
  28002. * | 电商平台 | / | 在小程序内提供线下商超导览、导航服务 |
  28003. * | 跨境电商 | / | 在小程序内提供线下商超导览、导航服务 |
  28004. * | 本地服务 | 服装/鞋/箱包、玩具、家电/数码/手机、美妆/洗护、珠宝/饰品/眼镜/钟表、运动/户外/乐器、鲜花/园艺/工艺品、家居/家饰/家纺、办公/文具、机械/电子器件、酒、食品、百货/超市/便利店、宠物食品/用品 | 在小程序内提供线下商超导览、导航服务 |
  28005. *
  28006. * **注意**
  28007. *
  28008. * - 安卓微信7.0.6版本,iOS 7.0.5版本起支持该接口
  28009. * - 需在app.json中配置requiredBackgroundModes: ['location']后使用
  28010. * - 获取位置信息需配置[地理位置用途说明](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#permission)。 */
  28011. startLocationUpdateBackground<
  28012. T extends StartLocationUpdateBackgroundOption = StartLocationUpdateBackgroundOption
  28013. >(
  28014. option: T
  28015. ): PromisifySuccessResult<T, StartLocationUpdateBackgroundOption>
  28016. /** [wx.startPullDownRefresh(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/pull-down-refresh/wx.startPullDownRefresh.html)
  28017. *
  28018. * 需要基础库: `1.5.0`
  28019. *
  28020. * 在插件中使用:需要基础库 `2.1.0`
  28021. *
  28022. * 在插件中使用时,只能在当前插件的页面中调用
  28023. *
  28024. * 开始下拉刷新。调用后触发下拉刷新动画,效果与用户手动下拉刷新一致。
  28025. *
  28026. * **示例代码**
  28027. *
  28028. * ```js
  28029. wx.startPullDownRefresh()
  28030. ``` */
  28031. startPullDownRefresh<
  28032. T extends StartPullDownRefreshOption = StartPullDownRefreshOption
  28033. >(
  28034. option?: T
  28035. ): PromisifySuccessResult<T, StartPullDownRefreshOption>
  28036. /** [wx.startRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.startRecord.html)
  28037. *
  28038. * 在插件中使用:需要基础库 `1.9.6`
  28039. * @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) 替换
  28040. *
  28041. * 开始录音。当主动调用 [wx.stopRecord](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.stopRecord.html),或者录音超过1分钟时自动结束录音。当用户离开小程序时,此接口无法调用。
  28042. *
  28043. * **示例代码**
  28044. *
  28045. * ```js
  28046. wx.startRecord({
  28047. success (res) {
  28048. const tempFilePath = res.tempFilePath
  28049. }
  28050. })
  28051. setTimeout(function () {
  28052. wx.stopRecord() // 结束录音
  28053. }, 10000)
  28054. ``` */
  28055. startRecord<T extends WxStartRecordOption = WxStartRecordOption>(
  28056. option?: T
  28057. ): PromisifySuccessResult<T, WxStartRecordOption>
  28058. /** [wx.startSoterAuthentication(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/open-api/soter/wx.startSoterAuthentication.html)
  28059. *
  28060. * 需要基础库: `1.5.0`
  28061. *
  28062. * 在插件中使用:不支持
  28063. *
  28064. * 开始 SOTER 生物认证。验证流程请参考[说明](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/bio-auth.html)。
  28065. *
  28066. * **resultJSON 说明**
  28067. *
  28068. * 此数据为设备TEE中,将传入的challenge和TEE内其他安全信息组成的数据进行组装而来的JSON,对下述字段的解释如下表。例子如下:
  28069. * | 字段名 | 说明 |
  28070. * |---------|-------------------------------------------------------------------------------------------|
  28071. * | raw | 调用者传入的challenge |
  28072. * | fid | (仅Android支持)本次生物识别认证的生物信息编号(如指纹识别则是指纹信息在本设备内部编号) |
  28073. * | counter | 防重放特征参数 |
  28074. * | tee_n | TEE名称(如高通或者trustonic等) |
  28075. * | tee_v | TEE版本号 |
  28076. * | fp_n | 指纹以及相关逻辑模块提供商(如FPC等) |
  28077. * | fp_v | 指纹以及相关模块版本号 |
  28078. * | cpu_id | 机器唯一识别ID |
  28079. * | uid | 概念同Android系统定义uid,即应用程序编号 |
  28080. *
  28081. * ```json
  28082. {
  28083. "raw":"msg",
  28084. "fid":"2",
  28085. "counter":123,
  28086. "tee_n":"TEE Name",
  28087. "tee_v":"TEE Version",
  28088. "fp_n":"Fingerprint Sensor Name",
  28089. "fp_v":"Fingerprint Sensor Version",
  28090. "cpu_id":"CPU Id",
  28091. "uid":"21"
  28092. }
  28093. ```
  28094. *
  28095. * **示例代码**
  28096. *
  28097. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/q3tCKkmJ7g2e)
  28098. * ```js
  28099. wx.startSoterAuthentication({
  28100. requestAuthModes: ['fingerPrint'],
  28101. challenge: '123456',
  28102. authContent: '请用指纹解锁',
  28103. success(res) {
  28104. }
  28105. })
  28106. ``` */
  28107. startSoterAuthentication<
  28108. T extends StartSoterAuthenticationOption = StartSoterAuthenticationOption
  28109. >(
  28110. option: T
  28111. ): PromisifySuccessResult<T, StartSoterAuthenticationOption>
  28112. /** [wx.startWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.startWifi.html)
  28113. *
  28114. * 需要基础库: `1.6.0`
  28115. *
  28116. * 在插件中使用:需要基础库 `2.9.1`
  28117. *
  28118. * 初始化 Wi-Fi 模块。
  28119. *
  28120. * **示例代码**
  28121. *
  28122. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/8P7zrkmd7r2n)
  28123. * ```js
  28124. wx.startWifi({
  28125. success (res) {
  28126. console.log(res.errMsg)
  28127. }
  28128. })
  28129. ``` */
  28130. startWifi<T extends StartWifiOption = StartWifiOption>(
  28131. option?: T
  28132. ): PromisifySuccessResult<T, StartWifiOption>
  28133. /** [wx.stopAccelerometer(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.stopAccelerometer.html)
  28134. *
  28135. * 需要基础库: `1.1.0`
  28136. *
  28137. * 在插件中使用:需要基础库 `1.9.6`
  28138. *
  28139. * 停止监听加速度数据。
  28140. *
  28141. * **示例代码**
  28142. *
  28143. * ```js
  28144. wx.stopAccelerometer()
  28145. ``` */
  28146. stopAccelerometer<
  28147. T extends StopAccelerometerOption = StopAccelerometerOption
  28148. >(
  28149. option?: T
  28150. ): PromisifySuccessResult<T, StopAccelerometerOption>
  28151. /** [wx.stopBackgroundAudio(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.stopBackgroundAudio.html)
  28152. *
  28153. * 在插件中使用:需要基础库 `1.9.6`
  28154. * @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) 替换
  28155. *
  28156. * 停止播放音乐。
  28157. *
  28158. * **示例代码**
  28159. *
  28160. * ```js
  28161. wx.stopBackgroundAudio()
  28162. ``` */
  28163. stopBackgroundAudio<
  28164. T extends StopBackgroundAudioOption = StopBackgroundAudioOption
  28165. >(
  28166. option?: T
  28167. ): PromisifySuccessResult<T, StopBackgroundAudioOption>
  28168. /** [wx.stopBeaconDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/ibeacon/wx.stopBeaconDiscovery.html)
  28169. *
  28170. * 需要基础库: `1.2.0`
  28171. *
  28172. * 在插件中使用:需要基础库 `1.9.6`
  28173. *
  28174. * 停止搜索附近的 Beacon 设备 */
  28175. stopBeaconDiscovery<
  28176. T extends StopBeaconDiscoveryOption = StopBeaconDiscoveryOption
  28177. >(
  28178. option?: T
  28179. ): PromisifySuccessResult<T, StopBeaconDiscoveryOption>
  28180. /** [wx.stopBluetoothDevicesDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth/wx.stopBluetoothDevicesDiscovery.html)
  28181. *
  28182. * 需要基础库: `1.1.0`
  28183. *
  28184. * 在插件中使用:需要基础库 `1.9.6`
  28185. *
  28186. * 停止搜寻附近的蓝牙外围设备。若已经找到需要的蓝牙设备并不需要继续搜索时,建议调用该接口停止蓝牙搜索。
  28187. *
  28188. * **示例代码**
  28189. *
  28190. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  28191. * ```js
  28192. wx.stopBluetoothDevicesDiscovery({
  28193. success (res) {
  28194. console.log(res)
  28195. }
  28196. })
  28197. ``` */
  28198. stopBluetoothDevicesDiscovery<
  28199. T extends StopBluetoothDevicesDiscoveryOption = StopBluetoothDevicesDiscoveryOption
  28200. >(
  28201. option?: T
  28202. ): PromisifySuccessResult<T, StopBluetoothDevicesDiscoveryOption>
  28203. /** [wx.stopCompass(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/compass/wx.stopCompass.html)
  28204. *
  28205. * 需要基础库: `1.1.0`
  28206. *
  28207. * 在插件中使用:需要基础库 `1.9.6`
  28208. *
  28209. * 停止监听罗盘数据
  28210. *
  28211. * **示例代码**
  28212. *
  28213. * ```js
  28214. wx.stopCompass()
  28215. ``` */
  28216. stopCompass<T extends StopCompassOption = StopCompassOption>(
  28217. option?: T
  28218. ): PromisifySuccessResult<T, StopCompassOption>
  28219. /** [wx.stopDeviceMotionListening(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/motion/wx.stopDeviceMotionListening.html)
  28220. *
  28221. * 需要基础库: `2.3.0`
  28222. *
  28223. * 在插件中使用:需要基础库 `2.9.1`
  28224. *
  28225. * 停止监听设备方向的变化。 */
  28226. stopDeviceMotionListening<
  28227. T extends StopDeviceMotionListeningOption = StopDeviceMotionListeningOption
  28228. >(
  28229. option?: T
  28230. ): PromisifySuccessResult<T, StopDeviceMotionListeningOption>
  28231. /** [wx.stopFaceDetect(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ai/face/wx.stopFaceDetect.html)
  28232. *
  28233. * 需要基础库: `2.18.0`
  28234. *
  28235. * 在插件中使用:需要基础库 `2.21.3`
  28236. *
  28237. * @warning **该接口已停止维护,推荐使用 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 代替**
  28238. *
  28239. * 停止人脸检测。本接口不再维护,请使用 [wx.createVKSession](https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html) 接口代替。详情参考[人脸检测指南文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/visionkit/face.html) */
  28240. stopFaceDetect(option?: StopFaceDetectOption): void
  28241. /** [wx.stopGyroscope(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/gyroscope/wx.stopGyroscope.html)
  28242. *
  28243. * 需要基础库: `2.3.0`
  28244. *
  28245. * 在插件中使用:需要基础库 `2.9.1`
  28246. *
  28247. * 停止监听陀螺仪数据。 */
  28248. stopGyroscope<T extends StopGyroscopeOption = StopGyroscopeOption>(
  28249. option?: T
  28250. ): PromisifySuccessResult<T, StopGyroscopeOption>
  28251. /** [wx.stopHCE(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/nfc-hce/wx.stopHCE.html)
  28252. *
  28253. * 需要基础库: `1.7.0`
  28254. *
  28255. * 在插件中使用:需要基础库 `2.1.0`
  28256. *
  28257. * 关闭 NFC 模块。仅在安卓系统下有效。
  28258. *
  28259. * **示例代码**
  28260. *
  28261. * ```js
  28262. wx.stopHCE({
  28263. success (res) {
  28264. console.log(res.errMsg)
  28265. }
  28266. })
  28267. ``` */
  28268. stopHCE<T extends StopHCEOption = StopHCEOption>(
  28269. option?: T
  28270. ): PromisifySuccessResult<T, StopHCEOption>
  28271. /** [wx.stopLocalServiceDiscovery(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/network/mdns/wx.stopLocalServiceDiscovery.html)
  28272. *
  28273. * 需要基础库: `2.4.0`
  28274. *
  28275. * 在插件中使用:需要基础库 `2.15.0`
  28276. *
  28277. * 停止搜索 mDNS 服务 */
  28278. stopLocalServiceDiscovery<
  28279. T extends StopLocalServiceDiscoveryOption = StopLocalServiceDiscoveryOption
  28280. >(
  28281. option?: T
  28282. ): PromisifySuccessResult<T, StopLocalServiceDiscoveryOption>
  28283. /** [wx.stopLocationUpdate(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.stopLocationUpdate.html)
  28284. *
  28285. * 需要基础库: `2.8.0`
  28286. *
  28287. * 在插件中使用:需要基础库 `2.8.0`
  28288. *
  28289. * 关闭监听实时位置变化,前后台都停止消息接收 */
  28290. stopLocationUpdate<
  28291. T extends StopLocationUpdateOption = StopLocationUpdateOption
  28292. >(
  28293. option?: T
  28294. ): PromisifySuccessResult<T, StopLocationUpdateOption>
  28295. /** [wx.stopPullDownRefresh(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/ui/pull-down-refresh/wx.stopPullDownRefresh.html)
  28296. *
  28297. * 需要基础库: `1.5.0`
  28298. *
  28299. * 在插件中使用:需要基础库 `2.1.0`
  28300. *
  28301. * 在插件中使用时,只能在当前插件的页面中调用
  28302. *
  28303. * 停止当前页面下拉刷新。
  28304. *
  28305. * **示例代码**
  28306. *
  28307. * ```js
  28308. Page({
  28309. onPullDownRefresh () {
  28310. wx.stopPullDownRefresh()
  28311. }
  28312. })
  28313. ``` */
  28314. stopPullDownRefresh<
  28315. T extends StopPullDownRefreshOption = StopPullDownRefreshOption
  28316. >(
  28317. option?: T
  28318. ): PromisifySuccessResult<T, StopPullDownRefreshOption>
  28319. /** [wx.stopRecord(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/recorder/wx.stopRecord.html)
  28320. *
  28321. * 在插件中使用:需要基础库 `1.9.6`
  28322. * @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) 替换
  28323. *
  28324. * 停止录音。
  28325. *
  28326. * **示例代码**
  28327. *
  28328. * ```js
  28329. wx.startRecord({
  28330. success (res) {
  28331. const tempFilePath = res.tempFilePath
  28332. }
  28333. })
  28334. setTimeout(function () {
  28335. wx.stopRecord() // 结束录音
  28336. }, 10000)
  28337. ``` */
  28338. stopRecord<T extends WxStopRecordOption = WxStopRecordOption>(
  28339. option?: T
  28340. ): PromisifySuccessResult<T, WxStopRecordOption>
  28341. /** [wx.stopVoice(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.stopVoice.html)
  28342. *
  28343. * 在插件中使用:需要基础库 `1.9.6`
  28344. * @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) 替换
  28345. *
  28346. * 结束播放语音。
  28347. *
  28348. * **示例代码**
  28349. *
  28350. * ```js
  28351. wx.startRecord({
  28352. success (res) {
  28353. const tempFilePath = res.tempFilePath
  28354. wx.playVoice({
  28355. filePath: tempFilePath,
  28356. })
  28357. setTimeout(() => { wx.stopVoice() }, 5000)
  28358. }
  28359. })
  28360. ``` */
  28361. stopVoice<T extends StopVoiceOption = StopVoiceOption>(
  28362. option?: T
  28363. ): PromisifySuccessResult<T, StopVoiceOption>
  28364. /** [wx.stopWifi(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.stopWifi.html)
  28365. *
  28366. * 需要基础库: `1.6.0`
  28367. *
  28368. * 在插件中使用:需要基础库 `2.9.1`
  28369. *
  28370. * 关闭 Wi-Fi 模块。
  28371. *
  28372. * **示例代码**
  28373. *
  28374. * ```js
  28375. wx.stopWifi({
  28376. success (res) {
  28377. console.log(res.errMsg)
  28378. }
  28379. })
  28380. ``` */
  28381. stopWifi<T extends StopWifiOption = StopWifiOption>(
  28382. option?: T
  28383. ): PromisifySuccessResult<T, StopWifiOption>
  28384. /** [wx.subscribeVoIPVideoMembers(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.subscribeVoIPVideoMembers.html)
  28385. *
  28386. * 需要基础库: `2.11.0`
  28387. *
  28388. * 在插件中使用:需要基础库 `2.11.0`
  28389. *
  28390. * 订阅视频画面成员。对于视频房间,当成员超过两人时需进行订阅,否则只能看到最先加入房间的两人画面。 */
  28391. subscribeVoIPVideoMembers<
  28392. T extends SubscribeVoIPVideoMembersOption = SubscribeVoIPVideoMembersOption
  28393. >(
  28394. option: T
  28395. ): PromisifySuccessResult<T, SubscribeVoIPVideoMembersOption>
  28396. /** [wx.switchTab(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.switchTab.html)
  28397. *
  28398. * 在插件中使用:需要基础库 `2.3.1`
  28399. *
  28400. * 在插件中使用时,只能在当前插件的页面中调用
  28401. *
  28402. * 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
  28403. *
  28404. * **示例代码**
  28405. *
  28406. * ```json
  28407. // app.json
  28408. {
  28409. "tabBar": {
  28410. "list": [{
  28411. "pagePath": "index",
  28412. "text": "首页"
  28413. },{
  28414. "pagePath": "other",
  28415. "text": "其他"
  28416. }]
  28417. }
  28418. }
  28419. ```
  28420. *
  28421. * ```js
  28422. wx.switchTab({
  28423. url: '/index'
  28424. })
  28425. ``` */
  28426. switchTab<T extends SwitchTabOption = SwitchTabOption>(
  28427. option: T
  28428. ): PromisifySuccessResult<T, SwitchTabOption>
  28429. /** [wx.updateShareMenu(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.updateShareMenu.html)
  28430. *
  28431. * 需要基础库: `1.2.0`
  28432. *
  28433. * 在插件中使用:需要基础库 `2.1.0`
  28434. *
  28435. * 在插件中使用时,只能在当前插件的页面中调用
  28436. *
  28437. * 更新转发属性
  28438. *
  28439. * ****
  28440. *
  28441. * ## 注意事项
  28442. * - bug:在iOS上,如果 withShareTicket 传了 true ,同时 isUpdatableMessage 传了 false,会导致 withShareTicket 失效。解决办法:当 withShareTicket 传了 true 的时候,isUpdatableMessage 传 true 或者不传都可以,但不要传 false。如果需要关掉动态消息设置,则另外单独调用一次 wx.updateShareMenu({ isUpdatableMessage: false }) 即可。
  28443. *
  28444. * **示例代码**
  28445. *
  28446. * ```js
  28447. wx.updateShareMenu({
  28448. withShareTicket: true,
  28449. success () { }
  28450. })
  28451. ```
  28452. * ```js
  28453. // 转发私密消息
  28454. wx.updateShareMenu({
  28455. isPrivateMessage: true,
  28456. activityId: 'xxx',
  28457. templateInfo: {},
  28458. success () { },
  28459. fail () {}
  28460. })
  28461. ``` */
  28462. updateShareMenu<
  28463. T extends UpdateShareMenuOption = UpdateShareMenuOption
  28464. >(
  28465. option: T
  28466. ): PromisifySuccessResult<T, UpdateShareMenuOption>
  28467. /** [wx.updateVoIPChatMuteConfig(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/media/voip/wx.updateVoIPChatMuteConfig.html)
  28468. *
  28469. * 需要基础库: `2.7.0`
  28470. *
  28471. * 在插件中使用:需要基础库 `2.9.0`
  28472. *
  28473. * 更新实时语音静音设置 */
  28474. updateVoIPChatMuteConfig<
  28475. T extends UpdateVoIPChatMuteConfigOption = UpdateVoIPChatMuteConfigOption
  28476. >(
  28477. option: T
  28478. ): PromisifySuccessResult<T, UpdateVoIPChatMuteConfigOption>
  28479. /** [wx.updateWeChatApp(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/base/update/wx.updateWeChatApp.html)
  28480. *
  28481. * 需要基础库: `2.12.0`
  28482. *
  28483. * 在插件中使用:需要基础库 `2.12.0`
  28484. *
  28485. * 更新客户端版本。当判断用户小程序所在客户端版本过低时,可使用该接口跳转到更新微信页面。 */
  28486. updateWeChatApp<
  28487. T extends UpdateWeChatAppOption = UpdateWeChatAppOption
  28488. >(
  28489. option?: T
  28490. ): PromisifySuccessResult<T, UpdateWeChatAppOption>
  28491. /** [wx.vibrateLong(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/vibrate/wx.vibrateLong.html)
  28492. *
  28493. * 需要基础库: `1.2.0`
  28494. *
  28495. * 在插件中使用:需要基础库 `1.9.6`
  28496. *
  28497. * 使手机发生较长时间的振动(400 ms) */
  28498. vibrateLong<T extends VibrateLongOption = VibrateLongOption>(
  28499. option?: T
  28500. ): PromisifySuccessResult<T, VibrateLongOption>
  28501. /** [wx.vibrateShort(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/vibrate/wx.vibrateShort.html)
  28502. *
  28503. * 需要基础库: `1.2.0`
  28504. *
  28505. * 在插件中使用:需要基础库 `1.9.6`
  28506. *
  28507. * 使手机发生较短时间的振动(15 ms)。仅在 iPhone `7 / 7 Plus` 以上及 Android 机型生效 */
  28508. vibrateShort<T extends VibrateShortOption = VibrateShortOption>(
  28509. option: T
  28510. ): PromisifySuccessResult<T, VibrateShortOption>
  28511. /** [wx.writeBLECharacteristicValue(Object object)](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.writeBLECharacteristicValue.html)
  28512. *
  28513. * 需要基础库: `1.1.0`
  28514. *
  28515. * 在插件中使用:需要基础库 `1.9.6`
  28516. *
  28517. * 向蓝牙低功耗设备特征值中写入二进制数据。注意:必须设备的特征支持 write 才可以成功调用。
  28518. *
  28519. * **注意**
  28520. *
  28521. * - 并行调用多次会存在写失败的可能性。
  28522. * - 小程序不会对写入数据包大小做限制,但系统与蓝牙设备会限制蓝牙 4.0 单次传输的数据大小,超过最大字节数后会发生写入错误,建议每次写入不超过 20 字节。
  28523. * - 若单次写入数据过长,iOS 上存在系统不会有任何回调的情况(包括错误回调)。
  28524. * - 安卓平台上,在调用 [wx.notifyBLECharacteristicValueChange](https://developers.weixin.qq.com/miniprogram/dev/api/device/bluetooth-ble/wx.notifyBLECharacteristicValueChange.html) 成功后立即调用本接口,在部分机型上会发生 10008 系统错误
  28525. *
  28526. * **示例代码**
  28527. *
  28528. * [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/pQU51zmz7a3K)
  28529. * ```js
  28530. // 向蓝牙设备发送一个0x00的16进制数据
  28531. let buffer = new ArrayBuffer(1)
  28532. let dataView = new DataView(buffer)
  28533. dataView.setUint8(0, 0)
  28534. wx.writeBLECharacteristicValue({
  28535. // 这里的 deviceId 需要在 getBluetoothDevices 或 onBluetoothDeviceFound 接口中获取
  28536. deviceId,
  28537. // 这里的 serviceId 需要在 getBLEDeviceServices 接口中获取
  28538. serviceId,
  28539. // 这里的 characteristicId 需要在 getBLEDeviceCharacteristics 接口中获取
  28540. characteristicId,
  28541. // 这里的value是ArrayBuffer类型
  28542. value: buffer,
  28543. success (res) {
  28544. console.log('writeBLECharacteristicValue success', res.errMsg)
  28545. }
  28546. })
  28547. ``` */
  28548. writeBLECharacteristicValue<
  28549. T extends WriteBLECharacteristicValueOption = WriteBLECharacteristicValueOption
  28550. >(
  28551. option: T
  28552. ): PromisifySuccessResult<T, WriteBLECharacteristicValueOption>
  28553. /** 小程序云开发 */
  28554. cloud: WxCloud
  28555. /** 文件系统中的用户目录路径 */
  28556. env: { USER_DATA_PATH: string }
  28557. /** 获得 xr-frame 接口系统 */
  28558. getXrFrameSystem(): import('XrFrame').IXrFrameSystem
  28559. /** 需要基础库: `2.29.2`
  28560. *
  28561. * router 对象,可以通过 `wx.router` 获取。 */
  28562. router: Router
  28563. /** 需要基础库: `2.29.2`
  28564. *
  28565. * worklet 对象,可以通过 `wx.worklet` 获取。 */
  28566. worklet: Worklet
  28567. }
  28568. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28569. type AccessCompleteCallback = (res: FileError) => void
  28570. /** 接口调用失败的回调函数 */
  28571. type AccessFailCallback = (res: FileError) => void
  28572. /** 接口调用成功的回调函数 */
  28573. type AccessSuccessCallback = (res: FileError) => void
  28574. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28575. type AddArcCompleteCallback = (res: GeneralCallbackResult) => void
  28576. /** 接口调用失败的回调函数 */
  28577. type AddArcFailCallback = (res: GeneralCallbackResult) => void
  28578. /** 接口调用成功的回调函数 */
  28579. type AddArcSuccessCallback = (res: GeneralCallbackResult) => void
  28580. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28581. type AddCardCompleteCallback = (res: GeneralCallbackResult) => void
  28582. /** 接口调用失败的回调函数 */
  28583. type AddCardFailCallback = (res: GeneralCallbackResult) => void
  28584. /** 接口调用成功的回调函数 */
  28585. type AddCardSuccessCallback = (result: AddCardSuccessCallbackResult) => void
  28586. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28587. type AddCustomLayerCompleteCallback = (res: GeneralCallbackResult) => void
  28588. /** 接口调用失败的回调函数 */
  28589. type AddCustomLayerFailCallback = (res: GeneralCallbackResult) => void
  28590. /** 接口调用成功的回调函数 */
  28591. type AddCustomLayerSuccessCallback = (res: GeneralCallbackResult) => void
  28592. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28593. type AddFileToFavoritesCompleteCallback = (
  28594. res: GeneralCallbackResult
  28595. ) => void
  28596. /** 接口调用失败的回调函数 */
  28597. type AddFileToFavoritesFailCallback = (res: GeneralCallbackResult) => void
  28598. /** 接口调用成功的回调函数 */
  28599. type AddFileToFavoritesSuccessCallback = (
  28600. res: GeneralCallbackResult
  28601. ) => void
  28602. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28603. type AddGroundOverlayCompleteCallback = (res: GeneralCallbackResult) => void
  28604. /** 接口调用失败的回调函数 */
  28605. type AddGroundOverlayFailCallback = (res: GeneralCallbackResult) => void
  28606. /** 接口调用成功的回调函数 */
  28607. type AddGroundOverlaySuccessCallback = (res: GeneralCallbackResult) => void
  28608. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28609. type AddMarkersCompleteCallback = (res: GeneralCallbackResult) => void
  28610. /** 接口调用失败的回调函数 */
  28611. type AddMarkersFailCallback = (res: GeneralCallbackResult) => void
  28612. /** 接口调用成功的回调函数 */
  28613. type AddMarkersSuccessCallback = (res: GeneralCallbackResult) => void
  28614. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28615. type AddPhoneCalendarCompleteCallback = (res: GeneralCallbackResult) => void
  28616. /** 接口调用失败的回调函数 */
  28617. type AddPhoneCalendarFailCallback = (res: GeneralCallbackResult) => void
  28618. /** 接口调用成功的回调函数 */
  28619. type AddPhoneCalendarSuccessCallback = (res: GeneralCallbackResult) => void
  28620. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28621. type AddPhoneContactCompleteCallback = (res: GeneralCallbackResult) => void
  28622. /** 接口调用失败的回调函数 */
  28623. type AddPhoneContactFailCallback = (res: GeneralCallbackResult) => void
  28624. /** 接口调用成功的回调函数 */
  28625. type AddPhoneContactSuccessCallback = (res: GeneralCallbackResult) => void
  28626. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28627. type AddPhoneRepeatCalendarCompleteCallback = (
  28628. res: GeneralCallbackResult
  28629. ) => void
  28630. /** 接口调用失败的回调函数 */
  28631. type AddPhoneRepeatCalendarFailCallback = (
  28632. res: GeneralCallbackResult
  28633. ) => void
  28634. /** 接口调用成功的回调函数 */
  28635. type AddPhoneRepeatCalendarSuccessCallback = (
  28636. res: GeneralCallbackResult
  28637. ) => void
  28638. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28639. type AddServiceCompleteCallback = (res: GeneralCallbackResult) => void
  28640. /** 接口调用失败的回调函数 */
  28641. type AddServiceFailCallback = (res: GeneralCallbackResult) => void
  28642. /** 接口调用成功的回调函数 */
  28643. type AddServiceSuccessCallback = (res: GeneralCallbackResult) => void
  28644. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28645. type AddVideoToFavoritesCompleteCallback = (
  28646. res: GeneralCallbackResult
  28647. ) => void
  28648. /** 接口调用失败的回调函数 */
  28649. type AddVideoToFavoritesFailCallback = (res: GeneralCallbackResult) => void
  28650. /** 接口调用成功的回调函数 */
  28651. type AddVideoToFavoritesSuccessCallback = (
  28652. res: GeneralCallbackResult
  28653. ) => void
  28654. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28655. type AddVisualLayerCompleteCallback = (res: GeneralCallbackResult) => void
  28656. /** 接口调用失败的回调函数 */
  28657. type AddVisualLayerFailCallback = (res: GeneralCallbackResult) => void
  28658. /** 接口调用成功的回调函数 */
  28659. type AddVisualLayerSuccessCallback = (res: GeneralCallbackResult) => void
  28660. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28661. type AppendFileCompleteCallback = (res: FileError) => void
  28662. /** 接口调用失败的回调函数 */
  28663. type AppendFileFailCallback = (res: FileError) => void
  28664. /** 接口调用成功的回调函数 */
  28665. type AppendFileSuccessCallback = (res: FileError) => void
  28666. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28667. type ApplyBlusherStickMakeupCompleteCallback = (
  28668. res: GeneralCallbackResult
  28669. ) => void
  28670. /** 接口调用失败的回调函数 */
  28671. type ApplyBlusherStickMakeupFailCallback = (
  28672. res: GeneralCallbackResult
  28673. ) => void
  28674. /** 接口调用成功的回调函数 */
  28675. type ApplyBlusherStickMakeupSuccessCallback = (
  28676. res: GeneralCallbackResult
  28677. ) => void
  28678. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28679. type ApplyEyeBrowMakeupCompleteCallback = (
  28680. res: GeneralCallbackResult
  28681. ) => void
  28682. /** 接口调用失败的回调函数 */
  28683. type ApplyEyeBrowMakeupFailCallback = (res: GeneralCallbackResult) => void
  28684. /** 接口调用成功的回调函数 */
  28685. type ApplyEyeBrowMakeupSuccessCallback = (
  28686. res: GeneralCallbackResult
  28687. ) => void
  28688. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28689. type ApplyEyeShadowMakeupCompleteCallback = (
  28690. res: GeneralCallbackResult
  28691. ) => void
  28692. /** 接口调用失败的回调函数 */
  28693. type ApplyEyeShadowMakeupFailCallback = (res: GeneralCallbackResult) => void
  28694. /** 接口调用成功的回调函数 */
  28695. type ApplyEyeShadowMakeupSuccessCallback = (
  28696. res: GeneralCallbackResult
  28697. ) => void
  28698. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28699. type ApplyFaceContourMakeupCompleteCallback = (
  28700. res: GeneralCallbackResult
  28701. ) => void
  28702. /** 接口调用失败的回调函数 */
  28703. type ApplyFaceContourMakeupFailCallback = (
  28704. res: GeneralCallbackResult
  28705. ) => void
  28706. /** 接口调用成功的回调函数 */
  28707. type ApplyFaceContourMakeupSuccessCallback = (
  28708. res: GeneralCallbackResult
  28709. ) => void
  28710. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28711. type ApplyFilterCompleteCallback = (res: GeneralCallbackResult) => void
  28712. /** 接口调用失败的回调函数 */
  28713. type ApplyFilterFailCallback = (res: GeneralCallbackResult) => void
  28714. /** 接口调用成功的回调函数 */
  28715. type ApplyFilterSuccessCallback = (res: GeneralCallbackResult) => void
  28716. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28717. type ApplyLipStickMakeupCompleteCallback = (
  28718. res: GeneralCallbackResult
  28719. ) => void
  28720. /** 接口调用失败的回调函数 */
  28721. type ApplyLipStickMakeupFailCallback = (res: GeneralCallbackResult) => void
  28722. /** 接口调用成功的回调函数 */
  28723. type ApplyLipStickMakeupSuccessCallback = (
  28724. res: GeneralCallbackResult
  28725. ) => void
  28726. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28727. type ApplyStickerCompleteCallback = (res: GeneralCallbackResult) => void
  28728. /** 接口调用失败的回调函数 */
  28729. type ApplyStickerFailCallback = (res: GeneralCallbackResult) => void
  28730. /** 接口调用成功的回调函数 */
  28731. type ApplyStickerSuccessCallback = (res: GeneralCallbackResult) => void
  28732. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28733. type AuthPrivateMessageCompleteCallback = (
  28734. res: GeneralCallbackResult
  28735. ) => void
  28736. /** 接口调用失败的回调函数 */
  28737. type AuthPrivateMessageFailCallback = (res: GeneralCallbackResult) => void
  28738. /** 接口调用成功的回调函数 */
  28739. type AuthPrivateMessageSuccessCallback = (
  28740. result: AuthPrivateMessageSuccessCallbackResult
  28741. ) => void
  28742. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28743. type AuthorizeCompleteCallback = (res: GeneralCallbackResult) => void
  28744. /** 接口调用失败的回调函数 */
  28745. type AuthorizeFailCallback = (res: GeneralCallbackResult) => void
  28746. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28747. type AuthorizeForMiniProgramCompleteCallback = (
  28748. res: GeneralCallbackResult
  28749. ) => void
  28750. /** 接口调用失败的回调函数 */
  28751. type AuthorizeForMiniProgramFailCallback = (
  28752. res: GeneralCallbackResult
  28753. ) => void
  28754. /** 接口调用成功的回调函数 */
  28755. type AuthorizeForMiniProgramSuccessCallback = (
  28756. res: GeneralCallbackResult
  28757. ) => void
  28758. /** 接口调用成功的回调函数 */
  28759. type AuthorizeSuccessCallback = (res: GeneralCallbackResult) => void
  28760. /** 背景音频播放错误事件的监听函数 */
  28761. type BackgroundAudioManagerOnErrorCallback = (
  28762. res: GeneralCallbackResult
  28763. ) => void
  28764. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28765. type BatchGetStorageCompleteCallback = (res: GeneralCallbackResult) => void
  28766. /** 接口调用失败的回调函数 */
  28767. type BatchGetStorageFailCallback = (res: GeneralCallbackResult) => void
  28768. /** 接口调用成功的回调函数 */
  28769. type BatchGetStorageSuccessCallback = (res: GeneralCallbackResult) => void
  28770. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28771. type BatchSetStorageCompleteCallback = (res: GeneralCallbackResult) => void
  28772. /** 接口调用失败的回调函数 */
  28773. type BatchSetStorageFailCallback = (res: GeneralCallbackResult) => void
  28774. /** 接口调用成功的回调函数 */
  28775. type BatchSetStorageSuccessCallback = (res: GeneralCallbackResult) => void
  28776. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28777. type BlurCompleteCallback = (res: GeneralCallbackResult) => void
  28778. /** 接口调用失败的回调函数 */
  28779. type BlurFailCallback = (res: GeneralCallbackResult) => void
  28780. /** 接口调用成功的回调函数 */
  28781. type BlurSuccessCallback = (res: GeneralCallbackResult) => void
  28782. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */
  28783. type BoundingClientRectCallback = (
  28784. result: BoundingClientRectCallbackResult
  28785. ) => void
  28786. /** 接口调用成功的回调函数 */
  28787. type CameraContextSetZoomSuccessCallback = (
  28788. result: SetZoomSuccessCallbackResult
  28789. ) => void
  28790. /** 接口调用成功的回调函数 */
  28791. type CameraContextStartRecordSuccessCallback = (
  28792. res: GeneralCallbackResult
  28793. ) => void
  28794. /** 接口调用成功的回调函数 */
  28795. type CameraContextStopRecordSuccessCallback = (
  28796. result: StopRecordSuccessCallbackResult
  28797. ) => void
  28798. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28799. type CanvasGetImageDataCompleteCallback = (
  28800. res: GeneralCallbackResult
  28801. ) => void
  28802. /** 接口调用失败的回调函数 */
  28803. type CanvasGetImageDataFailCallback = (res: GeneralCallbackResult) => void
  28804. /** 接口调用成功的回调函数 */
  28805. type CanvasGetImageDataSuccessCallback = (
  28806. result: CanvasGetImageDataSuccessCallbackResult
  28807. ) => void
  28808. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28809. type CanvasPutImageDataCompleteCallback = (
  28810. res: GeneralCallbackResult
  28811. ) => void
  28812. /** 接口调用失败的回调函数 */
  28813. type CanvasPutImageDataFailCallback = (res: GeneralCallbackResult) => void
  28814. /** 接口调用成功的回调函数 */
  28815. type CanvasPutImageDataSuccessCallback = (
  28816. res: GeneralCallbackResult
  28817. ) => void
  28818. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28819. type CanvasToTempFilePathCompleteCallback = (
  28820. res: GeneralCallbackResult
  28821. ) => void
  28822. /** 接口调用失败的回调函数 */
  28823. type CanvasToTempFilePathFailCallback = (res: GeneralCallbackResult) => void
  28824. /** 接口调用成功的回调函数 */
  28825. type CanvasToTempFilePathSuccessCallback = (
  28826. result: CanvasToTempFilePathSuccessCallbackResult
  28827. ) => void
  28828. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28829. type CheckIsAddedToMyMiniProgramCompleteCallback = (
  28830. res: GeneralCallbackResult
  28831. ) => void
  28832. /** 接口调用失败的回调函数 */
  28833. type CheckIsAddedToMyMiniProgramFailCallback = (
  28834. res: GeneralCallbackResult
  28835. ) => void
  28836. /** 接口调用成功的回调函数 */
  28837. type CheckIsAddedToMyMiniProgramSuccessCallback = (
  28838. result: CheckIsAddedToMyMiniProgramSuccessCallbackResult
  28839. ) => void
  28840. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28841. type CheckIsOpenAccessibilityCompleteCallback = (
  28842. res: GeneralCallbackResult
  28843. ) => void
  28844. /** 接口调用失败的回调函数 */
  28845. type CheckIsOpenAccessibilityFailCallback = (
  28846. res: GeneralCallbackResult
  28847. ) => void
  28848. /** 接口调用成功的回调函数 */
  28849. type CheckIsOpenAccessibilitySuccessCallback = (
  28850. option: CheckIsOpenAccessibilitySuccessCallbackOption
  28851. ) => void
  28852. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28853. type CheckIsSoterEnrolledInDeviceCompleteCallback = (
  28854. res: GeneralCallbackResult
  28855. ) => void
  28856. /** 接口调用失败的回调函数 */
  28857. type CheckIsSoterEnrolledInDeviceFailCallback = (
  28858. res: GeneralCallbackResult
  28859. ) => void
  28860. /** 接口调用成功的回调函数 */
  28861. type CheckIsSoterEnrolledInDeviceSuccessCallback = (
  28862. result: CheckIsSoterEnrolledInDeviceSuccessCallbackResult
  28863. ) => void
  28864. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28865. type CheckIsSupportSoterAuthenticationCompleteCallback = (
  28866. res: GeneralCallbackResult
  28867. ) => void
  28868. /** 接口调用失败的回调函数 */
  28869. type CheckIsSupportSoterAuthenticationFailCallback = (
  28870. res: GeneralCallbackResult
  28871. ) => void
  28872. /** 接口调用成功的回调函数 */
  28873. type CheckIsSupportSoterAuthenticationSuccessCallback = (
  28874. result: CheckIsSupportSoterAuthenticationSuccessCallbackResult
  28875. ) => void
  28876. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28877. type CheckSessionCompleteCallback = (res: GeneralCallbackResult) => void
  28878. /** 接口调用失败的回调函数 */
  28879. type CheckSessionFailCallback = (res: GeneralCallbackResult) => void
  28880. /** 接口调用成功的回调函数 */
  28881. type CheckSessionSuccessCallback = (res: GeneralCallbackResult) => void
  28882. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28883. type ChooseAddressCompleteCallback = (res: GeneralCallbackResult) => void
  28884. /** 接口调用失败的回调函数 */
  28885. type ChooseAddressFailCallback = (res: GeneralCallbackResult) => void
  28886. /** 接口调用成功的回调函数 */
  28887. type ChooseAddressSuccessCallback = (
  28888. result: ChooseAddressSuccessCallbackResult
  28889. ) => void
  28890. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28891. type ChooseContactCompleteCallback = (res: GeneralCallbackResult) => void
  28892. /** 接口调用失败的回调函数 */
  28893. type ChooseContactFailCallback = (res: GeneralCallbackResult) => void
  28894. /** 接口调用成功的回调函数 */
  28895. type ChooseContactSuccessCallback = (
  28896. option: ChooseContactSuccessCallbackOption
  28897. ) => void
  28898. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28899. type ChooseImageCompleteCallback = (res: GeneralCallbackResult) => void
  28900. /** 接口调用失败的回调函数 */
  28901. type ChooseImageFailCallback = (res: GeneralCallbackResult) => void
  28902. /** 接口调用成功的回调函数 */
  28903. type ChooseImageSuccessCallback = (
  28904. result: ChooseImageSuccessCallbackResult
  28905. ) => void
  28906. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28907. type ChooseInvoiceCompleteCallback = (res: GeneralCallbackResult) => void
  28908. /** 接口调用失败的回调函数 */
  28909. type ChooseInvoiceFailCallback = (res: GeneralCallbackResult) => void
  28910. /** 接口调用成功的回调函数 */
  28911. type ChooseInvoiceSuccessCallback = (
  28912. result: ChooseInvoiceSuccessCallbackResult
  28913. ) => void
  28914. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28915. type ChooseInvoiceTitleCompleteCallback = (
  28916. res: GeneralCallbackResult
  28917. ) => void
  28918. /** 接口调用失败的回调函数 */
  28919. type ChooseInvoiceTitleFailCallback = (res: GeneralCallbackResult) => void
  28920. /** 接口调用成功的回调函数 */
  28921. type ChooseInvoiceTitleSuccessCallback = (
  28922. result: ChooseInvoiceTitleSuccessCallbackResult
  28923. ) => void
  28924. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28925. type ChooseLicensePlateCompleteCallback = (
  28926. res: GeneralCallbackResult
  28927. ) => void
  28928. /** 接口调用失败的回调函数 */
  28929. type ChooseLicensePlateFailCallback = (res: GeneralCallbackResult) => void
  28930. /** 接口调用成功的回调函数 */
  28931. type ChooseLicensePlateSuccessCallback = (
  28932. result: ChooseLicensePlateSuccessCallbackResult
  28933. ) => void
  28934. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28935. type ChooseLocationCompleteCallback = (res: GeneralCallbackResult) => void
  28936. /** 接口调用失败的回调函数 */
  28937. type ChooseLocationFailCallback = (res: GeneralCallbackResult) => void
  28938. /** 接口调用成功的回调函数 */
  28939. type ChooseLocationSuccessCallback = (
  28940. result: ChooseLocationSuccessCallbackResult
  28941. ) => void
  28942. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28943. type ChooseMediaCompleteCallback = (res: GeneralCallbackResult) => void
  28944. /** 接口调用失败的回调函数 */
  28945. type ChooseMediaFailCallback = (res: GeneralCallbackResult) => void
  28946. /** 接口调用成功的回调函数 */
  28947. type ChooseMediaSuccessCallback = (
  28948. result: ChooseMediaSuccessCallbackResult
  28949. ) => void
  28950. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28951. type ChooseMessageFileCompleteCallback = (
  28952. res: GeneralCallbackResult
  28953. ) => void
  28954. /** 接口调用失败的回调函数 */
  28955. type ChooseMessageFileFailCallback = (res: GeneralCallbackResult) => void
  28956. /** 接口调用成功的回调函数 */
  28957. type ChooseMessageFileSuccessCallback = (
  28958. result: ChooseMessageFileSuccessCallbackResult
  28959. ) => void
  28960. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28961. type ChoosePoiCompleteCallback = (res: GeneralCallbackResult) => void
  28962. /** 接口调用失败的回调函数 */
  28963. type ChoosePoiFailCallback = (res: GeneralCallbackResult) => void
  28964. /** 接口调用成功的回调函数 */
  28965. type ChoosePoiSuccessCallback = (
  28966. result: ChoosePoiSuccessCallbackResult
  28967. ) => void
  28968. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28969. type ChooseVideoCompleteCallback = (res: GeneralCallbackResult) => void
  28970. /** 接口调用失败的回调函数 */
  28971. type ChooseVideoFailCallback = (res: GeneralCallbackResult) => void
  28972. /** 接口调用成功的回调函数 */
  28973. type ChooseVideoSuccessCallback = (
  28974. result: ChooseVideoSuccessCallbackResult
  28975. ) => void
  28976. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28977. type ClearCompleteCallback = (res: GeneralCallbackResult) => void
  28978. /** 接口调用失败的回调函数 */
  28979. type ClearFailCallback = (res: GeneralCallbackResult) => void
  28980. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28981. type ClearFiltersCompleteCallback = (res: GeneralCallbackResult) => void
  28982. /** 接口调用失败的回调函数 */
  28983. type ClearFiltersFailCallback = (res: GeneralCallbackResult) => void
  28984. /** 接口调用成功的回调函数 */
  28985. type ClearFiltersSuccessCallback = (res: GeneralCallbackResult) => void
  28986. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28987. type ClearMakeupsCompleteCallback = (res: GeneralCallbackResult) => void
  28988. /** 接口调用失败的回调函数 */
  28989. type ClearMakeupsFailCallback = (res: GeneralCallbackResult) => void
  28990. /** 接口调用成功的回调函数 */
  28991. type ClearMakeupsSuccessCallback = (res: GeneralCallbackResult) => void
  28992. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28993. type ClearStickersCompleteCallback = (res: GeneralCallbackResult) => void
  28994. /** 接口调用失败的回调函数 */
  28995. type ClearStickersFailCallback = (res: GeneralCallbackResult) => void
  28996. /** 接口调用成功的回调函数 */
  28997. type ClearStickersSuccessCallback = (res: GeneralCallbackResult) => void
  28998. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  28999. type ClearStorageCompleteCallback = (res: GeneralCallbackResult) => void
  29000. /** 接口调用失败的回调函数 */
  29001. type ClearStorageFailCallback = (res: GeneralCallbackResult) => void
  29002. /** 接口调用成功的回调函数 */
  29003. type ClearStorageSuccessCallback = (res: GeneralCallbackResult) => void
  29004. /** 接口调用成功的回调函数 */
  29005. type ClearSuccessCallback = (res: GeneralCallbackResult) => void
  29006. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29007. type CloseBLEConnectionCompleteCallback = (res: BluetoothError) => void
  29008. /** 接口调用失败的回调函数 */
  29009. type CloseBLEConnectionFailCallback = (res: BluetoothError) => void
  29010. /** 接口调用成功的回调函数 */
  29011. type CloseBLEConnectionSuccessCallback = (res: BluetoothError) => void
  29012. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29013. type CloseBluetoothAdapterCompleteCallback = (res: BluetoothError) => void
  29014. /** 接口调用失败的回调函数 */
  29015. type CloseBluetoothAdapterFailCallback = (res: BluetoothError) => void
  29016. /** 接口调用成功的回调函数 */
  29017. type CloseBluetoothAdapterSuccessCallback = (res: BluetoothError) => void
  29018. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29019. type CloseSocketCompleteCallback = (res: GeneralCallbackResult) => void
  29020. /** 接口调用失败的回调函数 */
  29021. type CloseSocketFailCallback = (res: GeneralCallbackResult) => void
  29022. /** 接口调用成功的回调函数 */
  29023. type CloseSocketSuccessCallback = (res: GeneralCallbackResult) => void
  29024. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29025. type CompressImageCompleteCallback = (res: GeneralCallbackResult) => void
  29026. /** 接口调用失败的回调函数 */
  29027. type CompressImageFailCallback = (res: GeneralCallbackResult) => void
  29028. /** 接口调用成功的回调函数 */
  29029. type CompressImageSuccessCallback = (
  29030. result: CompressImageSuccessCallbackResult
  29031. ) => void
  29032. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29033. type CompressVideoCompleteCallback = (res: GeneralCallbackResult) => void
  29034. /** 接口调用失败的回调函数 */
  29035. type CompressVideoFailCallback = (res: GeneralCallbackResult) => void
  29036. /** 接口调用成功的回调函数 */
  29037. type CompressVideoSuccessCallback = (
  29038. result: CompressVideoSuccessCallbackResult
  29039. ) => void
  29040. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29041. type ConnectCompleteCallback = (res: Nfcrwerror) => void
  29042. /** 接口调用失败的回调函数 */
  29043. type ConnectFailCallback = (res: Nfcrwerror) => void
  29044. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29045. type ConnectSocketCompleteCallback = (res: GeneralCallbackResult) => void
  29046. /** 接口调用失败的回调函数 */
  29047. type ConnectSocketFailCallback = (res: GeneralCallbackResult) => void
  29048. /** 接口调用成功的回调函数 */
  29049. type ConnectSocketSuccessCallback = (res: GeneralCallbackResult) => void
  29050. /** 接口调用成功的回调函数 */
  29051. type ConnectSuccessCallback = (res: Nfcrwerror) => void
  29052. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29053. type ConnectWifiCompleteCallback = (res: WifiError) => void
  29054. /** 接口调用失败的回调函数 */
  29055. type ConnectWifiFailCallback = (res: WifiError) => void
  29056. /** 接口调用成功的回调函数 */
  29057. type ConnectWifiSuccessCallback = (res: WifiError) => void
  29058. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,返回节点信息。 */
  29059. type ContextCallback = (result: ContextCallbackResult) => void
  29060. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29061. type CopyFileCompleteCallback = (res: FileError) => void
  29062. /** 接口调用失败的回调函数 */
  29063. type CopyFileFailCallback = (res: FileError) => void
  29064. /** 接口调用成功的回调函数 */
  29065. type CopyFileSuccessCallback = (res: FileError) => void
  29066. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29067. type CreateBLEConnectionCompleteCallback = (res: BluetoothError) => void
  29068. /** 接口调用失败的回调函数 */
  29069. type CreateBLEConnectionFailCallback = (res: BluetoothError) => void
  29070. /** 接口调用成功的回调函数 */
  29071. type CreateBLEConnectionSuccessCallback = (res: BluetoothError) => void
  29072. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29073. type CreateBLEPeripheralServerCompleteCallback = (
  29074. res: GeneralCallbackResult
  29075. ) => void
  29076. /** 接口调用失败的回调函数 */
  29077. type CreateBLEPeripheralServerFailCallback = (
  29078. res: GeneralCallbackResult
  29079. ) => void
  29080. /** 接口调用成功的回调函数 */
  29081. type CreateBLEPeripheralServerSuccessCallback = (
  29082. result: CreateBLEPeripheralServerSuccessCallbackResult
  29083. ) => void
  29084. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29085. type CropImageCompleteCallback = (res: GeneralCallbackResult) => void
  29086. /** 接口调用失败的回调函数 */
  29087. type CropImageFailCallback = (res: GeneralCallbackResult) => void
  29088. /** 接口调用成功的回调函数 */
  29089. type CropImageSuccessCallback = (
  29090. result: CropImageSuccessCallbackResult
  29091. ) => void
  29092. /** 自定义渲染事件处理回调函数 */
  29093. type CustomRendererFrameEventCallback = (
  29094. result: OnCustomRendererEventCallbackResult
  29095. ) => void
  29096. /** [路由动画定义函数](#) */
  29097. type CustomRouteBuilder = (
  29098. /** 自定义路由上下文对象 */
  29099. customRouteContext: CustomRouteContext
  29100. ) => CustomRouteConfig
  29101. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29102. type DisableAlertBeforeUnloadCompleteCallback = (
  29103. res: GeneralCallbackResult
  29104. ) => void
  29105. /** 接口调用失败的回调函数 */
  29106. type DisableAlertBeforeUnloadFailCallback = (
  29107. res: GeneralCallbackResult
  29108. ) => void
  29109. /** 接口调用成功的回调函数 */
  29110. type DisableAlertBeforeUnloadSuccessCallback = (
  29111. res: GeneralCallbackResult
  29112. ) => void
  29113. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29114. type DownloadFileCompleteCallback = (res: GeneralCallbackResult) => void
  29115. /** 接口调用失败的回调函数 */
  29116. type DownloadFileFailCallback = (res: GeneralCallbackResult) => void
  29117. /** 接口调用成功的回调函数 */
  29118. type DownloadFileSuccessCallback = (
  29119. result: DownloadFileSuccessCallbackResult
  29120. ) => void
  29121. /** onHeadersReceived 传入的监听函数。不传此参数则移除所有监听函数。 */
  29122. type DownloadTaskOffHeadersReceivedCallback = (
  29123. result: DownloadTaskOnHeadersReceivedListenerResult
  29124. ) => void
  29125. /** onProgressUpdate 传入的监听函数。不传此参数则移除所有监听函数。 */
  29126. type DownloadTaskOffProgressUpdateCallback = (
  29127. result: DownloadTaskOnProgressUpdateListenerResult
  29128. ) => void
  29129. /** HTTP Response Header 事件的监听函数 */
  29130. type DownloadTaskOnHeadersReceivedCallback = (
  29131. result: DownloadTaskOnHeadersReceivedListenerResult
  29132. ) => void
  29133. /** 下载进度变化事件的监听函数 */
  29134. type DownloadTaskOnProgressUpdateCallback = (
  29135. result: DownloadTaskOnProgressUpdateListenerResult
  29136. ) => void
  29137. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29138. type EditImageCompleteCallback = (res: GeneralCallbackResult) => void
  29139. /** 接口调用失败的回调函数 */
  29140. type EditImageFailCallback = (res: GeneralCallbackResult) => void
  29141. /** 接口调用成功的回调函数 */
  29142. type EditImageSuccessCallback = (
  29143. result: CropImageSuccessCallbackResult
  29144. ) => void
  29145. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29146. type EnableAlertBeforeUnloadCompleteCallback = (
  29147. res: GeneralCallbackResult
  29148. ) => void
  29149. /** 接口调用失败的回调函数 */
  29150. type EnableAlertBeforeUnloadFailCallback = (
  29151. res: GeneralCallbackResult
  29152. ) => void
  29153. /** 接口调用成功的回调函数 */
  29154. type EnableAlertBeforeUnloadSuccessCallback = (
  29155. res: GeneralCallbackResult
  29156. ) => void
  29157. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29158. type EraseLinesCompleteCallback = (res: GeneralCallbackResult) => void
  29159. /** 接口调用失败的回调函数 */
  29160. type EraseLinesFailCallback = (res: GeneralCallbackResult) => void
  29161. /** 接口调用成功的回调函数 */
  29162. type EraseLinesSuccessCallback = (res: GeneralCallbackResult) => void
  29163. /** 事件监听函数 */
  29164. type EventCallback = (
  29165. /** 触发事件参数 */
  29166. ...args: any
  29167. ) => void
  29168. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29169. type ExecuteVisualLayerCommandCompleteCallback = (
  29170. res: GeneralCallbackResult
  29171. ) => void
  29172. /** 接口调用失败的回调函数 */
  29173. type ExecuteVisualLayerCommandFailCallback = (
  29174. res: GeneralCallbackResult
  29175. ) => void
  29176. /** 接口调用成功的回调函数 */
  29177. type ExecuteVisualLayerCommandSuccessCallback = (
  29178. result: ExecuteVisualLayerCommandSuccessCallbackResult
  29179. ) => void
  29180. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29181. type ExitCastingCompleteCallback = (res: GeneralCallbackResult) => void
  29182. /** 接口调用失败的回调函数 */
  29183. type ExitCastingFailCallback = (res: GeneralCallbackResult) => void
  29184. /** 接口调用成功的回调函数 */
  29185. type ExitCastingSuccessCallback = (res: GeneralCallbackResult) => void
  29186. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29187. type ExitFullScreenCompleteCallback = (res: GeneralCallbackResult) => void
  29188. /** 接口调用失败的回调函数 */
  29189. type ExitFullScreenFailCallback = (res: GeneralCallbackResult) => void
  29190. /** 接口调用成功的回调函数 */
  29191. type ExitFullScreenSuccessCallback = (res: GeneralCallbackResult) => void
  29192. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29193. type ExitMiniProgramCompleteCallback = (res: GeneralCallbackResult) => void
  29194. /** 接口调用失败的回调函数 */
  29195. type ExitMiniProgramFailCallback = (res: GeneralCallbackResult) => void
  29196. /** 接口调用成功的回调函数 */
  29197. type ExitMiniProgramSuccessCallback = (res: GeneralCallbackResult) => void
  29198. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29199. type ExitPictureInPictureCompleteCallback = (
  29200. res: GeneralCallbackResult
  29201. ) => void
  29202. /** 接口调用失败的回调函数 */
  29203. type ExitPictureInPictureFailCallback = (res: GeneralCallbackResult) => void
  29204. /** 接口调用成功的回调函数 */
  29205. type ExitPictureInPictureSuccessCallback = (
  29206. res: GeneralCallbackResult
  29207. ) => void
  29208. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29209. type ExitVoIPChatCompleteCallback = (res: GeneralCallbackResult) => void
  29210. /** 接口调用失败的回调函数 */
  29211. type ExitVoIPChatFailCallback = (res: GeneralCallbackResult) => void
  29212. /** 接口调用成功的回调函数 */
  29213. type ExitVoIPChatSuccessCallback = (res: GeneralCallbackResult) => void
  29214. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29215. type FaceDetectCompleteCallback = (res: GeneralCallbackResult) => void
  29216. /** 接口调用失败的回调函数 */
  29217. type FaceDetectFailCallback = (res: GeneralCallbackResult) => void
  29218. /** 接口调用成功的回调函数 */
  29219. type FaceDetectSuccessCallback = (
  29220. result: FaceDetectSuccessCallbackResult
  29221. ) => void
  29222. /** 回调函数 */
  29223. type FieldsCallback = (
  29224. /** 节点的相关信息 */
  29225. res: IAnyObject
  29226. ) => void
  29227. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29228. type FileSystemManagerCloseCompleteCallback = (res: FileError) => void
  29229. /** 接口调用失败的回调函数 */
  29230. type FileSystemManagerCloseFailCallback = (res: FileError) => void
  29231. /** 接口调用成功的回调函数 */
  29232. type FileSystemManagerCloseSuccessCallback = (res: FileError) => void
  29233. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29234. type FromScreenLocationCompleteCallback = (
  29235. res: GeneralCallbackResult
  29236. ) => void
  29237. /** 接口调用失败的回调函数 */
  29238. type FromScreenLocationFailCallback = (res: GeneralCallbackResult) => void
  29239. /** 接口调用成功的回调函数 */
  29240. type FromScreenLocationSuccessCallback = (
  29241. result: GetCenterLocationSuccessCallbackResult
  29242. ) => void
  29243. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29244. type FstatCompleteCallback = (res: FileError) => void
  29245. /** 接口调用失败的回调函数 */
  29246. type FstatFailCallback = (res: FileError) => void
  29247. /** 接口调用成功的回调函数 */
  29248. type FstatSuccessCallback = (result: FstatSuccessCallbackResult) => void
  29249. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29250. type FtruncateCompleteCallback = (res: FileError) => void
  29251. /** 接口调用失败的回调函数 */
  29252. type FtruncateFailCallback = (res: FileError) => void
  29253. /** 接口调用成功的回调函数 */
  29254. type FtruncateSuccessCallback = (res: FileError) => void
  29255. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29256. type GetAtqaCompleteCallback = (res: Nfcrwerror) => void
  29257. /** 接口调用失败的回调函数 */
  29258. type GetAtqaFailCallback = (res: Nfcrwerror) => void
  29259. /** 接口调用成功的回调函数 */
  29260. type GetAtqaSuccessCallback = (result: GetAtqaSuccessCallbackResult) => void
  29261. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29262. type GetAvailableAudioSourcesCompleteCallback = (
  29263. res: GeneralCallbackResult
  29264. ) => void
  29265. /** 接口调用失败的回调函数 */
  29266. type GetAvailableAudioSourcesFailCallback = (
  29267. res: GeneralCallbackResult
  29268. ) => void
  29269. /** 接口调用成功的回调函数 */
  29270. type GetAvailableAudioSourcesSuccessCallback = (
  29271. result: GetAvailableAudioSourcesSuccessCallbackResult
  29272. ) => void
  29273. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29274. type GetBLEDeviceCharacteristicsCompleteCallback = (
  29275. res: BluetoothError
  29276. ) => void
  29277. /** 接口调用失败的回调函数 */
  29278. type GetBLEDeviceCharacteristicsFailCallback = (res: BluetoothError) => void
  29279. /** 接口调用成功的回调函数 */
  29280. type GetBLEDeviceCharacteristicsSuccessCallback = (
  29281. result: GetBLEDeviceCharacteristicsSuccessCallbackResult
  29282. ) => void
  29283. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29284. type GetBLEDeviceRSSICompleteCallback = (res: GeneralCallbackResult) => void
  29285. /** 接口调用失败的回调函数 */
  29286. type GetBLEDeviceRSSIFailCallback = (res: GeneralCallbackResult) => void
  29287. /** 接口调用成功的回调函数 */
  29288. type GetBLEDeviceRSSISuccessCallback = (
  29289. result: GetBLEDeviceRSSISuccessCallbackResult
  29290. ) => void
  29291. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29292. type GetBLEDeviceServicesCompleteCallback = (res: BluetoothError) => void
  29293. /** 接口调用失败的回调函数 */
  29294. type GetBLEDeviceServicesFailCallback = (res: BluetoothError) => void
  29295. /** 接口调用成功的回调函数 */
  29296. type GetBLEDeviceServicesSuccessCallback = (
  29297. result: GetBLEDeviceServicesSuccessCallbackResult
  29298. ) => void
  29299. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29300. type GetBLEMTUCompleteCallback = (res: BluetoothError) => void
  29301. /** 接口调用失败的回调函数 */
  29302. type GetBLEMTUFailCallback = (res: BluetoothError) => void
  29303. /** 接口调用成功的回调函数 */
  29304. type GetBLEMTUSuccessCallback = (
  29305. result: GetBLEMTUSuccessCallbackResult
  29306. ) => void
  29307. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29308. type GetBackgroundAudioPlayerStateCompleteCallback = (
  29309. res: GeneralCallbackResult
  29310. ) => void
  29311. /** 接口调用失败的回调函数 */
  29312. type GetBackgroundAudioPlayerStateFailCallback = (
  29313. res: GeneralCallbackResult
  29314. ) => void
  29315. /** 接口调用成功的回调函数 */
  29316. type GetBackgroundAudioPlayerStateSuccessCallback = (
  29317. result: GetBackgroundAudioPlayerStateSuccessCallbackResult
  29318. ) => void
  29319. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29320. type GetBackgroundFetchDataCompleteCallback = (
  29321. res: GeneralCallbackResult
  29322. ) => void
  29323. /** 接口调用失败的回调函数 */
  29324. type GetBackgroundFetchDataFailCallback = (
  29325. res: GeneralCallbackResult
  29326. ) => void
  29327. /** 接口调用成功的回调函数 */
  29328. type GetBackgroundFetchDataSuccessCallback = (
  29329. result: GetBackgroundFetchDataSuccessCallbackResult
  29330. ) => void
  29331. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29332. type GetBackgroundFetchTokenCompleteCallback = (
  29333. res: GeneralCallbackResult
  29334. ) => void
  29335. /** 接口调用失败的回调函数 */
  29336. type GetBackgroundFetchTokenFailCallback = (
  29337. res: GeneralCallbackResult
  29338. ) => void
  29339. /** 接口调用成功的回调函数 */
  29340. type GetBackgroundFetchTokenSuccessCallback = (
  29341. result: GetBackgroundFetchTokenSuccessCallbackResult
  29342. ) => void
  29343. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29344. type GetBatteryInfoCompleteCallback = (res: GeneralCallbackResult) => void
  29345. /** 接口调用失败的回调函数 */
  29346. type GetBatteryInfoFailCallback = (res: GeneralCallbackResult) => void
  29347. /** 接口调用成功的回调函数 */
  29348. type GetBatteryInfoSuccessCallback = (
  29349. result: GetBatteryInfoSuccessCallbackResult
  29350. ) => void
  29351. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29352. type GetBeaconsCompleteCallback = (res: BeaconError) => void
  29353. /** 接口调用失败的回调函数 */
  29354. type GetBeaconsFailCallback = (res: BeaconError) => void
  29355. /** 接口调用成功的回调函数 */
  29356. type GetBeaconsSuccessCallback = (
  29357. result: GetBeaconsSuccessCallbackResult
  29358. ) => void
  29359. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29360. type GetBluetoothAdapterStateCompleteCallback = (
  29361. res: BluetoothError
  29362. ) => void
  29363. /** 接口调用失败的回调函数 */
  29364. type GetBluetoothAdapterStateFailCallback = (res: BluetoothError) => void
  29365. /** 接口调用成功的回调函数 */
  29366. type GetBluetoothAdapterStateSuccessCallback = (
  29367. result: GetBluetoothAdapterStateSuccessCallbackResult
  29368. ) => void
  29369. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29370. type GetBluetoothDevicesCompleteCallback = (res: BluetoothError) => void
  29371. /** 接口调用失败的回调函数 */
  29372. type GetBluetoothDevicesFailCallback = (res: BluetoothError) => void
  29373. /** 接口调用成功的回调函数 */
  29374. type GetBluetoothDevicesSuccessCallback = (
  29375. result: GetBluetoothDevicesSuccessCallbackResult
  29376. ) => void
  29377. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29378. type GetCenterLocationCompleteCallback = (
  29379. res: GeneralCallbackResult
  29380. ) => void
  29381. /** 接口调用失败的回调函数 */
  29382. type GetCenterLocationFailCallback = (res: GeneralCallbackResult) => void
  29383. /** 接口调用成功的回调函数 */
  29384. type GetCenterLocationSuccessCallback = (
  29385. result: GetCenterLocationSuccessCallbackResult
  29386. ) => void
  29387. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29388. type GetChannelsLiveInfoCompleteCallback = (
  29389. res: GeneralCallbackResult
  29390. ) => void
  29391. /** 接口调用失败的回调函数 */
  29392. type GetChannelsLiveInfoFailCallback = (res: GeneralCallbackResult) => void
  29393. /** 接口调用成功的回调函数 */
  29394. type GetChannelsLiveInfoSuccessCallback = (
  29395. result: GetChannelsLiveInfoSuccessCallbackResult
  29396. ) => void
  29397. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29398. type GetChannelsLiveNoticeInfoCompleteCallback = (
  29399. res: GeneralCallbackResult
  29400. ) => void
  29401. /** 接口调用失败的回调函数 */
  29402. type GetChannelsLiveNoticeInfoFailCallback = (
  29403. res: GeneralCallbackResult
  29404. ) => void
  29405. /** 接口调用成功的回调函数 */
  29406. type GetChannelsLiveNoticeInfoSuccessCallback = (
  29407. result: GetChannelsLiveNoticeInfoSuccessCallbackResult
  29408. ) => void
  29409. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29410. type GetChannelsShareKeyCompleteCallback = (
  29411. res: GeneralCallbackResult
  29412. ) => void
  29413. /** 接口调用失败的回调函数 */
  29414. type GetChannelsShareKeyFailCallback = (res: GeneralCallbackResult) => void
  29415. /** 接口调用成功的回调函数 */
  29416. type GetChannelsShareKeySuccessCallback = (
  29417. result: GetChannelsShareKeySuccessCallbackResult
  29418. ) => void
  29419. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29420. type GetClipboardDataCompleteCallback = (res: GeneralCallbackResult) => void
  29421. /** 接口调用失败的回调函数 */
  29422. type GetClipboardDataFailCallback = (res: GeneralCallbackResult) => void
  29423. /** 接口调用成功的回调函数 */
  29424. type GetClipboardDataSuccessCallback = (
  29425. option: GetClipboardDataSuccessCallbackOption
  29426. ) => void
  29427. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29428. type GetCommonConfigCompleteCallback = (res: GeneralCallbackResult) => void
  29429. /** 接口调用失败的回调函数 */
  29430. type GetCommonConfigFailCallback = (res: GeneralCallbackResult) => void
  29431. /** 接口调用成功的回调函数 */
  29432. type GetCommonConfigSuccessCallback = (
  29433. result: GetCommonConfigSuccessCallbackResult
  29434. ) => void
  29435. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29436. type GetConnectedBluetoothDevicesCompleteCallback = (
  29437. res: BluetoothError
  29438. ) => void
  29439. /** 接口调用失败的回调函数 */
  29440. type GetConnectedBluetoothDevicesFailCallback = (
  29441. res: BluetoothError
  29442. ) => void
  29443. /** 接口调用成功的回调函数 */
  29444. type GetConnectedBluetoothDevicesSuccessCallback = (
  29445. result: GetConnectedBluetoothDevicesSuccessCallbackResult
  29446. ) => void
  29447. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29448. type GetConnectedWifiCompleteCallback = (res: WifiError) => void
  29449. /** 接口调用失败的回调函数 */
  29450. type GetConnectedWifiFailCallback = (res: WifiError) => void
  29451. /** 接口调用成功的回调函数 */
  29452. type GetConnectedWifiSuccessCallback = (
  29453. result: GetConnectedWifiSuccessCallbackResult
  29454. ) => void
  29455. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29456. type GetContentsCompleteCallback = (res: GeneralCallbackResult) => void
  29457. /** 接口调用失败的回调函数 */
  29458. type GetContentsFailCallback = (res: GeneralCallbackResult) => void
  29459. /** 接口调用成功的回调函数 */
  29460. type GetContentsSuccessCallback = (
  29461. result: GetContentsSuccessCallbackResult
  29462. ) => void
  29463. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29464. type GetDeviceVoIPListCompleteCallback = (
  29465. res: GeneralCallbackResult
  29466. ) => void
  29467. /** 接口调用失败的回调函数 */
  29468. type GetDeviceVoIPListFailCallback = (res: GeneralCallbackResult) => void
  29469. /** 接口调用成功的回调函数 */
  29470. type GetDeviceVoIPListSuccessCallback = (
  29471. result: GetDeviceVoIPListSuccessCallbackResult
  29472. ) => void
  29473. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29474. type GetExtConfigCompleteCallback = (res: GeneralCallbackResult) => void
  29475. /** 接口调用失败的回调函数 */
  29476. type GetExtConfigFailCallback = (res: GeneralCallbackResult) => void
  29477. /** 接口调用成功的回调函数 */
  29478. type GetExtConfigSuccessCallback = (
  29479. result: GetExtConfigSuccessCallbackResult
  29480. ) => void
  29481. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29482. type GetFileInfoCompleteCallback = (res: FileError) => void
  29483. /** 接口调用失败的回调函数 */
  29484. type GetFileInfoFailCallback = (res: FileError) => void
  29485. /** 接口调用成功的回调函数 */
  29486. type GetFileInfoSuccessCallback = (
  29487. result: GetFileInfoSuccessCallbackResult
  29488. ) => void
  29489. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29490. type GetFuzzyLocationCompleteCallback = (res: GeneralCallbackResult) => void
  29491. /** 接口调用失败的回调函数 */
  29492. type GetFuzzyLocationFailCallback = (res: GeneralCallbackResult) => void
  29493. /** 接口调用成功的回调函数 */
  29494. type GetFuzzyLocationSuccessCallback = (
  29495. result: GetFuzzyLocationSuccessCallbackResult
  29496. ) => void
  29497. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29498. type GetGroupEnterInfoCompleteCallback = (
  29499. res: GeneralCallbackResult
  29500. ) => void
  29501. /** 接口调用失败的回调函数 */
  29502. type GetGroupEnterInfoFailCallback = (res: GeneralCallbackResult) => void
  29503. /** 接口调用成功的回调函数 */
  29504. type GetGroupEnterInfoSuccessCallback = (
  29505. result: GetGroupEnterInfoSuccessCallbackResult
  29506. ) => void
  29507. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29508. type GetHCEStateCompleteCallback = (res: NFCError) => void
  29509. /** 接口调用失败的回调函数 */
  29510. type GetHCEStateFailCallback = (res: NFCError) => void
  29511. /** 接口调用成功的回调函数 */
  29512. type GetHCEStateSuccessCallback = (res: NFCError) => void
  29513. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29514. type GetHistoricalBytesCompleteCallback = (res: Nfcrwerror) => void
  29515. /** 接口调用失败的回调函数 */
  29516. type GetHistoricalBytesFailCallback = (res: Nfcrwerror) => void
  29517. /** 接口调用成功的回调函数 */
  29518. type GetHistoricalBytesSuccessCallback = (
  29519. result: GetHistoricalBytesSuccessCallbackResult
  29520. ) => void
  29521. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29522. type GetImageInfoCompleteCallback = (res: GeneralCallbackResult) => void
  29523. /** 接口调用失败的回调函数 */
  29524. type GetImageInfoFailCallback = (res: GeneralCallbackResult) => void
  29525. /** 接口调用成功的回调函数 */
  29526. type GetImageInfoSuccessCallback = (
  29527. result: GetImageInfoSuccessCallbackResult
  29528. ) => void
  29529. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29530. type GetInferenceEnvInfoCompleteCallback = (
  29531. res: GeneralCallbackResult
  29532. ) => void
  29533. /** 接口调用失败的回调函数 */
  29534. type GetInferenceEnvInfoFailCallback = (res: GeneralCallbackResult) => void
  29535. /** 接口调用成功的回调函数 */
  29536. type GetInferenceEnvInfoSuccessCallback = (
  29537. result: GetInferenceEnvInfoSuccessCallbackResult
  29538. ) => void
  29539. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29540. type GetLatestUserKeyCompleteCallback = (res: GeneralCallbackResult) => void
  29541. /** 接口调用失败的回调函数 */
  29542. type GetLatestUserKeyFailCallback = (res: GeneralCallbackResult) => void
  29543. /** 接口调用成功的回调函数 */
  29544. type GetLatestUserKeySuccessCallback = (
  29545. result: GetLatestUserKeySuccessCallbackResult
  29546. ) => void
  29547. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29548. type GetLocalIPAddressCompleteCallback = (
  29549. res: GeneralCallbackResult
  29550. ) => void
  29551. /** 接口调用失败的回调函数 */
  29552. type GetLocalIPAddressFailCallback = (res: GeneralCallbackResult) => void
  29553. /** 接口调用成功的回调函数 */
  29554. type GetLocalIPAddressSuccessCallback = (
  29555. result: GetLocalIPAddressSuccessCallbackResult
  29556. ) => void
  29557. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29558. type GetLocationCompleteCallback = (res: GeneralCallbackResult) => void
  29559. /** 接口调用失败的回调函数 */
  29560. type GetLocationFailCallback = (res: GeneralCallbackResult) => void
  29561. /** 接口调用成功的回调函数 */
  29562. type GetLocationSuccessCallback = (
  29563. result: GetLocationSuccessCallbackResult
  29564. ) => void
  29565. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29566. type GetMaxTransceiveLengthCompleteCallback = (res: Nfcrwerror) => void
  29567. /** 接口调用失败的回调函数 */
  29568. type GetMaxTransceiveLengthFailCallback = (res: Nfcrwerror) => void
  29569. /** 接口调用成功的回调函数 */
  29570. type GetMaxTransceiveLengthSuccessCallback = (
  29571. result: GetMaxTransceiveLengthSuccessCallbackResult
  29572. ) => void
  29573. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29574. type GetMaxZoomCompleteCallback = (res: GeneralCallbackResult) => void
  29575. /** 接口调用失败的回调函数 */
  29576. type GetMaxZoomFailCallback = (res: GeneralCallbackResult) => void
  29577. /** 接口调用成功的回调函数 */
  29578. type GetMaxZoomSuccessCallback = (
  29579. result: GetMaxZoomSuccessCallbackResult
  29580. ) => void
  29581. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29582. type GetNetworkTypeCompleteCallback = (res: GeneralCallbackResult) => void
  29583. /** 接口调用失败的回调函数 */
  29584. type GetNetworkTypeFailCallback = (res: GeneralCallbackResult) => void
  29585. /** 接口调用成功的回调函数 */
  29586. type GetNetworkTypeSuccessCallback = (
  29587. result: GetNetworkTypeSuccessCallbackResult
  29588. ) => void
  29589. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29590. type GetPrivacySettingCompleteCallback = (
  29591. res: GeneralCallbackResult
  29592. ) => void
  29593. /** 接口调用失败的回调函数 */
  29594. type GetPrivacySettingFailCallback = (res: GeneralCallbackResult) => void
  29595. /** 接口调用成功的回调函数 */
  29596. type GetPrivacySettingSuccessCallback = (
  29597. result: GetPrivacySettingSuccessCallbackResult
  29598. ) => void
  29599. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29600. type GetRandomValuesCompleteCallback = (res: GeneralCallbackResult) => void
  29601. /** 接口调用失败的回调函数 */
  29602. type GetRandomValuesFailCallback = (res: GeneralCallbackResult) => void
  29603. /** 接口调用成功的回调函数 */
  29604. type GetRandomValuesSuccessCallback = (
  29605. result: GetRandomValuesSuccessCallbackResult
  29606. ) => void
  29607. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29608. type GetRegionCompleteCallback = (res: GeneralCallbackResult) => void
  29609. /** 接口调用失败的回调函数 */
  29610. type GetRegionFailCallback = (res: GeneralCallbackResult) => void
  29611. /** 接口调用成功的回调函数 */
  29612. type GetRegionSuccessCallback = (
  29613. result: GetRegionSuccessCallbackResult
  29614. ) => void
  29615. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29616. type GetRendererUserAgentCompleteCallback = (
  29617. res: GeneralCallbackResult
  29618. ) => void
  29619. /** 接口调用失败的回调函数 */
  29620. type GetRendererUserAgentFailCallback = (res: GeneralCallbackResult) => void
  29621. /** 接口调用成功的回调函数 */
  29622. type GetRendererUserAgentSuccessCallback = (
  29623. /** UserAgent */
  29624. userAgent: string
  29625. ) => void
  29626. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29627. type GetRotateCompleteCallback = (res: GeneralCallbackResult) => void
  29628. /** 接口调用失败的回调函数 */
  29629. type GetRotateFailCallback = (res: GeneralCallbackResult) => void
  29630. /** 接口调用成功的回调函数 */
  29631. type GetRotateSuccessCallback = (
  29632. result: GetRotateSuccessCallbackResult
  29633. ) => void
  29634. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29635. type GetSakCompleteCallback = (res: Nfcrwerror) => void
  29636. /** 接口调用失败的回调函数 */
  29637. type GetSakFailCallback = (res: Nfcrwerror) => void
  29638. /** 接口调用成功的回调函数 */
  29639. type GetSakSuccessCallback = (result: GetSakSuccessCallbackResult) => void
  29640. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29641. type GetSavedFileListCompleteCallback = (res: GeneralCallbackResult) => void
  29642. /** 接口调用失败的回调函数 */
  29643. type GetSavedFileListFailCallback = (res: GeneralCallbackResult) => void
  29644. /** 接口调用成功的回调函数 */
  29645. type GetSavedFileListSuccessCallback = (
  29646. result: GetSavedFileListSuccessCallbackResult
  29647. ) => void
  29648. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29649. type GetScaleCompleteCallback = (res: GeneralCallbackResult) => void
  29650. /** 接口调用失败的回调函数 */
  29651. type GetScaleFailCallback = (res: GeneralCallbackResult) => void
  29652. /** 接口调用成功的回调函数 */
  29653. type GetScaleSuccessCallback = (
  29654. result: GetScaleSuccessCallbackResult
  29655. ) => void
  29656. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29657. type GetScreenBrightnessCompleteCallback = (
  29658. res: GeneralCallbackResult
  29659. ) => void
  29660. /** 接口调用失败的回调函数 */
  29661. type GetScreenBrightnessFailCallback = (res: GeneralCallbackResult) => void
  29662. /** 接口调用成功的回调函数 */
  29663. type GetScreenBrightnessSuccessCallback = (
  29664. option: GetScreenBrightnessSuccessCallbackOption
  29665. ) => void
  29666. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29667. type GetScreenRecordingStateCompleteCallback = (
  29668. res: GeneralCallbackResult
  29669. ) => void
  29670. /** 接口调用失败的回调函数 */
  29671. type GetScreenRecordingStateFailCallback = (
  29672. res: GeneralCallbackResult
  29673. ) => void
  29674. /** 接口调用成功的回调函数 */
  29675. type GetScreenRecordingStateSuccessCallback = (
  29676. result: GetScreenRecordingStateSuccessCallbackResult
  29677. ) => void
  29678. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29679. type GetSelectedTextRangeCompleteCallback = (
  29680. res: GeneralCallbackResult
  29681. ) => void
  29682. /** 接口调用失败的回调函数 */
  29683. type GetSelectedTextRangeFailCallback = (res: GeneralCallbackResult) => void
  29684. /** 接口调用成功的回调函数 */
  29685. type GetSelectedTextRangeSuccessCallback = (
  29686. result: GetSelectedTextRangeSuccessCallbackResult
  29687. ) => void
  29688. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29689. type GetSelectionTextCompleteCallback = (res: GeneralCallbackResult) => void
  29690. /** 接口调用失败的回调函数 */
  29691. type GetSelectionTextFailCallback = (res: GeneralCallbackResult) => void
  29692. /** 接口调用成功的回调函数 */
  29693. type GetSelectionTextSuccessCallback = (
  29694. result: GetSelectionTextSuccessCallbackResult
  29695. ) => void
  29696. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29697. type GetSettingCompleteCallback = (res: GeneralCallbackResult) => void
  29698. /** 接口调用失败的回调函数 */
  29699. type GetSettingFailCallback = (res: GeneralCallbackResult) => void
  29700. /** 接口调用成功的回调函数 */
  29701. type GetSettingSuccessCallback = (
  29702. result: GetSettingSuccessCallbackResult
  29703. ) => void
  29704. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29705. type GetShareInfoCompleteCallback = (res: GeneralCallbackResult) => void
  29706. /** 接口调用失败的回调函数 */
  29707. type GetShareInfoFailCallback = (res: GeneralCallbackResult) => void
  29708. /** 接口调用成功的回调函数 */
  29709. type GetShareInfoSuccessCallback = (
  29710. result: GetGroupEnterInfoSuccessCallbackResult
  29711. ) => void
  29712. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29713. type GetSkewCompleteCallback = (res: GeneralCallbackResult) => void
  29714. /** 接口调用失败的回调函数 */
  29715. type GetSkewFailCallback = (res: GeneralCallbackResult) => void
  29716. /** 接口调用成功的回调函数 */
  29717. type GetSkewSuccessCallback = (result: GetSkewSuccessCallbackResult) => void
  29718. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29719. type GetSkylineInfoCompleteCallback = (res: GeneralCallbackResult) => void
  29720. /** 接口调用失败的回调函数 */
  29721. type GetSkylineInfoFailCallback = (res: GeneralCallbackResult) => void
  29722. /** 接口调用成功的回调函数 */
  29723. type GetSkylineInfoSuccessCallback = (
  29724. /** 当前运行环境对于 [Skyline 渲染引擎](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/introduction.html) 的支持情况 */
  29725. result: SkylineInfo
  29726. ) => void
  29727. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29728. type GetStorageCompleteCallback = (res: GeneralCallbackResult) => void
  29729. /** 接口调用失败的回调函数 */
  29730. type GetStorageFailCallback = (res: GeneralCallbackResult) => void
  29731. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29732. type GetStorageInfoCompleteCallback = (res: GeneralCallbackResult) => void
  29733. /** 接口调用失败的回调函数 */
  29734. type GetStorageInfoFailCallback = (res: GeneralCallbackResult) => void
  29735. /** 接口调用成功的回调函数 */
  29736. type GetStorageInfoSuccessCallback = (
  29737. option: GetStorageInfoSuccessCallbackOption
  29738. ) => void
  29739. /** 接口调用成功的回调函数 */
  29740. type GetStorageSuccessCallback<T = any> = (
  29741. result: GetStorageSuccessCallbackResult<T>
  29742. ) => void
  29743. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29744. type GetSystemInfoAsyncCompleteCallback = (
  29745. res: GeneralCallbackResult
  29746. ) => void
  29747. /** 接口调用失败的回调函数 */
  29748. type GetSystemInfoAsyncFailCallback = (res: GeneralCallbackResult) => void
  29749. /** 接口调用成功的回调函数 */
  29750. type GetSystemInfoAsyncSuccessCallback = (result: SystemInfo) => void
  29751. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29752. type GetSystemInfoCompleteCallback = (res: GeneralCallbackResult) => void
  29753. /** 接口调用失败的回调函数 */
  29754. type GetSystemInfoFailCallback = (res: GeneralCallbackResult) => void
  29755. /** 接口调用成功的回调函数 */
  29756. type GetSystemInfoSuccessCallback = (result: SystemInfo) => void
  29757. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29758. type GetUserInfoCompleteCallback = (res: GeneralCallbackResult) => void
  29759. /** 接口调用失败的回调函数 */
  29760. type GetUserInfoFailCallback = (res: GeneralCallbackResult) => void
  29761. /** 接口调用成功的回调函数 */
  29762. type GetUserInfoSuccessCallback = (
  29763. result: GetUserInfoSuccessCallbackResult
  29764. ) => void
  29765. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29766. type GetUserProfileCompleteCallback = (res: GeneralCallbackResult) => void
  29767. /** 接口调用失败的回调函数 */
  29768. type GetUserProfileFailCallback = (res: GeneralCallbackResult) => void
  29769. /** 接口调用成功的回调函数 */
  29770. type GetUserProfileSuccessCallback = (
  29771. result: GetUserProfileSuccessCallbackResult
  29772. ) => void
  29773. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29774. type GetVideoInfoCompleteCallback = (res: GeneralCallbackResult) => void
  29775. /** 接口调用失败的回调函数 */
  29776. type GetVideoInfoFailCallback = (res: GeneralCallbackResult) => void
  29777. /** 接口调用成功的回调函数 */
  29778. type GetVideoInfoSuccessCallback = (
  29779. result: GetVideoInfoSuccessCallbackResult
  29780. ) => void
  29781. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29782. type GetWeRunDataCompleteCallback = (res: GeneralCallbackResult) => void
  29783. /** 接口调用失败的回调函数 */
  29784. type GetWeRunDataFailCallback = (res: GeneralCallbackResult) => void
  29785. /** 接口调用成功的回调函数 */
  29786. type GetWeRunDataSuccessCallback = (
  29787. result: GetWeRunDataSuccessCallbackResult
  29788. ) => void
  29789. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29790. type GetWifiListCompleteCallback = (res: WifiError) => void
  29791. /** 接口调用失败的回调函数 */
  29792. type GetWifiListFailCallback = (res: WifiError) => void
  29793. /** 接口调用成功的回调函数 */
  29794. type GetWifiListSuccessCallback = (res: WifiError) => void
  29795. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29796. type HideHomeButtonCompleteCallback = (res: GeneralCallbackResult) => void
  29797. /** 接口调用失败的回调函数 */
  29798. type HideHomeButtonFailCallback = (res: GeneralCallbackResult) => void
  29799. /** 接口调用成功的回调函数 */
  29800. type HideHomeButtonSuccessCallback = (res: GeneralCallbackResult) => void
  29801. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29802. type HideKeyboardCompleteCallback = (res: GeneralCallbackResult) => void
  29803. /** 接口调用失败的回调函数 */
  29804. type HideKeyboardFailCallback = (res: GeneralCallbackResult) => void
  29805. /** 接口调用成功的回调函数 */
  29806. type HideKeyboardSuccessCallback = (res: GeneralCallbackResult) => void
  29807. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29808. type HideLoadingCompleteCallback = (res: GeneralCallbackResult) => void
  29809. /** 接口调用失败的回调函数 */
  29810. type HideLoadingFailCallback = (res: GeneralCallbackResult) => void
  29811. /** 接口调用成功的回调函数 */
  29812. type HideLoadingSuccessCallback = (res: GeneralCallbackResult) => void
  29813. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29814. type HideNavigationBarLoadingCompleteCallback = (
  29815. res: GeneralCallbackResult
  29816. ) => void
  29817. /** 接口调用失败的回调函数 */
  29818. type HideNavigationBarLoadingFailCallback = (
  29819. res: GeneralCallbackResult
  29820. ) => void
  29821. /** 接口调用成功的回调函数 */
  29822. type HideNavigationBarLoadingSuccessCallback = (
  29823. res: GeneralCallbackResult
  29824. ) => void
  29825. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29826. type HideShareMenuCompleteCallback = (res: GeneralCallbackResult) => void
  29827. /** 接口调用失败的回调函数 */
  29828. type HideShareMenuFailCallback = (res: GeneralCallbackResult) => void
  29829. /** 接口调用成功的回调函数 */
  29830. type HideShareMenuSuccessCallback = (res: GeneralCallbackResult) => void
  29831. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29832. type HideTabBarCompleteCallback = (res: GeneralCallbackResult) => void
  29833. /** 接口调用失败的回调函数 */
  29834. type HideTabBarFailCallback = (res: GeneralCallbackResult) => void
  29835. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29836. type HideTabBarRedDotCompleteCallback = (res: GeneralCallbackResult) => void
  29837. /** 接口调用失败的回调函数 */
  29838. type HideTabBarRedDotFailCallback = (res: GeneralCallbackResult) => void
  29839. /** 接口调用成功的回调函数 */
  29840. type HideTabBarRedDotSuccessCallback = (res: GeneralCallbackResult) => void
  29841. /** 接口调用成功的回调函数 */
  29842. type HideTabBarSuccessCallback = (res: GeneralCallbackResult) => void
  29843. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29844. type HideToastCompleteCallback = (res: GeneralCallbackResult) => void
  29845. /** 接口调用失败的回调函数 */
  29846. type HideToastFailCallback = (res: GeneralCallbackResult) => void
  29847. /** 接口调用成功的回调函数 */
  29848. type HideToastSuccessCallback = (res: GeneralCallbackResult) => void
  29849. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29850. type IncludePointsCompleteCallback = (res: GeneralCallbackResult) => void
  29851. /** 接口调用失败的回调函数 */
  29852. type IncludePointsFailCallback = (res: GeneralCallbackResult) => void
  29853. /** 接口调用成功的回调函数 */
  29854. type IncludePointsSuccessCallback = (res: GeneralCallbackResult) => void
  29855. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29856. type InitFaceDetectCompleteCallback = (res: GeneralCallbackResult) => void
  29857. /** 接口调用失败的回调函数 */
  29858. type InitFaceDetectFailCallback = (res: GeneralCallbackResult) => void
  29859. /** 接口调用成功的回调函数 */
  29860. type InitFaceDetectSuccessCallback = (res: GeneralCallbackResult) => void
  29861. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29862. type InitMarkerClusterCompleteCallback = (
  29863. res: GeneralCallbackResult
  29864. ) => void
  29865. /** 接口调用失败的回调函数 */
  29866. type InitMarkerClusterFailCallback = (res: GeneralCallbackResult) => void
  29867. /** 接口调用成功的回调函数 */
  29868. type InitMarkerClusterSuccessCallback = (res: GeneralCallbackResult) => void
  29869. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  29870. type InnerAudioContextOffErrorCallback = (
  29871. result: InnerAudioContextOnErrorListenerResult
  29872. ) => void
  29873. /** 音频播放错误事件的监听函数 */
  29874. type InnerAudioContextOnErrorCallback = (
  29875. result: InnerAudioContextOnErrorListenerResult
  29876. ) => void
  29877. type InnerAudioContextOnStopCallback = (res: GeneralCallbackResult) => void
  29878. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29879. type InsertDividerCompleteCallback = (res: GeneralCallbackResult) => void
  29880. /** 接口调用失败的回调函数 */
  29881. type InsertDividerFailCallback = (res: GeneralCallbackResult) => void
  29882. /** 接口调用成功的回调函数 */
  29883. type InsertDividerSuccessCallback = (res: GeneralCallbackResult) => void
  29884. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29885. type InsertImageCompleteCallback = (res: GeneralCallbackResult) => void
  29886. /** 接口调用失败的回调函数 */
  29887. type InsertImageFailCallback = (res: GeneralCallbackResult) => void
  29888. /** 接口调用成功的回调函数 */
  29889. type InsertImageSuccessCallback = (res: GeneralCallbackResult) => void
  29890. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29891. type InsertTextCompleteCallback = (res: GeneralCallbackResult) => void
  29892. /** 接口调用失败的回调函数 */
  29893. type InsertTextFailCallback = (res: GeneralCallbackResult) => void
  29894. /** 接口调用成功的回调函数 */
  29895. type InsertTextSuccessCallback = (res: GeneralCallbackResult) => void
  29896. /** 监听相交状态变化的回调函数 */
  29897. type IntersectionObserverObserveCallback = (
  29898. result: IntersectionObserverObserveCallbackResult
  29899. ) => void
  29900. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  29901. type InterstitialAdOffErrorCallback = (
  29902. result: InterstitialAdOnErrorListenerResult
  29903. ) => void
  29904. /** 插屏错误事件的监听函数 */
  29905. type InterstitialAdOnErrorCallback = (
  29906. result: InterstitialAdOnErrorListenerResult
  29907. ) => void
  29908. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29909. type IsBluetoothDevicePairedCompleteCallback = (
  29910. res: GeneralCallbackResult
  29911. ) => void
  29912. /** 接口调用失败的回调函数 */
  29913. type IsBluetoothDevicePairedFailCallback = (
  29914. res: GeneralCallbackResult
  29915. ) => void
  29916. /** 接口调用成功的回调函数 */
  29917. type IsBluetoothDevicePairedSuccessCallback = (
  29918. res: GeneralCallbackResult
  29919. ) => void
  29920. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29921. type IsConnectedCompleteCallback = (res: Nfcrwerror) => void
  29922. /** 接口调用失败的回调函数 */
  29923. type IsConnectedFailCallback = (res: Nfcrwerror) => void
  29924. /** 接口调用成功的回调函数 */
  29925. type IsConnectedSuccessCallback = (res: Nfcrwerror) => void
  29926. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29927. type Join1v1ChatCompleteCallback = (res: Join1v1ChatError) => void
  29928. /** 接口调用失败的回调函数 */
  29929. type Join1v1ChatFailCallback = (res: Join1v1ChatError) => void
  29930. /** 接口调用成功的回调函数 */
  29931. type Join1v1ChatSuccessCallback = (res: Join1v1ChatError) => void
  29932. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29933. type JoinVoIPChatCompleteCallback = (res: JoinVoIPChatError) => void
  29934. /** 接口调用失败的回调函数 */
  29935. type JoinVoIPChatFailCallback = (res: JoinVoIPChatError) => void
  29936. /** 接口调用成功的回调函数 */
  29937. type JoinVoIPChatSuccessCallback = (
  29938. result: JoinVoIPChatSuccessCallbackResult
  29939. ) => void
  29940. /** 接口调用成功的回调函数 */
  29941. type LivePlayerContextSnapshotSuccessCallback = (
  29942. result: LivePlayerContextSnapshotSuccessCallbackResult
  29943. ) => void
  29944. /** 接口调用成功的回调函数 */
  29945. type LivePusherContextSetZoomSuccessCallback = (
  29946. res: GeneralCallbackResult
  29947. ) => void
  29948. /** 接口调用成功的回调函数 */
  29949. type LivePusherContextSnapshotSuccessCallback = (
  29950. result: LivePusherContextSnapshotSuccessCallbackResult
  29951. ) => void
  29952. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29953. type LoadFontFaceCompleteCallback = (
  29954. result: LoadFontFaceCompleteCallbackResult
  29955. ) => void
  29956. /** 接口调用失败的回调函数 */
  29957. type LoadFontFaceFailCallback = (
  29958. result: LoadFontFaceCompleteCallbackResult
  29959. ) => void
  29960. /** 接口调用成功的回调函数 */
  29961. type LoadFontFaceSuccessCallback = (
  29962. result: LoadFontFaceCompleteCallbackResult
  29963. ) => void
  29964. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29965. type LoginCompleteCallback = (res: GeneralCallbackResult) => void
  29966. /** 接口调用失败的回调函数 */
  29967. type LoginFailCallback = (err: RequestFailCallbackErr) => void
  29968. /** 接口调用成功的回调函数 */
  29969. type LoginSuccessCallback = (result: LoginSuccessCallbackResult) => void
  29970. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29971. type MakeBluetoothPairCompleteCallback = (
  29972. res: GeneralCallbackResult
  29973. ) => void
  29974. /** 接口调用失败的回调函数 */
  29975. type MakeBluetoothPairFailCallback = (res: GeneralCallbackResult) => void
  29976. /** 接口调用成功的回调函数 */
  29977. type MakeBluetoothPairSuccessCallback = (res: GeneralCallbackResult) => void
  29978. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29979. type MakePhoneCallCompleteCallback = (res: GeneralCallbackResult) => void
  29980. /** 接口调用失败的回调函数 */
  29981. type MakePhoneCallFailCallback = (res: GeneralCallbackResult) => void
  29982. /** 接口调用成功的回调函数 */
  29983. type MakePhoneCallSuccessCallback = (res: GeneralCallbackResult) => void
  29984. /** 监听 media query 状态变化的回调函数 */
  29985. type MediaQueryObserverObserveCallback = (
  29986. result: MediaQueryObserverObserveCallbackResult
  29987. ) => void
  29988. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29989. type MkdirCompleteCallback = (res: FileError) => void
  29990. /** 接口调用失败的回调函数 */
  29991. type MkdirFailCallback = (res: FileError) => void
  29992. /** 接口调用成功的回调函数 */
  29993. type MkdirSuccessCallback = (res: FileError) => void
  29994. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  29995. type MoveAlongCompleteCallback = (res: GeneralCallbackResult) => void
  29996. /** 接口调用失败的回调函数 */
  29997. type MoveAlongFailCallback = (res: GeneralCallbackResult) => void
  29998. /** 接口调用成功的回调函数 */
  29999. type MoveAlongSuccessCallback = (res: GeneralCallbackResult) => void
  30000. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30001. type MoveToLocationCompleteCallback = (res: GeneralCallbackResult) => void
  30002. /** 接口调用失败的回调函数 */
  30003. type MoveToLocationFailCallback = (res: GeneralCallbackResult) => void
  30004. /** 接口调用成功的回调函数 */
  30005. type MoveToLocationSuccessCallback = (res: GeneralCallbackResult) => void
  30006. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30007. type MuteCompleteCallback = (res: GeneralCallbackResult) => void
  30008. /** 接口调用失败的回调函数 */
  30009. type MuteFailCallback = (res: GeneralCallbackResult) => void
  30010. /** 接口调用成功的回调函数 */
  30011. type MuteSuccessCallback = (res: GeneralCallbackResult) => void
  30012. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30013. type NavigateBackCompleteCallback = (res: GeneralCallbackResult) => void
  30014. /** 接口调用失败的回调函数 */
  30015. type NavigateBackFailCallback = (res: GeneralCallbackResult) => void
  30016. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30017. type NavigateBackMiniProgramCompleteCallback = (
  30018. res: GeneralCallbackResult
  30019. ) => void
  30020. /** 接口调用失败的回调函数 */
  30021. type NavigateBackMiniProgramFailCallback = (
  30022. res: GeneralCallbackResult
  30023. ) => void
  30024. /** 接口调用成功的回调函数 */
  30025. type NavigateBackMiniProgramSuccessCallback = (
  30026. res: GeneralCallbackResult
  30027. ) => void
  30028. /** 接口调用成功的回调函数 */
  30029. type NavigateBackSuccessCallback = (res: GeneralCallbackResult) => void
  30030. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30031. type NavigateToCompleteCallback = (res: GeneralCallbackResult) => void
  30032. /** 接口调用失败的回调函数 */
  30033. type NavigateToFailCallback = (res: GeneralCallbackResult) => void
  30034. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30035. type NavigateToMiniProgramCompleteCallback = (
  30036. res: GeneralCallbackResult
  30037. ) => void
  30038. /** 接口调用失败的回调函数 */
  30039. type NavigateToMiniProgramFailCallback = (
  30040. res: GeneralCallbackResult
  30041. ) => void
  30042. /** 接口调用成功的回调函数 */
  30043. type NavigateToMiniProgramSuccessCallback = (
  30044. res: GeneralCallbackResult
  30045. ) => void
  30046. /** 接口调用成功的回调函数 */
  30047. type NavigateToSuccessCallback = (
  30048. result: NavigateToSuccessCallbackResult
  30049. ) => void
  30050. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30051. type NdefCloseCompleteCallback = (res: Nfcrwerror) => void
  30052. /** 接口调用失败的回调函数 */
  30053. type NdefCloseFailCallback = (res: Nfcrwerror) => void
  30054. /** 接口调用成功的回调函数 */
  30055. type NdefCloseSuccessCallback = (res: Nfcrwerror) => void
  30056. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,返回节点信息。 */
  30057. type NodeCallback = (result: NodeCallbackResult) => void
  30058. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30059. type NotifyBLECharacteristicValueChangeCompleteCallback = (
  30060. res: BluetoothError
  30061. ) => void
  30062. /** 接口调用失败的回调函数 */
  30063. type NotifyBLECharacteristicValueChangeFailCallback = (
  30064. res: BluetoothError
  30065. ) => void
  30066. /** 接口调用成功的回调函数 */
  30067. type NotifyBLECharacteristicValueChangeSuccessCallback = (
  30068. res: BluetoothError
  30069. ) => void
  30070. /** onAccelerometerChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  30071. type OffAccelerometerChangeCallback = (res: GeneralCallbackResult) => void
  30072. /** onApiCategoryChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  30073. type OffApiCategoryChangeCallback = (
  30074. result: OnApiCategoryChangeListenerResult
  30075. ) => void
  30076. /** onAppHide 传入的监听函数。不传此参数则移除所有监听函数。 */
  30077. type OffAppHideCallback = (res: GeneralCallbackResult) => void
  30078. /** onAppShow 传入的监听函数。不传此参数则移除所有监听函数。 */
  30079. type OffAppShowCallback = (res: GeneralCallbackResult) => void
  30080. /** onAudioInterruptionBegin 传入的监听函数。不传此参数则移除所有监听函数。 */
  30081. type OffAudioInterruptionBeginCallback = (
  30082. res: GeneralCallbackResult
  30083. ) => void
  30084. /** onAudioInterruptionEnd 传入的监听函数。不传此参数则移除所有监听函数。 */
  30085. type OffAudioInterruptionEndCallback = (res: GeneralCallbackResult) => void
  30086. /** onBLEConnectionStateChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  30087. type OffBLEConnectionStateChangeCallback = (
  30088. result: OnBLEConnectionStateChangeListenerResult
  30089. ) => void
  30090. /** onBLEMTUChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  30091. type OffBLEMTUChangeCallback = (
  30092. result: OnBLEMTUChangeListenerResult
  30093. ) => void
  30094. /** onBLEPeripheralConnectionStateChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  30095. type OffBLEPeripheralConnectionStateChangedCallback = (
  30096. result: OnBLEPeripheralConnectionStateChangedListenerResult
  30097. ) => void
  30098. /** onBindWifi 传入的监听函数。不传此参数则移除所有监听函数。 */
  30099. type OffBindWifiCallback = (res: GeneralCallbackResult) => void
  30100. /** onCanplay 传入的监听函数。不传此参数则移除所有监听函数。 */
  30101. type OffCanplayCallback = (res: GeneralCallbackResult) => void
  30102. /** onCharacteristicReadRequest 传入的监听函数。不传此参数则移除所有监听函数。 */
  30103. type OffCharacteristicReadRequestCallback = (
  30104. result: OnCharacteristicReadRequestListenerResult
  30105. ) => void
  30106. /** onCharacteristicSubscribed 传入的监听函数。不传此参数则移除所有监听函数。 */
  30107. type OffCharacteristicSubscribedCallback = (
  30108. result: OnCharacteristicSubscribedListenerResult
  30109. ) => void
  30110. /** onCharacteristicUnsubscribed 传入的监听函数。不传此参数则移除所有监听函数。 */
  30111. type OffCharacteristicUnsubscribedCallback = (
  30112. result: OnCharacteristicSubscribedListenerResult
  30113. ) => void
  30114. /** onCharacteristicWriteRequest 传入的监听函数。不传此参数则移除所有监听函数。 */
  30115. type OffCharacteristicWriteRequestCallback = (
  30116. result: OnCharacteristicWriteRequestListenerResult
  30117. ) => void
  30118. /** onChunkReceived 传入的监听函数。不传此参数则移除所有监听函数。 */
  30119. type OffChunkReceivedCallback = (
  30120. result: OnChunkReceivedListenerResult
  30121. ) => void
  30122. /** onCompassChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  30123. type OffCompassChangeCallback = (res: GeneralCallbackResult) => void
  30124. /** onConnect 传入的监听函数。不传此参数则移除所有监听函数。 */
  30125. type OffConnectCallback = (res: GeneralCallbackResult) => void
  30126. /** onDeviceMotionChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  30127. type OffDeviceMotionChangeCallback = (res: GeneralCallbackResult) => void
  30128. /** onDiscovered 传入的监听函数。不传此参数则移除所有监听函数。 */
  30129. type OffDiscoveredCallback = (result: OnDiscoveredListenerResult) => void
  30130. /** onEmbeddedMiniProgramHeightChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  30131. type OffEmbeddedMiniProgramHeightChangeCallback = (
  30132. result: OnEmbeddedMiniProgramHeightChangeListenerResult
  30133. ) => void
  30134. /** onEnded 传入的监听函数。不传此参数则移除所有监听函数。 */
  30135. type OffEndedCallback = (res: GeneralCallbackResult) => void
  30136. /** onGetWifiList 传入的监听函数。不传此参数则移除所有监听函数。 */
  30137. type OffGetWifiListCallback = (result: OnGetWifiListListenerResult) => void
  30138. /** onGyroscopeChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  30139. type OffGyroscopeChangeCallback = (res: GeneralCallbackResult) => void
  30140. /** onHCEMessage 传入的监听函数。不传此参数则移除所有监听函数。 */
  30141. type OffHCEMessageCallback = (result: OnHCEMessageListenerResult) => void
  30142. /** onKeyboardHeightChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  30143. type OffKeyboardHeightChangeCallback = (
  30144. result: OnKeyboardHeightChangeListenerResult
  30145. ) => void
  30146. /** onLazyLoadError 传入的监听函数。不传此参数则移除所有监听函数。 */
  30147. type OffLazyLoadErrorCallback = (
  30148. result: OnLazyLoadErrorListenerResult
  30149. ) => void
  30150. /** onListening 传入的监听函数。不传此参数则移除所有监听函数。 */
  30151. type OffListeningCallback = (res: GeneralCallbackResult) => void
  30152. /** onLoad 传入的监听函数。不传此参数则移除所有监听函数。 */
  30153. type OffLoadCallback = (res: GeneralCallbackResult) => void
  30154. /** onLocalServiceDiscoveryStop 传入的监听函数。不传此参数则移除所有监听函数。 */
  30155. type OffLocalServiceDiscoveryStopCallback = (
  30156. res: GeneralCallbackResult
  30157. ) => void
  30158. /** onLocalServiceFound 传入的监听函数。不传此参数则移除所有监听函数。 */
  30159. type OffLocalServiceFoundCallback = (
  30160. result: OnLocalServiceFoundListenerResult
  30161. ) => void
  30162. /** onLocalServiceLost 传入的监听函数。不传此参数则移除所有监听函数。 */
  30163. type OffLocalServiceLostCallback = (
  30164. result: OnLocalServiceLostListenerResult
  30165. ) => void
  30166. /** onLocalServiceResolveFail 传入的监听函数。不传此参数则移除所有监听函数。 */
  30167. type OffLocalServiceResolveFailCallback = (
  30168. result: OnLocalServiceLostListenerResult
  30169. ) => void
  30170. /** onLocationChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  30171. type OffLocationChangeCallback = (
  30172. result: OnLocationChangeListenerResult
  30173. ) => void
  30174. /** onLocationChangeError 传入的监听函数。不传此参数则移除所有监听函数。 */
  30175. type OffLocationChangeErrorCallback = (
  30176. result: OnLocationChangeErrorListenerResult
  30177. ) => void
  30178. /** onMemoryWarning 传入的监听函数。不传此参数则移除所有监听函数。 */
  30179. type OffMemoryWarningCallback = (
  30180. result: OnMemoryWarningListenerResult
  30181. ) => void
  30182. /** onNetworkStatusChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  30183. type OffNetworkStatusChangeCallback = (res: GeneralCallbackResult) => void
  30184. /** onNetworkWeakChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  30185. type OffNetworkWeakChangeCallback = (
  30186. result: OnNetworkWeakChangeListenerResult
  30187. ) => void
  30188. /** onPageNotFound 传入的监听函数。不传此参数则移除所有监听函数。 */
  30189. type OffPageNotFoundCallback = (
  30190. result: OnPageNotFoundListenerResult
  30191. ) => void
  30192. /** onPause 传入的监听函数。不传此参数则移除所有监听函数。 */
  30193. type OffPauseCallback = (res: GeneralCallbackResult) => void
  30194. /** onPlay 传入的监听函数。不传此参数则移除所有监听函数。 */
  30195. type OffPlayCallback = (res: GeneralCallbackResult) => void
  30196. /** onScreenRecordingStateChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  30197. type OffScreenRecordingStateChangedCallback = (
  30198. result: OnScreenRecordingStateChangedListenerResult
  30199. ) => void
  30200. /** onSeeked 传入的监听函数。不传此参数则移除所有监听函数。 */
  30201. type OffSeekedCallback = (res: GeneralCallbackResult) => void
  30202. /** onSeeking 传入的监听函数。不传此参数则移除所有监听函数。 */
  30203. type OffSeekingCallback = (res: GeneralCallbackResult) => void
  30204. /** onStop 传入的监听函数。不传此参数则移除所有监听函数。 */
  30205. type OffStopCallback = (res: GeneralCallbackResult) => void
  30206. /** onThemeChange 传入的监听函数。不传此参数则移除所有监听函数。 */
  30207. type OffThemeChangeCallback = (result: OnThemeChangeListenerResult) => void
  30208. /** onTimeUpdate 传入的监听函数。不传此参数则移除所有监听函数。 */
  30209. type OffTimeUpdateCallback = (res: GeneralCallbackResult) => void
  30210. /** onUnhandledRejection 传入的监听函数。不传此参数则移除所有监听函数。 */
  30211. type OffUnhandledRejectionCallback = (
  30212. result: OnUnhandledRejectionListenerResult
  30213. ) => void
  30214. /** onVoIPChatInterrupted 传入的监听函数。不传此参数则移除所有监听函数。 */
  30215. type OffVoIPChatInterruptedCallback = (
  30216. result: OnVoIPChatInterruptedListenerResult
  30217. ) => void
  30218. /** onVoIPChatMembersChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  30219. type OffVoIPChatMembersChangedCallback = (
  30220. result: OnVoIPChatMembersChangedListenerResult
  30221. ) => void
  30222. /** onVoIPChatSpeakersChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  30223. type OffVoIPChatSpeakersChangedCallback = (
  30224. result: OnVoIPChatSpeakersChangedListenerResult
  30225. ) => void
  30226. /** onVoIPChatStateChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  30227. type OffVoIPChatStateChangedCallback = (
  30228. result: OnVoIPChatStateChangedListenerResult
  30229. ) => void
  30230. /** onVoIPVideoMembersChanged 传入的监听函数。不传此参数则移除所有监听函数。 */
  30231. type OffVoIPVideoMembersChangedCallback = (
  30232. result: OnVoIPVideoMembersChangedListenerResult
  30233. ) => void
  30234. /** onWaiting 传入的监听函数。不传此参数则移除所有监听函数。 */
  30235. type OffWaitingCallback = (res: GeneralCallbackResult) => void
  30236. /** onWifiConnected 传入的监听函数。不传此参数则移除所有监听函数。 */
  30237. type OffWifiConnectedCallback = (
  30238. result: OnWifiConnectedListenerResult
  30239. ) => void
  30240. /** onWifiConnectedWithPartialInfo 传入的监听函数。不传此参数则移除所有监听函数。 */
  30241. type OffWifiConnectedWithPartialInfoCallback = (
  30242. result: OnWifiConnectedWithPartialInfoListenerResult
  30243. ) => void
  30244. /** onWindowResize 传入的监听函数。不传此参数则移除所有监听函数。 */
  30245. type OffWindowResizeCallback = (
  30246. result: OnWindowResizeListenerResult
  30247. ) => void
  30248. /** 加速度数据事件的监听函数 */
  30249. type OnAccelerometerChangeCallback = (
  30250. result: OnAccelerometerChangeListenerResult
  30251. ) => void
  30252. /** API 类别变化事件的监听函数 */
  30253. type OnApiCategoryChangeCallback = (
  30254. result: OnApiCategoryChangeListenerResult
  30255. ) => void
  30256. /** 小程序切后台事件的监听函数 */
  30257. type OnAppHideCallback = (res: GeneralCallbackResult) => void
  30258. /** 小程序切前台事件的监听函数 */
  30259. type OnAppShowCallback = (
  30260. /** 启动参数 */
  30261. options: LaunchOptionsApp
  30262. ) => void
  30263. /** 音频因为受到系统占用而被中断开始事件的监听函数 */
  30264. type OnAudioInterruptionBeginCallback = (res: GeneralCallbackResult) => void
  30265. /** 音频中断结束事件的监听函数 */
  30266. type OnAudioInterruptionEndCallback = (res: GeneralCallbackResult) => void
  30267. /** 蓝牙低功耗设备的特征值变化事件的监听函数 */
  30268. type OnBLECharacteristicValueChangeCallback = (
  30269. result: OnBLECharacteristicValueChangeListenerResult
  30270. ) => void
  30271. /** 蓝牙低功耗连接状态改变事件的监听函数 */
  30272. type OnBLEConnectionStateChangeCallback = (
  30273. result: OnBLEConnectionStateChangeListenerResult
  30274. ) => void
  30275. /** 蓝牙低功耗的最大传输单元变化事件的监听函数 */
  30276. type OnBLEMTUChangeCallback = (result: OnBLEMTUChangeListenerResult) => void
  30277. /** 当前外围设备被连接或断开连接事件的监听函数 */
  30278. type OnBLEPeripheralConnectionStateChangedCallback = (
  30279. result: OnBLEPeripheralConnectionStateChangedListenerResult
  30280. ) => void
  30281. /** 音乐暂停事件的监听函数 */
  30282. type OnBackgroundAudioPauseCallback = (res: GeneralCallbackResult) => void
  30283. /** 音乐播放事件的监听函数 */
  30284. type OnBackgroundAudioPlayCallback = (res: GeneralCallbackResult) => void
  30285. /** 音乐停止事件的监听函数 */
  30286. type OnBackgroundAudioStopCallback = (res: GeneralCallbackResult) => void
  30287. /** 收到 backgroundFetch 数据事件的监听函数 */
  30288. type OnBackgroundFetchDataCallback = (
  30289. result: OnBackgroundFetchDataListenerResult
  30290. ) => void
  30291. /** Beacon 服务状态变化事件的监听函数 */
  30292. type OnBeaconServiceChangeCallback = (
  30293. result: OnBeaconServiceChangeListenerResult
  30294. ) => void
  30295. /** Beacon 设备更新事件的监听函数 */
  30296. type OnBeaconUpdateCallback = (result: OnBeaconUpdateListenerResult) => void
  30297. /** 当一个 socket 绑定当前 wifi 网络成功时触发该事件的监听函数 */
  30298. type OnBindWifiCallback = (res: GeneralCallbackResult) => void
  30299. /** 蓝牙适配器状态变化事件的监听函数 */
  30300. type OnBluetoothAdapterStateChangeCallback = (
  30301. result: OnBluetoothAdapterStateChangeListenerResult
  30302. ) => void
  30303. /** 搜索到新设备的事件的监听函数 */
  30304. type OnBluetoothDeviceFoundCallback = (
  30305. result: OnBluetoothDeviceFoundListenerResult
  30306. ) => void
  30307. /** 回调函数 */
  30308. type OnCameraFrameCallback = (result: OnCameraFrameCallbackResult) => void
  30309. type OnCanplayCallback = (res: GeneralCallbackResult) => void
  30310. /** 已连接的设备请求读当前外围设备的特征值事件的监听函数 */
  30311. type OnCharacteristicReadRequestCallback = (
  30312. result: OnCharacteristicReadRequestListenerResult
  30313. ) => void
  30314. /** 特征订阅事件的监听函数 */
  30315. type OnCharacteristicSubscribedCallback = (
  30316. result: OnCharacteristicSubscribedListenerResult
  30317. ) => void
  30318. /** 取消特征订阅事件的监听函数 */
  30319. type OnCharacteristicUnsubscribedCallback = (
  30320. result: OnCharacteristicSubscribedListenerResult
  30321. ) => void
  30322. /** 已连接的设备请求写当前外围设备的特征值事件的监听函数 */
  30323. type OnCharacteristicWriteRequestCallback = (
  30324. result: OnCharacteristicWriteRequestListenerResult
  30325. ) => void
  30326. /** 向微信后台请求检查更新结果事件的监听函数 */
  30327. type OnCheckForUpdateCallback = (
  30328. result: OnCheckForUpdateListenerResult
  30329. ) => void
  30330. /** Transfer-Encoding Chunk Received 事件的监听函数 */
  30331. type OnChunkReceivedCallback = (
  30332. result: OnChunkReceivedListenerResult
  30333. ) => void
  30334. /** 罗盘数据变化事件的监听函数 */
  30335. type OnCompassChangeCallback = (
  30336. result: OnCompassChangeListenerResult
  30337. ) => void
  30338. /** 当一个 socket 连接成功建立的时候触发该事件的监听函数 */
  30339. type OnConnectCallback = (res: GeneralCallbackResult) => void
  30340. /** 用户点击右上角菜单的「复制链接」按钮时触发的事件的监听函数 */
  30341. type OnCopyUrlCallback = (result: OnCopyUrlListenerResult) => void
  30342. /** 设备方向变化事件的监听函数 */
  30343. type OnDeviceMotionChangeCallback = (
  30344. result: OnDeviceMotionChangeListenerResult
  30345. ) => void
  30346. /** 的监听函数 */
  30347. type OnDiscoveredCallback = (result: OnDiscoveredListenerResult) => void
  30348. /** 半屏小程序可视高度变化事件的监听函数 */
  30349. type OnEmbeddedMiniProgramHeightChangeCallback = (
  30350. result: OnEmbeddedMiniProgramHeightChangeListenerResult
  30351. ) => void
  30352. type OnEndedCallback = (res: GeneralCallbackResult) => void
  30353. /** 已录制完指定帧大小的文件事件的监听函数 */
  30354. type OnFrameRecordedCallback = (
  30355. result: OnFrameRecordedListenerResult
  30356. ) => void
  30357. /** 获取到 Wi-Fi 列表数据事件的监听函数 */
  30358. type OnGetWifiListCallback = (result: OnGetWifiListListenerResult) => void
  30359. /** 陀螺仪数据变化事件的监听函数 */
  30360. type OnGyroscopeChangeCallback = (
  30361. result: OnGyroscopeChangeListenerResult
  30362. ) => void
  30363. /** 接收 NFC 设备消息事件的监听函数 */
  30364. type OnHCEMessageCallback = (result: OnHCEMessageListenerResult) => void
  30365. /** 录音因为受到系统占用而被中断开始事件的监听函数 */
  30366. type OnInterruptionBeginCallback = (res: GeneralCallbackResult) => void
  30367. /** 录音中断结束事件的监听函数 */
  30368. type OnInterruptionEndCallback = (res: GeneralCallbackResult) => void
  30369. /** 键盘高度变化事件的监听函数 */
  30370. type OnKeyboardHeightChangeCallback = (
  30371. result: OnKeyboardHeightChangeListenerResult
  30372. ) => void
  30373. /** 小程序异步组件加载失败事件的监听函数 */
  30374. type OnLazyLoadErrorCallback = (
  30375. result: OnLazyLoadErrorListenerResult
  30376. ) => void
  30377. /** 开始监听数据包消息的事件的监听函数 */
  30378. type OnListeningCallback = (res: GeneralCallbackResult) => void
  30379. type OnLoadCallback = (res: GeneralCallbackResult) => void
  30380. /** mDNS 服务停止搜索的事件的监听函数 */
  30381. type OnLocalServiceDiscoveryStopCallback = (
  30382. res: GeneralCallbackResult
  30383. ) => void
  30384. /** mDNS 服务发现的事件的监听函数 */
  30385. type OnLocalServiceFoundCallback = (
  30386. result: OnLocalServiceFoundListenerResult
  30387. ) => void
  30388. /** mDNS 服务离开的事件的监听函数 */
  30389. type OnLocalServiceLostCallback = (
  30390. result: OnLocalServiceLostListenerResult
  30391. ) => void
  30392. /** mDNS 服务解析失败的事件的监听函数 */
  30393. type OnLocalServiceResolveFailCallback = (
  30394. result: OnLocalServiceLostListenerResult
  30395. ) => void
  30396. /** 实时地理位置变化事件的监听函数 */
  30397. type OnLocationChangeCallback = (
  30398. result: OnLocationChangeListenerResult
  30399. ) => void
  30400. /** 的监听函数 */
  30401. type OnLocationChangeErrorCallback = (
  30402. result: OnLocationChangeErrorListenerResult
  30403. ) => void
  30404. /** 内存不足告警事件的监听函数 */
  30405. type OnMemoryWarningCallback = (
  30406. result: OnMemoryWarningListenerResult
  30407. ) => void
  30408. /** 隐私接口需要用户授权事件的监听函数 */
  30409. type OnNeedPrivacyAuthorizationCallback = (
  30410. res: GeneralCallbackResult
  30411. ) => void
  30412. /** 网络状态变化事件的监听函数 */
  30413. type OnNetworkStatusChangeCallback = (
  30414. result: OnNetworkStatusChangeListenerResult
  30415. ) => void
  30416. /** 弱网状态变化事件的监听函数 */
  30417. type OnNetworkWeakChangeCallback = (
  30418. result: OnNetworkWeakChangeListenerResult
  30419. ) => void
  30420. /** 用户在系统音乐播放面板点击下一曲事件的监听函数 */
  30421. type OnNextCallback = (res: GeneralCallbackResult) => void
  30422. /** WebSocket 连接打开事件的监听函数 */
  30423. type OnOpenCallback = (result: OnOpenListenerResult) => void
  30424. /** 小程序要打开的页面不存在事件的监听函数 */
  30425. type OnPageNotFoundCallback = (result: OnPageNotFoundListenerResult) => void
  30426. type OnPauseCallback = (res: GeneralCallbackResult) => void
  30427. type OnPlayCallback = (res: GeneralCallbackResult) => void
  30428. /** 用户在系统音乐播放面板点击上一曲事件的监听函数 */
  30429. type OnPrevCallback = (res: GeneralCallbackResult) => void
  30430. /** worker线程被系统回收事件的监听函数 */
  30431. type OnProcessKilledCallback = (res: GeneralCallbackResult) => void
  30432. /** 录音继续事件的监听函数 */
  30433. type OnResumeCallback = (res: GeneralCallbackResult) => void
  30434. /** 用户录屏事件的监听函数 */
  30435. type OnScreenRecordingStateChangedCallback = (
  30436. result: OnScreenRecordingStateChangedListenerResult
  30437. ) => void
  30438. type OnSeekedCallback = (res: GeneralCallbackResult) => void
  30439. type OnSeekingCallback = (res: GeneralCallbackResult) => void
  30440. /** WebSocket 连接关闭事件的监听函数 */
  30441. type OnSocketCloseCallback = (
  30442. result: SocketTaskOnCloseListenerResult
  30443. ) => void
  30444. /** WebSocket 错误事件的监听函数 */
  30445. type OnSocketErrorCallback = (result: GeneralCallbackResult) => void
  30446. /** WebSocket 接收到服务器的消息事件的监听函数 */
  30447. type OnSocketMessageCallback = (
  30448. result: SocketTaskOnMessageListenerResult
  30449. ) => void
  30450. /** WebSocket 连接打开事件的监听函数 */
  30451. type OnSocketOpenCallback = (result: OnSocketOpenListenerResult) => void
  30452. /** 录音开始事件的监听函数 */
  30453. type OnStartCallback = (res: GeneralCallbackResult) => void
  30454. /** 系统主题改变事件的监听函数 */
  30455. type OnThemeChangeCallback = (result: OnThemeChangeListenerResult) => void
  30456. type OnTimeUpdateCallback = (res: GeneralCallbackResult) => void
  30457. /** 未处理的 Promise 拒绝事件的监听函数 */
  30458. type OnUnhandledRejectionCallback = (
  30459. result: OnUnhandledRejectionListenerResult
  30460. ) => void
  30461. /** 小程序更新失败事件的监听函数 */
  30462. type OnUpdateFailedCallback = (res: GeneralCallbackResult) => void
  30463. /** 小程序有版本更新事件的监听函数 */
  30464. type OnUpdateReadyCallback = (res: GeneralCallbackResult) => void
  30465. /** 用户主动截屏事件的监听函数 */
  30466. type OnUserCaptureScreenCallback = (res: GeneralCallbackResult) => void
  30467. /** 被动断开实时语音通话事件的监听函数 */
  30468. type OnVoIPChatInterruptedCallback = (
  30469. result: OnVoIPChatInterruptedListenerResult
  30470. ) => void
  30471. /** 实时语音通话成员在线状态变化事件的监听函数 */
  30472. type OnVoIPChatMembersChangedCallback = (
  30473. result: OnVoIPChatMembersChangedListenerResult
  30474. ) => void
  30475. /** 实时语音通话成员通话状态变化事件的监听函数 */
  30476. type OnVoIPChatSpeakersChangedCallback = (
  30477. result: OnVoIPChatSpeakersChangedListenerResult
  30478. ) => void
  30479. /** 房间状态变化事件的监听函数 */
  30480. type OnVoIPChatStateChangedCallback = (
  30481. result: OnVoIPChatStateChangedListenerResult
  30482. ) => void
  30483. /** 实时语音通话成员视频状态变化事件的监听函数 */
  30484. type OnVoIPVideoMembersChangedCallback = (
  30485. result: OnVoIPVideoMembersChangedListenerResult
  30486. ) => void
  30487. /** 音频加载中事件的监听函数 */
  30488. type OnWaitingCallback = (res: GeneralCallbackResult) => void
  30489. /** 连接上 Wi-Fi 的事件的监听函数 */
  30490. type OnWifiConnectedCallback = (
  30491. result: OnWifiConnectedListenerResult
  30492. ) => void
  30493. /** 连接上 Wi-Fi 的事件的监听函数 */
  30494. type OnWifiConnectedWithPartialInfoCallback = (
  30495. result: OnWifiConnectedWithPartialInfoListenerResult
  30496. ) => void
  30497. /** 窗口尺寸变化事件的监听函数 */
  30498. type OnWindowResizeCallback = (result: OnWindowResizeListenerResult) => void
  30499. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30500. type OpenAppAuthorizeSettingCompleteCallback = (
  30501. res: GeneralCallbackResult
  30502. ) => void
  30503. /** 接口调用失败的回调函数 */
  30504. type OpenAppAuthorizeSettingFailCallback = (
  30505. res: GeneralCallbackResult
  30506. ) => void
  30507. /** 接口调用成功的回调函数 */
  30508. type OpenAppAuthorizeSettingSuccessCallback = (
  30509. res: GeneralCallbackResult
  30510. ) => void
  30511. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30512. type OpenBluetoothAdapterCompleteCallback = (res: BluetoothError) => void
  30513. /** 接口调用失败的回调函数 */
  30514. type OpenBluetoothAdapterFailCallback = (res: BluetoothError) => void
  30515. /** 接口调用成功的回调函数 */
  30516. type OpenBluetoothAdapterSuccessCallback = (res: BluetoothError) => void
  30517. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30518. type OpenCardCompleteCallback = (res: GeneralCallbackResult) => void
  30519. /** 接口调用失败的回调函数 */
  30520. type OpenCardFailCallback = (res: GeneralCallbackResult) => void
  30521. /** 接口调用成功的回调函数 */
  30522. type OpenCardSuccessCallback = (res: GeneralCallbackResult) => void
  30523. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30524. type OpenChannelsActivityCompleteCallback = (
  30525. res: GeneralCallbackResult
  30526. ) => void
  30527. /** 接口调用失败的回调函数 */
  30528. type OpenChannelsActivityFailCallback = (res: GeneralCallbackResult) => void
  30529. /** 接口调用成功的回调函数 */
  30530. type OpenChannelsActivitySuccessCallback = (
  30531. res: GeneralCallbackResult
  30532. ) => void
  30533. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30534. type OpenChannelsEventCompleteCallback = (
  30535. res: GeneralCallbackResult
  30536. ) => void
  30537. /** 接口调用失败的回调函数 */
  30538. type OpenChannelsEventFailCallback = (res: GeneralCallbackResult) => void
  30539. /** 接口调用成功的回调函数 */
  30540. type OpenChannelsEventSuccessCallback = (res: GeneralCallbackResult) => void
  30541. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30542. type OpenChannelsLiveCompleteCallback = (res: GeneralCallbackResult) => void
  30543. /** 接口调用失败的回调函数 */
  30544. type OpenChannelsLiveFailCallback = (res: GeneralCallbackResult) => void
  30545. /** 接口调用成功的回调函数 */
  30546. type OpenChannelsLiveSuccessCallback = (res: GeneralCallbackResult) => void
  30547. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30548. type OpenChannelsUserProfileCompleteCallback = (
  30549. res: GeneralCallbackResult
  30550. ) => void
  30551. /** 接口调用失败的回调函数 */
  30552. type OpenChannelsUserProfileFailCallback = (
  30553. res: GeneralCallbackResult
  30554. ) => void
  30555. /** 接口调用成功的回调函数 */
  30556. type OpenChannelsUserProfileSuccessCallback = (
  30557. res: GeneralCallbackResult
  30558. ) => void
  30559. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30560. type OpenCompleteCallback = (res: FileError) => void
  30561. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30562. type OpenCustomerServiceChatCompleteCallback = (
  30563. res: GeneralCallbackResult
  30564. ) => void
  30565. /** 接口调用失败的回调函数 */
  30566. type OpenCustomerServiceChatFailCallback = (
  30567. res: GeneralCallbackResult
  30568. ) => void
  30569. /** 接口调用成功的回调函数 */
  30570. type OpenCustomerServiceChatSuccessCallback = (
  30571. res: GeneralCallbackResult
  30572. ) => void
  30573. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30574. type OpenDocumentCompleteCallback = (res: GeneralCallbackResult) => void
  30575. /** 接口调用失败的回调函数 */
  30576. type OpenDocumentFailCallback = (res: GeneralCallbackResult) => void
  30577. /** 接口调用成功的回调函数 */
  30578. type OpenDocumentSuccessCallback = (res: GeneralCallbackResult) => void
  30579. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30580. type OpenEmbeddedMiniProgramCompleteCallback = (
  30581. res: GeneralCallbackResult
  30582. ) => void
  30583. /** 接口调用失败的回调函数 */
  30584. type OpenEmbeddedMiniProgramFailCallback = (
  30585. res: GeneralCallbackResult
  30586. ) => void
  30587. /** 接口调用成功的回调函数 */
  30588. type OpenEmbeddedMiniProgramSuccessCallback = (
  30589. res: GeneralCallbackResult
  30590. ) => void
  30591. /** 接口调用失败的回调函数 */
  30592. type OpenFailCallback = (res: FileError) => void
  30593. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30594. type OpenLocationCompleteCallback = (res: GeneralCallbackResult) => void
  30595. /** 接口调用失败的回调函数 */
  30596. type OpenLocationFailCallback = (res: GeneralCallbackResult) => void
  30597. /** 接口调用成功的回调函数 */
  30598. type OpenLocationSuccessCallback = (res: GeneralCallbackResult) => void
  30599. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30600. type OpenMapAppCompleteCallback = (res: GeneralCallbackResult) => void
  30601. /** 接口调用失败的回调函数 */
  30602. type OpenMapAppFailCallback = (res: GeneralCallbackResult) => void
  30603. /** 接口调用成功的回调函数 */
  30604. type OpenMapAppSuccessCallback = (res: GeneralCallbackResult) => void
  30605. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30606. type OpenPrivacyContractCompleteCallback = (
  30607. res: GeneralCallbackResult
  30608. ) => void
  30609. /** 接口调用失败的回调函数 */
  30610. type OpenPrivacyContractFailCallback = (res: GeneralCallbackResult) => void
  30611. /** 接口调用成功的回调函数 */
  30612. type OpenPrivacyContractSuccessCallback = (
  30613. res: GeneralCallbackResult
  30614. ) => void
  30615. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30616. type OpenSettingCompleteCallback = (res: GeneralCallbackResult) => void
  30617. /** 接口调用失败的回调函数 */
  30618. type OpenSettingFailCallback = (res: GeneralCallbackResult) => void
  30619. /** 接口调用成功的回调函数 */
  30620. type OpenSettingSuccessCallback = (
  30621. result: OpenSettingSuccessCallbackResult
  30622. ) => void
  30623. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30624. type OpenSingleStickerViewCompleteCallback = (
  30625. res: GeneralCallbackResult
  30626. ) => void
  30627. /** 接口调用失败的回调函数 */
  30628. type OpenSingleStickerViewFailCallback = (
  30629. res: GeneralCallbackResult
  30630. ) => void
  30631. /** 接口调用成功的回调函数 */
  30632. type OpenSingleStickerViewSuccessCallback = (
  30633. res: GeneralCallbackResult
  30634. ) => void
  30635. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30636. type OpenStickerIPViewCompleteCallback = (
  30637. res: GeneralCallbackResult
  30638. ) => void
  30639. /** 接口调用失败的回调函数 */
  30640. type OpenStickerIPViewFailCallback = (res: GeneralCallbackResult) => void
  30641. /** 接口调用成功的回调函数 */
  30642. type OpenStickerIPViewSuccessCallback = (res: GeneralCallbackResult) => void
  30643. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30644. type OpenStickerSetViewCompleteCallback = (
  30645. res: GeneralCallbackResult
  30646. ) => void
  30647. /** 接口调用失败的回调函数 */
  30648. type OpenStickerSetViewFailCallback = (res: GeneralCallbackResult) => void
  30649. /** 接口调用成功的回调函数 */
  30650. type OpenStickerSetViewSuccessCallback = (
  30651. res: GeneralCallbackResult
  30652. ) => void
  30653. /** 接口调用成功的回调函数 */
  30654. type OpenSuccessCallback = (result: OpenSuccessCallbackResult) => void
  30655. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30656. type OpenSystemBluetoothSettingCompleteCallback = (
  30657. res: GeneralCallbackResult
  30658. ) => void
  30659. /** 接口调用失败的回调函数 */
  30660. type OpenSystemBluetoothSettingFailCallback = (
  30661. res: GeneralCallbackResult
  30662. ) => void
  30663. /** 接口调用成功的回调函数 */
  30664. type OpenSystemBluetoothSettingSuccessCallback = (
  30665. res: GeneralCallbackResult
  30666. ) => void
  30667. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30668. type OpenVideoEditorCompleteCallback = (res: GeneralCallbackResult) => void
  30669. /** 接口调用失败的回调函数 */
  30670. type OpenVideoEditorFailCallback = (res: GeneralCallbackResult) => void
  30671. /** 接口调用成功的回调函数 */
  30672. type OpenVideoEditorSuccessCallback = (
  30673. result: OpenVideoEditorSuccessCallbackResult
  30674. ) => void
  30675. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30676. type PageScrollToCompleteCallback = (res: GeneralCallbackResult) => void
  30677. /** 接口调用失败的回调函数 */
  30678. type PageScrollToFailCallback = (res: GeneralCallbackResult) => void
  30679. /** 接口调用成功的回调函数 */
  30680. type PageScrollToSuccessCallback = (res: GeneralCallbackResult) => void
  30681. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30682. type PauseBGMCompleteCallback = (res: GeneralCallbackResult) => void
  30683. /** 接口调用失败的回调函数 */
  30684. type PauseBGMFailCallback = (res: GeneralCallbackResult) => void
  30685. /** 接口调用成功的回调函数 */
  30686. type PauseBGMSuccessCallback = (res: GeneralCallbackResult) => void
  30687. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30688. type PauseBackgroundAudioCompleteCallback = (
  30689. res: GeneralCallbackResult
  30690. ) => void
  30691. /** 接口调用失败的回调函数 */
  30692. type PauseBackgroundAudioFailCallback = (res: GeneralCallbackResult) => void
  30693. /** 接口调用成功的回调函数 */
  30694. type PauseBackgroundAudioSuccessCallback = (
  30695. res: GeneralCallbackResult
  30696. ) => void
  30697. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30698. type PauseCompleteCallback = (res: GeneralCallbackResult) => void
  30699. /** 接口调用失败的回调函数 */
  30700. type PauseFailCallback = (res: GeneralCallbackResult) => void
  30701. /** 接口调用成功的回调函数 */
  30702. type PauseSuccessCallback = (res: GeneralCallbackResult) => void
  30703. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30704. type PauseVoiceCompleteCallback = (res: GeneralCallbackResult) => void
  30705. /** 接口调用失败的回调函数 */
  30706. type PauseVoiceFailCallback = (res: GeneralCallbackResult) => void
  30707. /** 接口调用成功的回调函数 */
  30708. type PauseVoiceSuccessCallback = (res: GeneralCallbackResult) => void
  30709. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30710. type PlayBGMCompleteCallback = (res: GeneralCallbackResult) => void
  30711. /** 接口调用失败的回调函数 */
  30712. type PlayBGMFailCallback = (res: GeneralCallbackResult) => void
  30713. /** 接口调用成功的回调函数 */
  30714. type PlayBGMSuccessCallback = (res: GeneralCallbackResult) => void
  30715. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30716. type PlayBackgroundAudioCompleteCallback = (
  30717. res: GeneralCallbackResult
  30718. ) => void
  30719. /** 接口调用失败的回调函数 */
  30720. type PlayBackgroundAudioFailCallback = (res: GeneralCallbackResult) => void
  30721. /** 接口调用成功的回调函数 */
  30722. type PlayBackgroundAudioSuccessCallback = (
  30723. res: GeneralCallbackResult
  30724. ) => void
  30725. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30726. type PlayCompleteCallback = (res: GeneralCallbackResult) => void
  30727. /** 接口调用失败的回调函数 */
  30728. type PlayFailCallback = (res: GeneralCallbackResult) => void
  30729. /** 接口调用成功的回调函数 */
  30730. type PlaySuccessCallback = (res: GeneralCallbackResult) => void
  30731. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30732. type PlayVoiceCompleteCallback = (res: GeneralCallbackResult) => void
  30733. /** 接口调用失败的回调函数 */
  30734. type PlayVoiceFailCallback = (res: GeneralCallbackResult) => void
  30735. /** 接口调用成功的回调函数 */
  30736. type PlayVoiceSuccessCallback = (res: GeneralCallbackResult) => void
  30737. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30738. type PluginLoginCompleteCallback = (res: GeneralCallbackResult) => void
  30739. /** 接口调用失败的回调函数 */
  30740. type PluginLoginFailCallback = (res: GeneralCallbackResult) => void
  30741. /** 接口调用成功的回调函数 */
  30742. type PluginLoginSuccessCallback = (
  30743. result: PluginLoginSuccessCallbackResult
  30744. ) => void
  30745. /** 分包加载进度变化事件的监听函数 */
  30746. type PreDownloadSubpackageTaskOnProgressUpdateCallback = (
  30747. result: PreDownloadSubpackageTaskOnProgressUpdateListenerResult
  30748. ) => void
  30749. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30750. type PreloadAssetsCompleteCallback = (res: GeneralCallbackResult) => void
  30751. /** 接口调用失败的回调函数 */
  30752. type PreloadAssetsFailCallback = (res: GeneralCallbackResult) => void
  30753. /** 接口调用成功的回调函数 */
  30754. type PreloadAssetsSuccessCallback = (res: GeneralCallbackResult) => void
  30755. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30756. type PreloadSkylineViewCompleteCallback = (
  30757. res: GeneralCallbackResult
  30758. ) => void
  30759. /** 接口调用失败的回调函数 */
  30760. type PreloadSkylineViewFailCallback = (res: GeneralCallbackResult) => void
  30761. /** 接口调用成功的回调函数 */
  30762. type PreloadSkylineViewSuccessCallback = (
  30763. res: GeneralCallbackResult
  30764. ) => void
  30765. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30766. type PreloadWebviewCompleteCallback = (res: GeneralCallbackResult) => void
  30767. /** 接口调用失败的回调函数 */
  30768. type PreloadWebviewFailCallback = (res: GeneralCallbackResult) => void
  30769. /** 接口调用成功的回调函数 */
  30770. type PreloadWebviewSuccessCallback = (res: GeneralCallbackResult) => void
  30771. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30772. type PreviewImageCompleteCallback = (res: GeneralCallbackResult) => void
  30773. /** 接口调用失败的回调函数 */
  30774. type PreviewImageFailCallback = (res: GeneralCallbackResult) => void
  30775. /** 接口调用成功的回调函数 */
  30776. type PreviewImageSuccessCallback = (res: GeneralCallbackResult) => void
  30777. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30778. type PreviewMediaCompleteCallback = (res: GeneralCallbackResult) => void
  30779. /** 接口调用失败的回调函数 */
  30780. type PreviewMediaFailCallback = (res: GeneralCallbackResult) => void
  30781. /** 接口调用成功的回调函数 */
  30782. type PreviewMediaSuccessCallback = (res: GeneralCallbackResult) => void
  30783. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30784. type ReLaunchCompleteCallback = (res: GeneralCallbackResult) => void
  30785. /** 接口调用失败的回调函数 */
  30786. type ReLaunchFailCallback = (res: GeneralCallbackResult) => void
  30787. /** 接口调用成功的回调函数 */
  30788. type ReLaunchSuccessCallback = (res: GeneralCallbackResult) => void
  30789. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30790. type ReadBLECharacteristicValueCompleteCallback = (
  30791. res: BluetoothError
  30792. ) => void
  30793. /** 接口调用失败的回调函数 */
  30794. type ReadBLECharacteristicValueFailCallback = (res: BluetoothError) => void
  30795. /** 接口调用成功的回调函数 */
  30796. type ReadBLECharacteristicValueSuccessCallback = (
  30797. res: BluetoothError
  30798. ) => void
  30799. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30800. type ReadCompleteCallback = (res: FileError) => void
  30801. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30802. type ReadCompressedFileCompleteCallback = (res: FileError) => void
  30803. /** 接口调用失败的回调函数 */
  30804. type ReadCompressedFileFailCallback = (res: FileError) => void
  30805. /** 接口调用成功的回调函数 */
  30806. type ReadCompressedFileSuccessCallback = (
  30807. result: ReadCompressedFileSuccessCallbackResult
  30808. ) => void
  30809. /** 接口调用失败的回调函数 */
  30810. type ReadFailCallback = (res: FileError) => void
  30811. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30812. type ReadFileCompleteCallback = (res: FileError) => void
  30813. /** 接口调用失败的回调函数 */
  30814. type ReadFileFailCallback = (res: FileError) => void
  30815. /** 接口调用成功的回调函数 */
  30816. type ReadFileSuccessCallback = (
  30817. result: ReadFileSuccessCallbackResult
  30818. ) => void
  30819. /** 接口调用成功的回调函数 */
  30820. type ReadSuccessCallback = (result: ReadSuccessCallbackResult) => void
  30821. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30822. type ReadZipEntryCompleteCallback = (res: FileError) => void
  30823. /** 接口调用失败的回调函数 */
  30824. type ReadZipEntryFailCallback = (res: FileError) => void
  30825. /** 接口调用成功的回调函数 */
  30826. type ReadZipEntrySuccessCallback = (
  30827. result: ReadZipEntrySuccessCallbackResult
  30828. ) => void
  30829. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30830. type ReaddirCompleteCallback = (res: FileError) => void
  30831. /** 接口调用失败的回调函数 */
  30832. type ReaddirFailCallback = (res: FileError) => void
  30833. /** 接口调用成功的回调函数 */
  30834. type ReaddirSuccessCallback = (result: ReaddirSuccessCallbackResult) => void
  30835. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30836. type ReconnectCastingCompleteCallback = (res: GeneralCallbackResult) => void
  30837. /** 接口调用失败的回调函数 */
  30838. type ReconnectCastingFailCallback = (res: GeneralCallbackResult) => void
  30839. /** 接口调用成功的回调函数 */
  30840. type ReconnectCastingSuccessCallback = (res: GeneralCallbackResult) => void
  30841. /** 录音结束事件的监听函数 */
  30842. type RecorderManagerOnStopCallback = (result: OnStopListenerResult) => void
  30843. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30844. type RedirectToCompleteCallback = (res: GeneralCallbackResult) => void
  30845. /** 接口调用失败的回调函数 */
  30846. type RedirectToFailCallback = (res: GeneralCallbackResult) => void
  30847. /** 接口调用成功的回调函数 */
  30848. type RedirectToSuccessCallback = (res: GeneralCallbackResult) => void
  30849. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30850. type RedoCompleteCallback = (res: GeneralCallbackResult) => void
  30851. /** 接口调用失败的回调函数 */
  30852. type RedoFailCallback = (res: GeneralCallbackResult) => void
  30853. /** 接口调用成功的回调函数 */
  30854. type RedoSuccessCallback = (res: GeneralCallbackResult) => void
  30855. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30856. type RemoveArcCompleteCallback = (res: GeneralCallbackResult) => void
  30857. /** 接口调用失败的回调函数 */
  30858. type RemoveArcFailCallback = (res: GeneralCallbackResult) => void
  30859. /** 接口调用成功的回调函数 */
  30860. type RemoveArcSuccessCallback = (res: GeneralCallbackResult) => void
  30861. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30862. type RemoveCustomLayerCompleteCallback = (
  30863. res: GeneralCallbackResult
  30864. ) => void
  30865. /** 接口调用失败的回调函数 */
  30866. type RemoveCustomLayerFailCallback = (res: GeneralCallbackResult) => void
  30867. /** 接口调用成功的回调函数 */
  30868. type RemoveCustomLayerSuccessCallback = (res: GeneralCallbackResult) => void
  30869. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30870. type RemoveFormatCompleteCallback = (res: GeneralCallbackResult) => void
  30871. /** 接口调用失败的回调函数 */
  30872. type RemoveFormatFailCallback = (res: GeneralCallbackResult) => void
  30873. /** 接口调用成功的回调函数 */
  30874. type RemoveFormatSuccessCallback = (res: GeneralCallbackResult) => void
  30875. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30876. type RemoveGroundOverlayCompleteCallback = (
  30877. res: GeneralCallbackResult
  30878. ) => void
  30879. /** 接口调用失败的回调函数 */
  30880. type RemoveGroundOverlayFailCallback = (res: GeneralCallbackResult) => void
  30881. /** 接口调用成功的回调函数 */
  30882. type RemoveGroundOverlaySuccessCallback = (
  30883. res: GeneralCallbackResult
  30884. ) => void
  30885. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30886. type RemoveMarkersCompleteCallback = (res: GeneralCallbackResult) => void
  30887. /** 接口调用失败的回调函数 */
  30888. type RemoveMarkersFailCallback = (res: GeneralCallbackResult) => void
  30889. /** 接口调用成功的回调函数 */
  30890. type RemoveMarkersSuccessCallback = (res: GeneralCallbackResult) => void
  30891. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30892. type RemoveSavedFileCompleteCallback = (res: FileError) => void
  30893. /** 接口调用失败的回调函数 */
  30894. type RemoveSavedFileFailCallback = (res: FileError) => void
  30895. /** 接口调用成功的回调函数 */
  30896. type RemoveSavedFileSuccessCallback = (res: FileError) => void
  30897. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30898. type RemoveServiceCompleteCallback = (res: GeneralCallbackResult) => void
  30899. /** 接口调用失败的回调函数 */
  30900. type RemoveServiceFailCallback = (res: GeneralCallbackResult) => void
  30901. /** 接口调用成功的回调函数 */
  30902. type RemoveServiceSuccessCallback = (res: GeneralCallbackResult) => void
  30903. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30904. type RemoveStorageCompleteCallback = (res: GeneralCallbackResult) => void
  30905. /** 接口调用失败的回调函数 */
  30906. type RemoveStorageFailCallback = (res: GeneralCallbackResult) => void
  30907. /** 接口调用成功的回调函数 */
  30908. type RemoveStorageSuccessCallback = (res: GeneralCallbackResult) => void
  30909. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30910. type RemoveTabBarBadgeCompleteCallback = (
  30911. res: GeneralCallbackResult
  30912. ) => void
  30913. /** 接口调用失败的回调函数 */
  30914. type RemoveTabBarBadgeFailCallback = (res: GeneralCallbackResult) => void
  30915. /** 接口调用成功的回调函数 */
  30916. type RemoveTabBarBadgeSuccessCallback = (res: GeneralCallbackResult) => void
  30917. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30918. type RemoveVisualLayerCompleteCallback = (
  30919. res: GeneralCallbackResult
  30920. ) => void
  30921. /** 接口调用失败的回调函数 */
  30922. type RemoveVisualLayerFailCallback = (res: GeneralCallbackResult) => void
  30923. /** 接口调用成功的回调函数 */
  30924. type RemoveVisualLayerSuccessCallback = (res: GeneralCallbackResult) => void
  30925. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30926. type RenameCompleteCallback = (res: FileError) => void
  30927. /** 接口调用失败的回调函数 */
  30928. type RenameFailCallback = (res: FileError) => void
  30929. /** 接口调用成功的回调函数 */
  30930. type RenameSuccessCallback = (res: FileError) => void
  30931. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30932. type RequestCommonPaymentCompleteCallback = (
  30933. res: CommonPaymentError
  30934. ) => void
  30935. /** 接口调用失败的回调函数 */
  30936. type RequestCommonPaymentFailCallback = (
  30937. err: RequestCommonPaymentFailCallbackErr
  30938. ) => void
  30939. /** 接口调用成功的回调函数 */
  30940. type RequestCommonPaymentSuccessCallback = (
  30941. result: RequestCommonPaymentSuccessCallbackResult
  30942. ) => void
  30943. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30944. type RequestCompleteCallback = (res: GeneralCallbackResult) => void
  30945. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30946. type RequestDeviceVoIPCompleteCallback = (
  30947. res: GeneralCallbackResult
  30948. ) => void
  30949. /** 接口调用失败的回调函数 */
  30950. type RequestDeviceVoIPFailCallback = (res: GeneralCallbackResult) => void
  30951. /** 接口调用成功的回调函数 */
  30952. type RequestDeviceVoIPSuccessCallback = (res: GeneralCallbackResult) => void
  30953. /** 接口调用失败的回调函数 */
  30954. type RequestFailCallback = (err: RequestFailCallbackErr) => void
  30955. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30956. type RequestFullScreenCompleteCallback = (
  30957. res: GeneralCallbackResult
  30958. ) => void
  30959. /** 接口调用失败的回调函数 */
  30960. type RequestFullScreenFailCallback = (res: GeneralCallbackResult) => void
  30961. /** 接口调用成功的回调函数 */
  30962. type RequestFullScreenSuccessCallback = (res: GeneralCallbackResult) => void
  30963. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30964. type RequestOrderPaymentCompleteCallback = (
  30965. res: GeneralCallbackResult
  30966. ) => void
  30967. /** 接口调用失败的回调函数 */
  30968. type RequestOrderPaymentFailCallback = (res: GeneralCallbackResult) => void
  30969. /** 接口调用成功的回调函数 */
  30970. type RequestOrderPaymentSuccessCallback = (
  30971. res: GeneralCallbackResult
  30972. ) => void
  30973. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30974. type RequestPaymentCompleteCallback = (res: GeneralCallbackResult) => void
  30975. /** 接口调用失败的回调函数 */
  30976. type RequestPaymentFailCallback = (res: GeneralCallbackResult) => void
  30977. /** 接口调用成功的回调函数 */
  30978. type RequestPaymentSuccessCallback = (res: GeneralCallbackResult) => void
  30979. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30980. type RequestPictureInPictureCompleteCallback = (
  30981. res: GeneralCallbackResult
  30982. ) => void
  30983. /** 接口调用失败的回调函数 */
  30984. type RequestPictureInPictureFailCallback = (
  30985. res: GeneralCallbackResult
  30986. ) => void
  30987. /** 接口调用成功的回调函数 */
  30988. type RequestPictureInPictureSuccessCallback = (
  30989. res: GeneralCallbackResult
  30990. ) => void
  30991. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  30992. type RequestPluginPaymentCompleteCallback = (
  30993. res: GeneralCallbackResult
  30994. ) => void
  30995. /** 接口调用失败的回调函数 */
  30996. type RequestPluginPaymentFailCallback = (res: GeneralCallbackResult) => void
  30997. /** 接口调用成功的回调函数 */
  30998. type RequestPluginPaymentSuccessCallback = (
  30999. res: GeneralCallbackResult
  31000. ) => void
  31001. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31002. type RequestSubscribeDeviceMessageCompleteCallback = (
  31003. res: GeneralCallbackResult
  31004. ) => void
  31005. /** 接口调用失败的回调函数 */
  31006. type RequestSubscribeDeviceMessageFailCallback = (
  31007. result: RequestSubscribeDeviceMessageFailCallbackResult
  31008. ) => void
  31009. /** 接口调用成功的回调函数 */
  31010. type RequestSubscribeDeviceMessageSuccessCallback = (
  31011. result: RequestSubscribeDeviceMessageSuccessCallbackResult
  31012. ) => void
  31013. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31014. type RequestSubscribeMessageCompleteCallback = (
  31015. res: GeneralCallbackResult
  31016. ) => void
  31017. /** 接口调用失败的回调函数 */
  31018. type RequestSubscribeMessageFailCallback = (
  31019. result: RequestSubscribeMessageFailCallbackResult
  31020. ) => void
  31021. /** 接口调用成功的回调函数 */
  31022. type RequestSubscribeMessageSuccessCallback = (
  31023. result: RequestSubscribeMessageSuccessCallbackResult
  31024. ) => void
  31025. /** 接口调用成功的回调函数 */
  31026. type RequestSuccessCallback<
  31027. T extends string | IAnyObject | ArrayBuffer =
  31028. | string
  31029. | IAnyObject
  31030. | ArrayBuffer
  31031. > = (result: RequestSuccessCallbackResult<T>) => void
  31032. /** onHeadersReceived 传入的监听函数。不传此参数则移除所有监听函数。 */
  31033. type RequestTaskOffHeadersReceivedCallback = (
  31034. result: RequestTaskOnHeadersReceivedListenerResult
  31035. ) => void
  31036. /** HTTP Response Header 事件的监听函数 */
  31037. type RequestTaskOnHeadersReceivedCallback = (
  31038. result: RequestTaskOnHeadersReceivedListenerResult
  31039. ) => void
  31040. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31041. type RequestVirtualPaymentCompleteCallback = (
  31042. res: VirtualPaymentError
  31043. ) => void
  31044. /** 接口调用失败的回调函数 */
  31045. type RequestVirtualPaymentFailCallback = (
  31046. err: RequestCommonPaymentFailCallbackErr
  31047. ) => void
  31048. /** 接口调用成功的回调函数 */
  31049. type RequestVirtualPaymentSuccessCallback = (
  31050. result: RequestCommonPaymentSuccessCallbackResult
  31051. ) => void
  31052. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31053. type RequirePrivacyAuthorizeCompleteCallback = (
  31054. res: GeneralCallbackResult
  31055. ) => void
  31056. /** 接口调用失败的回调函数 */
  31057. type RequirePrivacyAuthorizeFailCallback = (
  31058. res: GeneralCallbackResult
  31059. ) => void
  31060. /** 接口调用成功的回调函数 */
  31061. type RequirePrivacyAuthorizeSuccessCallback = (
  31062. res: GeneralCallbackResult
  31063. ) => void
  31064. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31065. type RestartMiniProgramCompleteCallback = (
  31066. res: GeneralCallbackResult
  31067. ) => void
  31068. /** 接口调用失败的回调函数 */
  31069. type RestartMiniProgramFailCallback = (res: GeneralCallbackResult) => void
  31070. /** 接口调用成功的回调函数 */
  31071. type RestartMiniProgramSuccessCallback = (
  31072. res: GeneralCallbackResult
  31073. ) => void
  31074. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31075. type ResumeBGMCompleteCallback = (res: GeneralCallbackResult) => void
  31076. /** 接口调用失败的回调函数 */
  31077. type ResumeBGMFailCallback = (res: GeneralCallbackResult) => void
  31078. /** 接口调用成功的回调函数 */
  31079. type ResumeBGMSuccessCallback = (res: GeneralCallbackResult) => void
  31080. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31081. type ResumeCompleteCallback = (res: GeneralCallbackResult) => void
  31082. /** 接口调用失败的回调函数 */
  31083. type ResumeFailCallback = (res: GeneralCallbackResult) => void
  31084. /** 接口调用成功的回调函数 */
  31085. type ResumeSuccessCallback = (res: GeneralCallbackResult) => void
  31086. /** onClose 传入的监听函数。不传此参数则移除所有监听函数。 */
  31087. type RewardedVideoAdOffCloseCallback = (
  31088. result: RewardedVideoAdOnCloseListenerResult
  31089. ) => void
  31090. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  31091. type RewardedVideoAdOffErrorCallback = (
  31092. result: RewardedVideoAdOnErrorListenerResult
  31093. ) => void
  31094. /** 用户点击 `关闭广告` 按钮的事件的监听函数 */
  31095. type RewardedVideoAdOnCloseCallback = (
  31096. result: RewardedVideoAdOnCloseListenerResult
  31097. ) => void
  31098. /** 激励视频错误事件的监听函数 */
  31099. type RewardedVideoAdOnErrorCallback = (
  31100. result: RewardedVideoAdOnErrorListenerResult
  31101. ) => void
  31102. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31103. type RmdirCompleteCallback = (res: FileError) => void
  31104. /** 接口调用失败的回调函数 */
  31105. type RmdirFailCallback = (res: FileError) => void
  31106. /** 接口调用成功的回调函数 */
  31107. type RmdirSuccessCallback = (res: FileError) => void
  31108. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31109. type SaveFileCompleteCallback = (res: FileError) => void
  31110. /** 接口调用失败的回调函数 */
  31111. type SaveFileFailCallback = (res: FileError) => void
  31112. /** 接口调用成功的回调函数 */
  31113. type SaveFileSuccessCallback = (
  31114. result: SaveFileSuccessCallbackResult
  31115. ) => void
  31116. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31117. type SaveFileToDiskCompleteCallback = (res: GeneralCallbackResult) => void
  31118. /** 接口调用失败的回调函数 */
  31119. type SaveFileToDiskFailCallback = (res: GeneralCallbackResult) => void
  31120. /** 接口调用成功的回调函数 */
  31121. type SaveFileToDiskSuccessCallback = (res: GeneralCallbackResult) => void
  31122. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31123. type SaveImageToPhotosAlbumCompleteCallback = (
  31124. res: GeneralCallbackResult
  31125. ) => void
  31126. /** 接口调用失败的回调函数 */
  31127. type SaveImageToPhotosAlbumFailCallback = (
  31128. res: GeneralCallbackResult
  31129. ) => void
  31130. /** 接口调用成功的回调函数 */
  31131. type SaveImageToPhotosAlbumSuccessCallback = (
  31132. res: GeneralCallbackResult
  31133. ) => void
  31134. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31135. type SaveVideoToPhotosAlbumCompleteCallback = (
  31136. res: GeneralCallbackResult
  31137. ) => void
  31138. /** 接口调用失败的回调函数 */
  31139. type SaveVideoToPhotosAlbumFailCallback = (
  31140. res: GeneralCallbackResult
  31141. ) => void
  31142. /** 接口调用成功的回调函数 */
  31143. type SaveVideoToPhotosAlbumSuccessCallback = (
  31144. res: GeneralCallbackResult
  31145. ) => void
  31146. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31147. type ScanCodeCompleteCallback = (res: GeneralCallbackResult) => void
  31148. /** 接口调用失败的回调函数 */
  31149. type ScanCodeFailCallback = (res: GeneralCallbackResult) => void
  31150. /** 接口调用成功的回调函数 */
  31151. type ScanCodeSuccessCallback = (
  31152. result: ScanCodeSuccessCallbackResult
  31153. ) => void
  31154. /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */
  31155. type ScrollOffsetCallback = (result: ScrollOffsetCallbackResult) => void
  31156. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31157. type SeekBackgroundAudioCompleteCallback = (
  31158. res: GeneralCallbackResult
  31159. ) => void
  31160. /** 接口调用失败的回调函数 */
  31161. type SeekBackgroundAudioFailCallback = (res: GeneralCallbackResult) => void
  31162. /** 接口调用成功的回调函数 */
  31163. type SeekBackgroundAudioSuccessCallback = (
  31164. res: GeneralCallbackResult
  31165. ) => void
  31166. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31167. type SendCompleteCallback = (res: GeneralCallbackResult) => void
  31168. /** 接口调用失败的回调函数 */
  31169. type SendFailCallback = (res: GeneralCallbackResult) => void
  31170. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31171. type SendHCEMessageCompleteCallback = (res: NFCError) => void
  31172. /** 接口调用失败的回调函数 */
  31173. type SendHCEMessageFailCallback = (res: NFCError) => void
  31174. /** 接口调用成功的回调函数 */
  31175. type SendHCEMessageSuccessCallback = (res: NFCError) => void
  31176. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31177. type SendMessageCompleteCallback = (res: GeneralCallbackResult) => void
  31178. /** 接口调用失败的回调函数 */
  31179. type SendMessageFailCallback = (res: GeneralCallbackResult) => void
  31180. /** 接口调用成功的回调函数 */
  31181. type SendMessageSuccessCallback = (res: GeneralCallbackResult) => void
  31182. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31183. type SendSmsCompleteCallback = (res: GeneralCallbackResult) => void
  31184. /** 接口调用失败的回调函数 */
  31185. type SendSmsFailCallback = (res: GeneralCallbackResult) => void
  31186. /** 接口调用成功的回调函数 */
  31187. type SendSmsSuccessCallback = (res: GeneralCallbackResult) => void
  31188. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31189. type SendSocketMessageCompleteCallback = (
  31190. res: GeneralCallbackResult
  31191. ) => void
  31192. /** 接口调用失败的回调函数 */
  31193. type SendSocketMessageFailCallback = (res: GeneralCallbackResult) => void
  31194. /** 接口调用成功的回调函数 */
  31195. type SendSocketMessageSuccessCallback = (res: GeneralCallbackResult) => void
  31196. /** 接口调用成功的回调函数 */
  31197. type SendSuccessCallback = (res: GeneralCallbackResult) => void
  31198. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31199. type SetBGMVolumeCompleteCallback = (res: GeneralCallbackResult) => void
  31200. /** 接口调用失败的回调函数 */
  31201. type SetBGMVolumeFailCallback = (res: GeneralCallbackResult) => void
  31202. /** 接口调用成功的回调函数 */
  31203. type SetBGMVolumeSuccessCallback = (res: GeneralCallbackResult) => void
  31204. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31205. type SetBLEMTUCompleteCallback = (res: GeneralCallbackResult) => void
  31206. /** 接口调用失败的回调函数 */
  31207. type SetBLEMTUFailCallback = (result: SetBLEMTUFailCallbackResult) => void
  31208. /** 接口调用成功的回调函数 */
  31209. type SetBLEMTUSuccessCallback = (
  31210. result: SetBLEMTUSuccessCallbackResult
  31211. ) => void
  31212. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31213. type SetBackgroundColorCompleteCallback = (
  31214. res: GeneralCallbackResult
  31215. ) => void
  31216. /** 接口调用失败的回调函数 */
  31217. type SetBackgroundColorFailCallback = (res: GeneralCallbackResult) => void
  31218. /** 接口调用成功的回调函数 */
  31219. type SetBackgroundColorSuccessCallback = (
  31220. res: GeneralCallbackResult
  31221. ) => void
  31222. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31223. type SetBackgroundFetchTokenCompleteCallback = (
  31224. res: GeneralCallbackResult
  31225. ) => void
  31226. /** 接口调用失败的回调函数 */
  31227. type SetBackgroundFetchTokenFailCallback = (
  31228. res: GeneralCallbackResult
  31229. ) => void
  31230. /** 接口调用成功的回调函数 */
  31231. type SetBackgroundFetchTokenSuccessCallback = (
  31232. res: GeneralCallbackResult
  31233. ) => void
  31234. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31235. type SetBackgroundTextStyleCompleteCallback = (
  31236. res: GeneralCallbackResult
  31237. ) => void
  31238. /** 接口调用失败的回调函数 */
  31239. type SetBackgroundTextStyleFailCallback = (
  31240. res: GeneralCallbackResult
  31241. ) => void
  31242. /** 接口调用成功的回调函数 */
  31243. type SetBackgroundTextStyleSuccessCallback = (
  31244. res: GeneralCallbackResult
  31245. ) => void
  31246. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31247. type SetBoundaryCompleteCallback = (res: GeneralCallbackResult) => void
  31248. /** 接口调用失败的回调函数 */
  31249. type SetBoundaryFailCallback = (res: GeneralCallbackResult) => void
  31250. /** 接口调用成功的回调函数 */
  31251. type SetBoundarySuccessCallback = (res: GeneralCallbackResult) => void
  31252. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31253. type SetCenterOffsetCompleteCallback = (res: GeneralCallbackResult) => void
  31254. /** 接口调用失败的回调函数 */
  31255. type SetCenterOffsetFailCallback = (res: GeneralCallbackResult) => void
  31256. /** 接口调用成功的回调函数 */
  31257. type SetCenterOffsetSuccessCallback = (res: GeneralCallbackResult) => void
  31258. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31259. type SetClipboardDataCompleteCallback = (res: GeneralCallbackResult) => void
  31260. /** 接口调用失败的回调函数 */
  31261. type SetClipboardDataFailCallback = (res: GeneralCallbackResult) => void
  31262. /** 接口调用成功的回调函数 */
  31263. type SetClipboardDataSuccessCallback = (res: GeneralCallbackResult) => void
  31264. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31265. type SetContentsCompleteCallback = (res: GeneralCallbackResult) => void
  31266. /** 接口调用失败的回调函数 */
  31267. type SetContentsFailCallback = (res: GeneralCallbackResult) => void
  31268. /** 接口调用成功的回调函数 */
  31269. type SetContentsSuccessCallback = (res: GeneralCallbackResult) => void
  31270. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31271. type SetEnable1v1ChatCompleteCallback = (res: GeneralCallbackResult) => void
  31272. /** 接口调用失败的回调函数 */
  31273. type SetEnable1v1ChatFailCallback = (res: GeneralCallbackResult) => void
  31274. /** 接口调用成功的回调函数 */
  31275. type SetEnable1v1ChatSuccessCallback = (res: GeneralCallbackResult) => void
  31276. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31277. type SetEnableDebugCompleteCallback = (res: GeneralCallbackResult) => void
  31278. /** 接口调用失败的回调函数 */
  31279. type SetEnableDebugFailCallback = (res: GeneralCallbackResult) => void
  31280. /** 接口调用成功的回调函数 */
  31281. type SetEnableDebugSuccessCallback = (res: GeneralCallbackResult) => void
  31282. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31283. type SetInnerAudioOptionCompleteCallback = (
  31284. res: GeneralCallbackResult
  31285. ) => void
  31286. /** 接口调用失败的回调函数 */
  31287. type SetInnerAudioOptionFailCallback = (res: GeneralCallbackResult) => void
  31288. /** 接口调用成功的回调函数 */
  31289. type SetInnerAudioOptionSuccessCallback = (
  31290. res: GeneralCallbackResult
  31291. ) => void
  31292. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31293. type SetKeepScreenOnCompleteCallback = (res: GeneralCallbackResult) => void
  31294. /** 接口调用失败的回调函数 */
  31295. type SetKeepScreenOnFailCallback = (res: GeneralCallbackResult) => void
  31296. /** 接口调用成功的回调函数 */
  31297. type SetKeepScreenOnSuccessCallback = (res: GeneralCallbackResult) => void
  31298. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31299. type SetLocMarkerIconCompleteCallback = (res: GeneralCallbackResult) => void
  31300. /** 接口调用失败的回调函数 */
  31301. type SetLocMarkerIconFailCallback = (res: GeneralCallbackResult) => void
  31302. /** 接口调用成功的回调函数 */
  31303. type SetLocMarkerIconSuccessCallback = (res: GeneralCallbackResult) => void
  31304. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31305. type SetMICVolumeCompleteCallback = (res: GeneralCallbackResult) => void
  31306. /** 接口调用失败的回调函数 */
  31307. type SetMICVolumeFailCallback = (res: GeneralCallbackResult) => void
  31308. /** 接口调用成功的回调函数 */
  31309. type SetMICVolumeSuccessCallback = (res: GeneralCallbackResult) => void
  31310. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31311. type SetNavigationBarColorCompleteCallback = (
  31312. res: GeneralCallbackResult
  31313. ) => void
  31314. /** 接口调用失败的回调函数 */
  31315. type SetNavigationBarColorFailCallback = (
  31316. res: GeneralCallbackResult
  31317. ) => void
  31318. /** 接口调用成功的回调函数 */
  31319. type SetNavigationBarColorSuccessCallback = (
  31320. res: GeneralCallbackResult
  31321. ) => void
  31322. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31323. type SetNavigationBarTitleCompleteCallback = (
  31324. res: GeneralCallbackResult
  31325. ) => void
  31326. /** 接口调用失败的回调函数 */
  31327. type SetNavigationBarTitleFailCallback = (
  31328. res: GeneralCallbackResult
  31329. ) => void
  31330. /** 接口调用成功的回调函数 */
  31331. type SetNavigationBarTitleSuccessCallback = (
  31332. res: GeneralCallbackResult
  31333. ) => void
  31334. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31335. type SetScreenBrightnessCompleteCallback = (
  31336. res: GeneralCallbackResult
  31337. ) => void
  31338. /** 接口调用失败的回调函数 */
  31339. type SetScreenBrightnessFailCallback = (res: GeneralCallbackResult) => void
  31340. /** 接口调用成功的回调函数 */
  31341. type SetScreenBrightnessSuccessCallback = (
  31342. res: GeneralCallbackResult
  31343. ) => void
  31344. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31345. type SetStorageCompleteCallback = (res: GeneralCallbackResult) => void
  31346. /** 接口调用失败的回调函数 */
  31347. type SetStorageFailCallback = (res: GeneralCallbackResult) => void
  31348. /** 接口调用成功的回调函数 */
  31349. type SetStorageSuccessCallback = (res: GeneralCallbackResult) => void
  31350. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31351. type SetTabBarBadgeCompleteCallback = (res: GeneralCallbackResult) => void
  31352. /** 接口调用失败的回调函数 */
  31353. type SetTabBarBadgeFailCallback = (res: GeneralCallbackResult) => void
  31354. /** 接口调用成功的回调函数 */
  31355. type SetTabBarBadgeSuccessCallback = (res: GeneralCallbackResult) => void
  31356. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31357. type SetTabBarItemCompleteCallback = (res: GeneralCallbackResult) => void
  31358. /** 接口调用失败的回调函数 */
  31359. type SetTabBarItemFailCallback = (res: GeneralCallbackResult) => void
  31360. /** 接口调用成功的回调函数 */
  31361. type SetTabBarItemSuccessCallback = (res: GeneralCallbackResult) => void
  31362. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31363. type SetTabBarStyleCompleteCallback = (res: GeneralCallbackResult) => void
  31364. /** 接口调用失败的回调函数 */
  31365. type SetTabBarStyleFailCallback = (res: GeneralCallbackResult) => void
  31366. /** 接口调用成功的回调函数 */
  31367. type SetTabBarStyleSuccessCallback = (res: GeneralCallbackResult) => void
  31368. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31369. type SetTimeoutCompleteCallback = (res: Nfcrwerror) => void
  31370. /** 接口调用失败的回调函数 */
  31371. type SetTimeoutFailCallback = (res: Nfcrwerror) => void
  31372. /** 接口调用成功的回调函数 */
  31373. type SetTimeoutSuccessCallback = (res: Nfcrwerror) => void
  31374. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31375. type SetTopBarTextCompleteCallback = (res: GeneralCallbackResult) => void
  31376. /** 接口调用失败的回调函数 */
  31377. type SetTopBarTextFailCallback = (res: GeneralCallbackResult) => void
  31378. /** 接口调用成功的回调函数 */
  31379. type SetTopBarTextSuccessCallback = (res: GeneralCallbackResult) => void
  31380. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31381. type SetVisualEffectOnCaptureCompleteCallback = (
  31382. res: GeneralCallbackResult
  31383. ) => void
  31384. /** 接口调用失败的回调函数 */
  31385. type SetVisualEffectOnCaptureFailCallback = (
  31386. res: GeneralCallbackResult
  31387. ) => void
  31388. /** 接口调用成功的回调函数 */
  31389. type SetVisualEffectOnCaptureSuccessCallback = (
  31390. res: GeneralCallbackResult
  31391. ) => void
  31392. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31393. type SetWifiListCompleteCallback = (res: WifiError) => void
  31394. /** 接口调用失败的回调函数 */
  31395. type SetWifiListFailCallback = (res: WifiError) => void
  31396. /** 接口调用成功的回调函数 */
  31397. type SetWifiListSuccessCallback = (res: WifiError) => void
  31398. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31399. type SetWindowSizeCompleteCallback = (res: GeneralCallbackResult) => void
  31400. /** 接口调用失败的回调函数 */
  31401. type SetWindowSizeFailCallback = (res: GeneralCallbackResult) => void
  31402. /** 接口调用成功的回调函数 */
  31403. type SetWindowSizeSuccessCallback = (res: GeneralCallbackResult) => void
  31404. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31405. type SetZoomCompleteCallback = (res: GeneralCallbackResult) => void
  31406. /** 接口调用失败的回调函数 */
  31407. type SetZoomFailCallback = (res: GeneralCallbackResult) => void
  31408. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31409. type ShareFileMessageCompleteCallback = (res: GeneralCallbackResult) => void
  31410. /** 接口调用失败的回调函数 */
  31411. type ShareFileMessageFailCallback = (res: GeneralCallbackResult) => void
  31412. /** 接口调用成功的回调函数 */
  31413. type ShareFileMessageSuccessCallback = (res: GeneralCallbackResult) => void
  31414. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31415. type ShareToWeRunCompleteCallback = (res: GeneralCallbackResult) => void
  31416. /** 接口调用失败的回调函数 */
  31417. type ShareToWeRunFailCallback = (res: GeneralCallbackResult) => void
  31418. /** 接口调用成功的回调函数 */
  31419. type ShareToWeRunSuccessCallback = (res: GeneralCallbackResult) => void
  31420. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31421. type ShareVideoMessageCompleteCallback = (
  31422. res: GeneralCallbackResult
  31423. ) => void
  31424. /** 接口调用失败的回调函数 */
  31425. type ShareVideoMessageFailCallback = (res: GeneralCallbackResult) => void
  31426. /** 接口调用成功的回调函数 */
  31427. type ShareVideoMessageSuccessCallback = (res: GeneralCallbackResult) => void
  31428. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31429. type ShowActionSheetCompleteCallback = (res: GeneralCallbackResult) => void
  31430. /** 接口调用失败的回调函数 */
  31431. type ShowActionSheetFailCallback = (res: GeneralCallbackResult) => void
  31432. /** 接口调用成功的回调函数 */
  31433. type ShowActionSheetSuccessCallback = (
  31434. result: ShowActionSheetSuccessCallbackResult
  31435. ) => void
  31436. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31437. type ShowLoadingCompleteCallback = (res: GeneralCallbackResult) => void
  31438. /** 接口调用失败的回调函数 */
  31439. type ShowLoadingFailCallback = (res: GeneralCallbackResult) => void
  31440. /** 接口调用成功的回调函数 */
  31441. type ShowLoadingSuccessCallback = (res: GeneralCallbackResult) => void
  31442. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31443. type ShowModalCompleteCallback = (res: GeneralCallbackResult) => void
  31444. /** 接口调用失败的回调函数 */
  31445. type ShowModalFailCallback = (res: GeneralCallbackResult) => void
  31446. /** 接口调用成功的回调函数 */
  31447. type ShowModalSuccessCallback = (
  31448. result: ShowModalSuccessCallbackResult
  31449. ) => void
  31450. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31451. type ShowNavigationBarLoadingCompleteCallback = (
  31452. res: GeneralCallbackResult
  31453. ) => void
  31454. /** 接口调用失败的回调函数 */
  31455. type ShowNavigationBarLoadingFailCallback = (
  31456. res: GeneralCallbackResult
  31457. ) => void
  31458. /** 接口调用成功的回调函数 */
  31459. type ShowNavigationBarLoadingSuccessCallback = (
  31460. res: GeneralCallbackResult
  31461. ) => void
  31462. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31463. type ShowRedPackageCompleteCallback = (res: GeneralCallbackResult) => void
  31464. /** 接口调用失败的回调函数 */
  31465. type ShowRedPackageFailCallback = (res: GeneralCallbackResult) => void
  31466. /** 接口调用成功的回调函数 */
  31467. type ShowRedPackageSuccessCallback = (res: GeneralCallbackResult) => void
  31468. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31469. type ShowShareImageMenuCompleteCallback = (
  31470. res: GeneralCallbackResult
  31471. ) => void
  31472. /** 接口调用失败的回调函数 */
  31473. type ShowShareImageMenuFailCallback = (res: GeneralCallbackResult) => void
  31474. /** 接口调用成功的回调函数 */
  31475. type ShowShareImageMenuSuccessCallback = (
  31476. res: GeneralCallbackResult
  31477. ) => void
  31478. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31479. type ShowShareMenuCompleteCallback = (res: GeneralCallbackResult) => void
  31480. /** 接口调用失败的回调函数 */
  31481. type ShowShareMenuFailCallback = (res: GeneralCallbackResult) => void
  31482. /** 接口调用成功的回调函数 */
  31483. type ShowShareMenuSuccessCallback = (res: GeneralCallbackResult) => void
  31484. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31485. type ShowTabBarCompleteCallback = (res: GeneralCallbackResult) => void
  31486. /** 接口调用失败的回调函数 */
  31487. type ShowTabBarFailCallback = (res: GeneralCallbackResult) => void
  31488. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31489. type ShowTabBarRedDotCompleteCallback = (res: GeneralCallbackResult) => void
  31490. /** 接口调用失败的回调函数 */
  31491. type ShowTabBarRedDotFailCallback = (res: GeneralCallbackResult) => void
  31492. /** 接口调用成功的回调函数 */
  31493. type ShowTabBarRedDotSuccessCallback = (res: GeneralCallbackResult) => void
  31494. /** 接口调用成功的回调函数 */
  31495. type ShowTabBarSuccessCallback = (res: GeneralCallbackResult) => void
  31496. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31497. type ShowToastCompleteCallback = (res: GeneralCallbackResult) => void
  31498. /** 接口调用失败的回调函数 */
  31499. type ShowToastFailCallback = (res: GeneralCallbackResult) => void
  31500. /** 接口调用成功的回调函数 */
  31501. type ShowToastSuccessCallback = (res: GeneralCallbackResult) => void
  31502. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31503. type SnapshotCompleteCallback = (res: GeneralCallbackResult) => void
  31504. /** 接口调用失败的回调函数 */
  31505. type SnapshotFailCallback = (res: GeneralCallbackResult) => void
  31506. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31507. type SocketTaskCloseCompleteCallback = (res: GeneralCallbackResult) => void
  31508. /** 接口调用失败的回调函数 */
  31509. type SocketTaskCloseFailCallback = (res: GeneralCallbackResult) => void
  31510. /** 接口调用成功的回调函数 */
  31511. type SocketTaskCloseSuccessCallback = (res: GeneralCallbackResult) => void
  31512. /** WebSocket 连接关闭事件的监听函数 */
  31513. type SocketTaskOnCloseCallback = (
  31514. result: SocketTaskOnCloseListenerResult
  31515. ) => void
  31516. /** WebSocket 接收到服务器的消息事件的监听函数 */
  31517. type SocketTaskOnMessageCallback = (
  31518. result: SocketTaskOnMessageListenerResult
  31519. ) => void
  31520. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31521. type StartAccelerometerCompleteCallback = (
  31522. res: GeneralCallbackResult
  31523. ) => void
  31524. /** 接口调用失败的回调函数 */
  31525. type StartAccelerometerFailCallback = (res: GeneralCallbackResult) => void
  31526. /** 接口调用成功的回调函数 */
  31527. type StartAccelerometerSuccessCallback = (
  31528. res: GeneralCallbackResult
  31529. ) => void
  31530. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31531. type StartAdvertisingCompleteCallback = (res: GeneralCallbackResult) => void
  31532. /** 接口调用失败的回调函数 */
  31533. type StartAdvertisingFailCallback = (res: GeneralCallbackResult) => void
  31534. /** 接口调用成功的回调函数 */
  31535. type StartAdvertisingSuccessCallback = (res: GeneralCallbackResult) => void
  31536. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31537. type StartBeaconDiscoveryCompleteCallback = (res: BeaconError) => void
  31538. /** 接口调用失败的回调函数 */
  31539. type StartBeaconDiscoveryFailCallback = (res: BeaconError) => void
  31540. /** 接口调用成功的回调函数 */
  31541. type StartBeaconDiscoverySuccessCallback = (res: BeaconError) => void
  31542. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31543. type StartBluetoothDevicesDiscoveryCompleteCallback = (
  31544. res: BluetoothError
  31545. ) => void
  31546. /** 接口调用失败的回调函数 */
  31547. type StartBluetoothDevicesDiscoveryFailCallback = (
  31548. res: BluetoothError
  31549. ) => void
  31550. /** 接口调用成功的回调函数 */
  31551. type StartBluetoothDevicesDiscoverySuccessCallback = (
  31552. res: BluetoothError
  31553. ) => void
  31554. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31555. type StartCastingCompleteCallback = (res: GeneralCallbackResult) => void
  31556. /** 接口调用失败的回调函数 */
  31557. type StartCastingFailCallback = (res: GeneralCallbackResult) => void
  31558. /** 接口调用成功的回调函数 */
  31559. type StartCastingSuccessCallback = (res: GeneralCallbackResult) => void
  31560. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31561. type StartCompassCompleteCallback = (res: GeneralCallbackResult) => void
  31562. /** 接口调用失败的回调函数 */
  31563. type StartCompassFailCallback = (res: GeneralCallbackResult) => void
  31564. /** 接口调用成功的回调函数 */
  31565. type StartCompassSuccessCallback = (res: GeneralCallbackResult) => void
  31566. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31567. type StartCompleteCallback = (res: GeneralCallbackResult) => void
  31568. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31569. type StartDeviceMotionListeningCompleteCallback = (
  31570. res: GeneralCallbackResult
  31571. ) => void
  31572. /** 接口调用失败的回调函数 */
  31573. type StartDeviceMotionListeningFailCallback = (
  31574. res: GeneralCallbackResult
  31575. ) => void
  31576. /** 接口调用成功的回调函数 */
  31577. type StartDeviceMotionListeningSuccessCallback = (
  31578. res: GeneralCallbackResult
  31579. ) => void
  31580. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31581. type StartDiscoveryCompleteCallback = (res: Nfcrwerror) => void
  31582. /** 接口调用失败的回调函数 */
  31583. type StartDiscoveryFailCallback = (res: Nfcrwerror) => void
  31584. /** 接口调用成功的回调函数 */
  31585. type StartDiscoverySuccessCallback = (res: Nfcrwerror) => void
  31586. /** 接口调用失败的回调函数 */
  31587. type StartFailCallback = (res: GeneralCallbackResult) => void
  31588. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31589. type StartGyroscopeCompleteCallback = (res: GeneralCallbackResult) => void
  31590. /** 接口调用失败的回调函数 */
  31591. type StartGyroscopeFailCallback = (res: GeneralCallbackResult) => void
  31592. /** 接口调用成功的回调函数 */
  31593. type StartGyroscopeSuccessCallback = (res: GeneralCallbackResult) => void
  31594. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31595. type StartHCECompleteCallback = (res: NFCError) => void
  31596. /** 接口调用失败的回调函数 */
  31597. type StartHCEFailCallback = (res: NFCError) => void
  31598. /** 接口调用成功的回调函数 */
  31599. type StartHCESuccessCallback = (res: NFCError) => void
  31600. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31601. type StartLocalServiceDiscoveryCompleteCallback = (
  31602. res: GeneralCallbackResult
  31603. ) => void
  31604. /** 接口调用失败的回调函数 */
  31605. type StartLocalServiceDiscoveryFailCallback = (
  31606. result: StartLocalServiceDiscoveryFailCallbackResult
  31607. ) => void
  31608. /** 接口调用成功的回调函数 */
  31609. type StartLocalServiceDiscoverySuccessCallback = (
  31610. res: GeneralCallbackResult
  31611. ) => void
  31612. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31613. type StartLocationUpdateBackgroundCompleteCallback = (
  31614. res: GeneralCallbackResult
  31615. ) => void
  31616. /** 接口调用失败的回调函数 */
  31617. type StartLocationUpdateBackgroundFailCallback = (
  31618. res: GeneralCallbackResult
  31619. ) => void
  31620. /** 接口调用成功的回调函数 */
  31621. type StartLocationUpdateBackgroundSuccessCallback = (
  31622. res: GeneralCallbackResult
  31623. ) => void
  31624. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31625. type StartLocationUpdateCompleteCallback = (
  31626. res: GeneralCallbackResult
  31627. ) => void
  31628. /** 接口调用失败的回调函数 */
  31629. type StartLocationUpdateFailCallback = (res: GeneralCallbackResult) => void
  31630. /** 接口调用成功的回调函数 */
  31631. type StartLocationUpdateSuccessCallback = (
  31632. res: GeneralCallbackResult
  31633. ) => void
  31634. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31635. type StartPreviewCompleteCallback = (res: GeneralCallbackResult) => void
  31636. /** 接口调用失败的回调函数 */
  31637. type StartPreviewFailCallback = (res: GeneralCallbackResult) => void
  31638. /** 接口调用成功的回调函数 */
  31639. type StartPreviewSuccessCallback = (res: GeneralCallbackResult) => void
  31640. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31641. type StartPullDownRefreshCompleteCallback = (
  31642. res: GeneralCallbackResult
  31643. ) => void
  31644. /** 接口调用失败的回调函数 */
  31645. type StartPullDownRefreshFailCallback = (res: GeneralCallbackResult) => void
  31646. /** 接口调用成功的回调函数 */
  31647. type StartPullDownRefreshSuccessCallback = (
  31648. res: GeneralCallbackResult
  31649. ) => void
  31650. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31651. type StartRecordCompleteCallback = (res: GeneralCallbackResult) => void
  31652. /** 接口调用失败的回调函数 */
  31653. type StartRecordFailCallback = (res: GeneralCallbackResult) => void
  31654. /** 超过录制时长上限时会结束录像并触发此回调,录像异常退出时也会触发此回调 */
  31655. type StartRecordTimeoutCallback = (
  31656. result: StartRecordTimeoutCallbackResult
  31657. ) => void
  31658. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31659. type StartSoterAuthenticationCompleteCallback = (
  31660. res: GeneralCallbackResult
  31661. ) => void
  31662. /** 接口调用失败的回调函数 */
  31663. type StartSoterAuthenticationFailCallback = (
  31664. res: GeneralCallbackResult
  31665. ) => void
  31666. /** 接口调用成功的回调函数 */
  31667. type StartSoterAuthenticationSuccessCallback = (
  31668. result: StartSoterAuthenticationSuccessCallbackResult
  31669. ) => void
  31670. /** 接口调用成功的回调函数 */
  31671. type StartSuccessCallback = (res: GeneralCallbackResult) => void
  31672. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31673. type StartWifiCompleteCallback = (res: WifiError) => void
  31674. /** 接口调用失败的回调函数 */
  31675. type StartWifiFailCallback = (res: WifiError) => void
  31676. /** 接口调用成功的回调函数 */
  31677. type StartWifiSuccessCallback = (res: WifiError) => void
  31678. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31679. type StatCompleteCallback = (res: FileError) => void
  31680. /** 接口调用失败的回调函数 */
  31681. type StatFailCallback = (res: FileError) => void
  31682. /** 接口调用成功的回调函数 */
  31683. type StatSuccessCallback = (result: StatSuccessCallbackResult) => void
  31684. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31685. type StopAccelerometerCompleteCallback = (
  31686. res: GeneralCallbackResult
  31687. ) => void
  31688. /** 接口调用失败的回调函数 */
  31689. type StopAccelerometerFailCallback = (res: GeneralCallbackResult) => void
  31690. /** 接口调用成功的回调函数 */
  31691. type StopAccelerometerSuccessCallback = (res: GeneralCallbackResult) => void
  31692. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31693. type StopAdvertisingCompleteCallback = (res: GeneralCallbackResult) => void
  31694. /** 接口调用失败的回调函数 */
  31695. type StopAdvertisingFailCallback = (res: GeneralCallbackResult) => void
  31696. /** 接口调用成功的回调函数 */
  31697. type StopAdvertisingSuccessCallback = (res: GeneralCallbackResult) => void
  31698. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31699. type StopBGMCompleteCallback = (res: GeneralCallbackResult) => void
  31700. /** 接口调用失败的回调函数 */
  31701. type StopBGMFailCallback = (res: GeneralCallbackResult) => void
  31702. /** 接口调用成功的回调函数 */
  31703. type StopBGMSuccessCallback = (res: GeneralCallbackResult) => void
  31704. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31705. type StopBackgroundAudioCompleteCallback = (
  31706. res: GeneralCallbackResult
  31707. ) => void
  31708. /** 接口调用失败的回调函数 */
  31709. type StopBackgroundAudioFailCallback = (res: GeneralCallbackResult) => void
  31710. /** 接口调用成功的回调函数 */
  31711. type StopBackgroundAudioSuccessCallback = (
  31712. res: GeneralCallbackResult
  31713. ) => void
  31714. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31715. type StopBeaconDiscoveryCompleteCallback = (res: BeaconError) => void
  31716. /** 接口调用失败的回调函数 */
  31717. type StopBeaconDiscoveryFailCallback = (res: BeaconError) => void
  31718. /** 接口调用成功的回调函数 */
  31719. type StopBeaconDiscoverySuccessCallback = (res: BeaconError) => void
  31720. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31721. type StopBluetoothDevicesDiscoveryCompleteCallback = (
  31722. res: BluetoothError
  31723. ) => void
  31724. /** 接口调用失败的回调函数 */
  31725. type StopBluetoothDevicesDiscoveryFailCallback = (
  31726. res: BluetoothError
  31727. ) => void
  31728. /** 接口调用成功的回调函数 */
  31729. type StopBluetoothDevicesDiscoverySuccessCallback = (
  31730. res: BluetoothError
  31731. ) => void
  31732. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31733. type StopCompassCompleteCallback = (res: GeneralCallbackResult) => void
  31734. /** 接口调用失败的回调函数 */
  31735. type StopCompassFailCallback = (res: GeneralCallbackResult) => void
  31736. /** 接口调用成功的回调函数 */
  31737. type StopCompassSuccessCallback = (res: GeneralCallbackResult) => void
  31738. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31739. type StopCompleteCallback = (res: GeneralCallbackResult) => void
  31740. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31741. type StopDeviceMotionListeningCompleteCallback = (
  31742. res: GeneralCallbackResult
  31743. ) => void
  31744. /** 接口调用失败的回调函数 */
  31745. type StopDeviceMotionListeningFailCallback = (
  31746. res: GeneralCallbackResult
  31747. ) => void
  31748. /** 接口调用成功的回调函数 */
  31749. type StopDeviceMotionListeningSuccessCallback = (
  31750. res: GeneralCallbackResult
  31751. ) => void
  31752. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31753. type StopDiscoveryCompleteCallback = (res: Nfcrwerror) => void
  31754. /** 接口调用失败的回调函数 */
  31755. type StopDiscoveryFailCallback = (res: Nfcrwerror) => void
  31756. /** 接口调用成功的回调函数 */
  31757. type StopDiscoverySuccessCallback = (res: Nfcrwerror) => void
  31758. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31759. type StopFaceDetectCompleteCallback = (res: GeneralCallbackResult) => void
  31760. /** 接口调用失败的回调函数 */
  31761. type StopFaceDetectFailCallback = (res: GeneralCallbackResult) => void
  31762. /** 接口调用成功的回调函数 */
  31763. type StopFaceDetectSuccessCallback = (res: GeneralCallbackResult) => void
  31764. /** 接口调用失败的回调函数 */
  31765. type StopFailCallback = (res: GeneralCallbackResult) => void
  31766. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31767. type StopGyroscopeCompleteCallback = (res: GeneralCallbackResult) => void
  31768. /** 接口调用失败的回调函数 */
  31769. type StopGyroscopeFailCallback = (res: GeneralCallbackResult) => void
  31770. /** 接口调用成功的回调函数 */
  31771. type StopGyroscopeSuccessCallback = (res: GeneralCallbackResult) => void
  31772. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31773. type StopHCECompleteCallback = (res: NFCError) => void
  31774. /** 接口调用失败的回调函数 */
  31775. type StopHCEFailCallback = (res: NFCError) => void
  31776. /** 接口调用成功的回调函数 */
  31777. type StopHCESuccessCallback = (res: NFCError) => void
  31778. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31779. type StopLocalServiceDiscoveryCompleteCallback = (
  31780. res: GeneralCallbackResult
  31781. ) => void
  31782. /** 接口调用失败的回调函数 */
  31783. type StopLocalServiceDiscoveryFailCallback = (
  31784. result: StopLocalServiceDiscoveryFailCallbackResult
  31785. ) => void
  31786. /** 接口调用成功的回调函数 */
  31787. type StopLocalServiceDiscoverySuccessCallback = (
  31788. res: GeneralCallbackResult
  31789. ) => void
  31790. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31791. type StopLocationUpdateCompleteCallback = (
  31792. res: GeneralCallbackResult
  31793. ) => void
  31794. /** 接口调用失败的回调函数 */
  31795. type StopLocationUpdateFailCallback = (res: GeneralCallbackResult) => void
  31796. /** 接口调用成功的回调函数 */
  31797. type StopLocationUpdateSuccessCallback = (
  31798. res: GeneralCallbackResult
  31799. ) => void
  31800. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31801. type StopPreviewCompleteCallback = (res: GeneralCallbackResult) => void
  31802. /** 接口调用失败的回调函数 */
  31803. type StopPreviewFailCallback = (res: GeneralCallbackResult) => void
  31804. /** 接口调用成功的回调函数 */
  31805. type StopPreviewSuccessCallback = (res: GeneralCallbackResult) => void
  31806. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31807. type StopPullDownRefreshCompleteCallback = (
  31808. res: GeneralCallbackResult
  31809. ) => void
  31810. /** 接口调用失败的回调函数 */
  31811. type StopPullDownRefreshFailCallback = (res: GeneralCallbackResult) => void
  31812. /** 接口调用成功的回调函数 */
  31813. type StopPullDownRefreshSuccessCallback = (
  31814. res: GeneralCallbackResult
  31815. ) => void
  31816. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31817. type StopRecordCompleteCallback = (res: GeneralCallbackResult) => void
  31818. /** 接口调用失败的回调函数 */
  31819. type StopRecordFailCallback = (res: GeneralCallbackResult) => void
  31820. /** 接口调用成功的回调函数 */
  31821. type StopSuccessCallback = (res: GeneralCallbackResult) => void
  31822. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31823. type StopVoiceCompleteCallback = (res: GeneralCallbackResult) => void
  31824. /** 接口调用失败的回调函数 */
  31825. type StopVoiceFailCallback = (res: GeneralCallbackResult) => void
  31826. /** 接口调用成功的回调函数 */
  31827. type StopVoiceSuccessCallback = (res: GeneralCallbackResult) => void
  31828. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31829. type StopWifiCompleteCallback = (res: WifiError) => void
  31830. /** 接口调用失败的回调函数 */
  31831. type StopWifiFailCallback = (res: WifiError) => void
  31832. /** 接口调用成功的回调函数 */
  31833. type StopWifiSuccessCallback = (res: WifiError) => void
  31834. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31835. type SubscribeVoIPVideoMembersCompleteCallback = (
  31836. res: GeneralCallbackResult
  31837. ) => void
  31838. /** 接口调用失败的回调函数 */
  31839. type SubscribeVoIPVideoMembersFailCallback = (
  31840. res: GeneralCallbackResult
  31841. ) => void
  31842. /** 接口调用成功的回调函数 */
  31843. type SubscribeVoIPVideoMembersSuccessCallback = (
  31844. res: GeneralCallbackResult
  31845. ) => void
  31846. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31847. type SwitchCameraCompleteCallback = (res: GeneralCallbackResult) => void
  31848. /** 接口调用失败的回调函数 */
  31849. type SwitchCameraFailCallback = (res: GeneralCallbackResult) => void
  31850. /** 接口调用成功的回调函数 */
  31851. type SwitchCameraSuccessCallback = (res: GeneralCallbackResult) => void
  31852. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31853. type SwitchCastingCompleteCallback = (res: GeneralCallbackResult) => void
  31854. /** 接口调用失败的回调函数 */
  31855. type SwitchCastingFailCallback = (res: GeneralCallbackResult) => void
  31856. /** 接口调用成功的回调函数 */
  31857. type SwitchCastingSuccessCallback = (res: GeneralCallbackResult) => void
  31858. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31859. type SwitchTabCompleteCallback = (res: GeneralCallbackResult) => void
  31860. /** 接口调用失败的回调函数 */
  31861. type SwitchTabFailCallback = (res: GeneralCallbackResult) => void
  31862. /** 接口调用成功的回调函数 */
  31863. type SwitchTabSuccessCallback = (res: GeneralCallbackResult) => void
  31864. /** onMessage 传入的监听函数。不传此参数则移除所有监听函数。 */
  31865. type TCPSocketOffMessageCallback = (
  31866. result: TCPSocketOnMessageListenerResult
  31867. ) => void
  31868. /** 当接收到数据的时触发该事件的监听函数 */
  31869. type TCPSocketOnMessageCallback = (
  31870. result: TCPSocketOnMessageListenerResult
  31871. ) => void
  31872. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31873. type TakePhotoCompleteCallback = (res: GeneralCallbackResult) => void
  31874. /** 接口调用失败的回调函数 */
  31875. type TakePhotoFailCallback = (res: GeneralCallbackResult) => void
  31876. /** 接口调用成功的回调函数 */
  31877. type TakePhotoSuccessCallback = (
  31878. result: TakePhotoSuccessCallbackResult
  31879. ) => void
  31880. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31881. type TakeSnapshotCompleteCallback = (res: GeneralCallbackResult) => void
  31882. /** 接口调用失败的回调函数 */
  31883. type TakeSnapshotFailCallback = (res: GeneralCallbackResult) => void
  31884. /** 接口调用成功的回调函数 */
  31885. type TakeSnapshotSuccessCallback = (
  31886. result: TakeSnapshotSuccessCallbackResult
  31887. ) => void
  31888. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31889. type ToScreenLocationCompleteCallback = (res: GeneralCallbackResult) => void
  31890. /** 接口调用失败的回调函数 */
  31891. type ToScreenLocationFailCallback = (res: GeneralCallbackResult) => void
  31892. /** 接口调用成功的回调函数 */
  31893. type ToScreenLocationSuccessCallback = (
  31894. result: ToScreenLocationSuccessCallbackResult
  31895. ) => void
  31896. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31897. type ToggleTorchCompleteCallback = (res: GeneralCallbackResult) => void
  31898. /** 接口调用失败的回调函数 */
  31899. type ToggleTorchFailCallback = (res: GeneralCallbackResult) => void
  31900. /** 接口调用成功的回调函数 */
  31901. type ToggleTorchSuccessCallback = (res: GeneralCallbackResult) => void
  31902. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31903. type TransceiveCompleteCallback = (res: Nfcrwerror) => void
  31904. /** 接口调用失败的回调函数 */
  31905. type TransceiveFailCallback = (res: Nfcrwerror) => void
  31906. /** 接口调用成功的回调函数 */
  31907. type TransceiveSuccessCallback = (
  31908. result: TransceiveSuccessCallbackResult
  31909. ) => void
  31910. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31911. type TranslateMarkerCompleteCallback = (res: GeneralCallbackResult) => void
  31912. /** 接口调用失败的回调函数 */
  31913. type TranslateMarkerFailCallback = (res: GeneralCallbackResult) => void
  31914. /** 接口调用成功的回调函数 */
  31915. type TranslateMarkerSuccessCallback = (res: GeneralCallbackResult) => void
  31916. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31917. type TruncateCompleteCallback = (res: FileError) => void
  31918. /** 接口调用失败的回调函数 */
  31919. type TruncateFailCallback = (res: FileError) => void
  31920. /** 接口调用成功的回调函数 */
  31921. type TruncateSuccessCallback = (res: FileError) => void
  31922. /** onClose 传入的监听函数。不传此参数则移除所有监听函数。 */
  31923. type UDPSocketOffCloseCallback = (res: GeneralCallbackResult) => void
  31924. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  31925. type UDPSocketOffErrorCallback = (result: GeneralCallbackResult) => void
  31926. /** onMessage 传入的监听函数。不传此参数则移除所有监听函数。 */
  31927. type UDPSocketOffMessageCallback = (
  31928. result: UDPSocketOnMessageListenerResult
  31929. ) => void
  31930. type UDPSocketOnCloseCallback = (res: GeneralCallbackResult) => void
  31931. type UDPSocketOnErrorCallback = (result: GeneralCallbackResult) => void
  31932. /** 收到消息的事件的监听函数 */
  31933. type UDPSocketOnMessageCallback = (
  31934. result: UDPSocketOnMessageListenerResult
  31935. ) => void
  31936. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31937. type UndoCompleteCallback = (res: GeneralCallbackResult) => void
  31938. /** 接口调用失败的回调函数 */
  31939. type UndoFailCallback = (res: GeneralCallbackResult) => void
  31940. /** 接口调用成功的回调函数 */
  31941. type UndoSuccessCallback = (res: GeneralCallbackResult) => void
  31942. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31943. type UnlinkCompleteCallback = (res: FileError) => void
  31944. /** 接口调用失败的回调函数 */
  31945. type UnlinkFailCallback = (res: FileError) => void
  31946. /** 接口调用成功的回调函数 */
  31947. type UnlinkSuccessCallback = (res: FileError) => void
  31948. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31949. type UnzipCompleteCallback = (res: FileError) => void
  31950. /** 接口调用失败的回调函数 */
  31951. type UnzipFailCallback = (res: FileError) => void
  31952. /** 接口调用成功的回调函数 */
  31953. type UnzipSuccessCallback = (res: FileError) => void
  31954. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31955. type UpdateGroundOverlayCompleteCallback = (
  31956. res: GeneralCallbackResult
  31957. ) => void
  31958. /** 接口调用失败的回调函数 */
  31959. type UpdateGroundOverlayFailCallback = (res: GeneralCallbackResult) => void
  31960. /** 接口调用成功的回调函数 */
  31961. type UpdateGroundOverlaySuccessCallback = (
  31962. res: GeneralCallbackResult
  31963. ) => void
  31964. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31965. type UpdateShareMenuCompleteCallback = (res: GeneralCallbackResult) => void
  31966. /** 接口调用失败的回调函数 */
  31967. type UpdateShareMenuFailCallback = (res: GeneralCallbackResult) => void
  31968. /** 接口调用成功的回调函数 */
  31969. type UpdateShareMenuSuccessCallback = (res: GeneralCallbackResult) => void
  31970. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31971. type UpdateVoIPChatMuteConfigCompleteCallback = (
  31972. res: GeneralCallbackResult
  31973. ) => void
  31974. /** 接口调用失败的回调函数 */
  31975. type UpdateVoIPChatMuteConfigFailCallback = (
  31976. res: GeneralCallbackResult
  31977. ) => void
  31978. /** 接口调用成功的回调函数 */
  31979. type UpdateVoIPChatMuteConfigSuccessCallback = (
  31980. res: GeneralCallbackResult
  31981. ) => void
  31982. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31983. type UpdateWeChatAppCompleteCallback = (res: GeneralCallbackResult) => void
  31984. /** 接口调用失败的回调函数 */
  31985. type UpdateWeChatAppFailCallback = (res: GeneralCallbackResult) => void
  31986. /** 接口调用成功的回调函数 */
  31987. type UpdateWeChatAppSuccessCallback = (res: GeneralCallbackResult) => void
  31988. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  31989. type UploadFileCompleteCallback = (res: GeneralCallbackResult) => void
  31990. /** 接口调用失败的回调函数 */
  31991. type UploadFileFailCallback = (res: GeneralCallbackResult) => void
  31992. /** 接口调用成功的回调函数 */
  31993. type UploadFileSuccessCallback = (
  31994. result: UploadFileSuccessCallbackResult
  31995. ) => void
  31996. /** onProgressUpdate 传入的监听函数。不传此参数则移除所有监听函数。 */
  31997. type UploadTaskOffProgressUpdateCallback = (
  31998. result: UploadTaskOnProgressUpdateListenerResult
  31999. ) => void
  32000. /** 上传进度变化事件的监听函数 */
  32001. type UploadTaskOnProgressUpdateCallback = (
  32002. result: UploadTaskOnProgressUpdateListenerResult
  32003. ) => void
  32004. /** 开启会话回调 */
  32005. type VKSessionStartCallback = (
  32006. /** 参数 status 可选值:
  32007. * - 0: 成功;
  32008. * - 104: 用户取消授权;
  32009. * - 112: 接口未在隐私协议中声明;
  32010. * - 1025: 小程序隐私接口被封禁,[解决方案参考链接](https://developers.weixin.qq.com/community/develop/doc/00062a6d514c88baacdf52e8a56009);
  32011. * - 1026: 小游戏隐私接口被封禁,[解决方案参考链接](https://developers.weixin.qq.com/community/minigame/doc/0004c84925817819b7ffd8b2356008);
  32012. * - 2000001: 参数错误;
  32013. * - 2003000: 会话不可用;
  32014. * - 2000000: 系统错误;
  32015. * - 2000002: 设备不支持;
  32016. * - 2000003: 系统不支持;
  32017. * - 2000004: 设备不支持;
  32018. * - 2003001: 未开启系统相机权限;
  32019. * - 2003002: 未开启小程序相机权限; */
  32020. status:
  32021. | 0
  32022. | 104
  32023. | 112
  32024. | 1025
  32025. | 1026
  32026. | 2000001
  32027. | 2003000
  32028. | 2000000
  32029. | 2000002
  32030. | 2000003
  32031. | 2000004
  32032. | 2003001
  32033. | 2003002
  32034. ) => void
  32035. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  32036. type VibrateLongCompleteCallback = (res: GeneralCallbackResult) => void
  32037. /** 接口调用失败的回调函数 */
  32038. type VibrateLongFailCallback = (res: GeneralCallbackResult) => void
  32039. /** 接口调用成功的回调函数 */
  32040. type VibrateLongSuccessCallback = (res: GeneralCallbackResult) => void
  32041. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  32042. type VibrateShortCompleteCallback = (res: GeneralCallbackResult) => void
  32043. /** 接口调用失败的回调函数 */
  32044. type VibrateShortFailCallback = (
  32045. result: VibrateShortFailCallbackResult
  32046. ) => void
  32047. /** 接口调用成功的回调函数 */
  32048. type VibrateShortSuccessCallback = (res: GeneralCallbackResult) => void
  32049. /** 主线程/Worker 线程向当前线程发送的消息的事件的监听函数 */
  32050. type WorkerOnMessageCallback = (
  32051. result: WorkerOnMessageListenerResult
  32052. ) => void
  32053. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  32054. type WriteBLECharacteristicValueCompleteCallback = (
  32055. res: BluetoothError
  32056. ) => void
  32057. /** 接口调用失败的回调函数 */
  32058. type WriteBLECharacteristicValueFailCallback = (res: BluetoothError) => void
  32059. /** 接口调用成功的回调函数 */
  32060. type WriteBLECharacteristicValueSuccessCallback = (
  32061. res: BluetoothError
  32062. ) => void
  32063. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  32064. type WriteCharacteristicValueCompleteCallback = (
  32065. res: GeneralCallbackResult
  32066. ) => void
  32067. /** 接口调用失败的回调函数 */
  32068. type WriteCharacteristicValueFailCallback = (
  32069. res: GeneralCallbackResult
  32070. ) => void
  32071. /** 接口调用成功的回调函数 */
  32072. type WriteCharacteristicValueSuccessCallback = (
  32073. res: GeneralCallbackResult
  32074. ) => void
  32075. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  32076. type WriteCompleteCallback = (res: FileError) => void
  32077. /** 接口调用失败的回调函数 */
  32078. type WriteFailCallback = (res: FileError) => void
  32079. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  32080. type WriteFileCompleteCallback = (res: FileError) => void
  32081. /** 接口调用失败的回调函数 */
  32082. type WriteFileFailCallback = (res: FileError) => void
  32083. /** 接口调用成功的回调函数 */
  32084. type WriteFileSuccessCallback = (res: FileError) => void
  32085. /** 接口调用结束的回调函数(调用成功、失败都会执行) */
  32086. type WriteNdefMessageCompleteCallback = (res: Nfcrwerror) => void
  32087. /** 接口调用失败的回调函数 */
  32088. type WriteNdefMessageFailCallback = (res: Nfcrwerror) => void
  32089. /** 接口调用成功的回调函数 */
  32090. type WriteNdefMessageSuccessCallback = (res: Nfcrwerror) => void
  32091. /** 接口调用成功的回调函数 */
  32092. type WriteSuccessCallback = (result: WriteSuccessCallbackResult) => void
  32093. /** onError 传入的监听函数。不传此参数则移除所有监听函数。 */
  32094. type WxOffErrorCallback = (res: GeneralCallbackResult) => void
  32095. /** 小程序错误事件的监听函数 */
  32096. type WxOnErrorCallback = (
  32097. /** 错误 */
  32098. error: Error
  32099. ) => void
  32100. /** 接口调用成功的回调函数 */
  32101. type WxStartRecordSuccessCallback = (
  32102. result: StartRecordSuccessCallbackResult
  32103. ) => void
  32104. /** 接口调用成功的回调函数 */
  32105. type WxStopRecordSuccessCallback = (res: GeneralCallbackResult) => void
  32106. }